-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
780f996
commit d1c427e
Showing
4 changed files
with
180 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
- topic_name: <robot_namespace><device_namespace>/fix | ||
ros_type_name: sensor_msgs/msg/NavSatFix | ||
gz_type_name: ignition.msgs.NavSat | ||
direction: GZ_TO_ROS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Copyright 2024 Husarion sp. z o.o. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import os | ||
|
||
from ament_index_python import get_package_share_directory | ||
from launch_ros.actions import Node | ||
from nav2_common.launch import ReplaceString | ||
|
||
from launch import LaunchDescription | ||
from launch.actions import DeclareLaunchArgument | ||
from launch.substitutions import EnvironmentVariable, LaunchConfiguration | ||
|
||
|
||
def generate_launch_description(): | ||
ros_components_description = get_package_share_directory("ros_components_description") | ||
gz_bridge_config_path = os.path.join( | ||
ros_components_description, "config", "gz_antenna_remappings.yaml" | ||
) | ||
|
||
robot_namespace = LaunchConfiguration("robot_namespace") | ||
device_namespace = LaunchConfiguration("device_namespace") | ||
gz_bridge_name = LaunchConfiguration("gz_bridge_name") | ||
|
||
namespaced_gz_bridge_config_path = ReplaceString( | ||
source_file=gz_bridge_config_path, | ||
replacements={ | ||
"<robot_namespace>": robot_namespace, | ||
"<device_namespace>": device_namespace, | ||
}, | ||
) | ||
|
||
declare_device_namespace = DeclareLaunchArgument( | ||
"device_namespace", | ||
default_value="", | ||
description="Sensor namespace that will appear before all non absolute topics and TF frames, used for distinguishing multiple cameras on the same robot.", | ||
) | ||
|
||
declare_robot_namespace = DeclareLaunchArgument( | ||
"robot_namespace", | ||
default_value=EnvironmentVariable("ROBOT_NAMESPACE", default_value=""), | ||
description="Namespace which will appear in front of all topics (including /tf and /tf_static).", | ||
) | ||
|
||
declare_gz_bridge_name = DeclareLaunchArgument( | ||
"gz_bridge_name", | ||
default_value="gz_bridge", | ||
description="Name of gz bridge node.", | ||
) | ||
|
||
gz_bridge = Node( | ||
package="ros_gz_bridge", | ||
executable="parameter_bridge", | ||
name=gz_bridge_name, | ||
parameters=[{"config_file": namespaced_gz_bridge_config_path}], | ||
namespace=robot_namespace, | ||
output="screen", | ||
) | ||
|
||
return LaunchDescription( | ||
[ | ||
declare_device_namespace, | ||
declare_robot_namespace, | ||
declare_gz_bridge_name, | ||
gz_bridge, | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<robot xmlns:xacro="http://wiki.ros.org/xacro"> | ||
<xacro:macro | ||
name="external_antenna" | ||
params="parent_link xyz rpy | ||
namespace:=None | ||
device_namespace:=None | ||
frame_id:=gps"> | ||
|
||
<xacro:if value="${namespace == 'None'}"> | ||
<xacro:property name="ns" value="" /> | ||
</xacro:if> | ||
<xacro:unless value="${namespace == 'None'}"> | ||
<xacro:property name="ns" value="${namespace}/" /> | ||
</xacro:unless> | ||
|
||
<xacro:if value="${device_namespace == 'None'}"> | ||
<xacro:property name="device_ns" value="" /> | ||
</xacro:if> | ||
<xacro:unless value="${device_namespace == 'None'}"> | ||
<xacro:property name="device_ns" value="${device_namespace}/" /> | ||
</xacro:unless> | ||
|
||
<xacro:if value="${device_namespace == 'None'}"> | ||
<xacro:property name="prefix" value="" /> | ||
</xacro:if> | ||
<xacro:unless value="${device_namespace == 'None'}"> | ||
<xacro:property name="prefix" value="${device_namespace}_" /> | ||
</xacro:unless> | ||
|
||
<joint name="${parent_link.rstrip('_link')}_to_${prefix}external_antenna_joint" | ||
type="fixed"> | ||
<origin xyz="${xyz}" rpy="${rpy}" /> | ||
<parent link="${parent_link}" /> | ||
<child link="${prefix}external_antenna_link" /> | ||
</joint> | ||
|
||
<link name="${prefix}external_antenna_link"> | ||
<visual> | ||
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" /> | ||
<geometry> | ||
<mesh filename="package://panther_description/meshes/components/external_antenna.dae" /> | ||
</geometry> | ||
</visual> | ||
|
||
<collision> | ||
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" /> | ||
<geometry> | ||
<mesh | ||
filename="package://panther_description/meshes/components/external_antenna_collision.stl" /> | ||
</geometry> | ||
</collision> | ||
|
||
<inertial> | ||
<origin xyz="0.045 0.0 0.0058" rpy="0.0 0.0 0.0" /> | ||
<mass value="0.59" /> | ||
<inertia ixx="0.003964" ixy="0.0000000" ixz="0.0" | ||
iyy="0.0003964" iyz="0.0" | ||
izz="0.0004177" /> | ||
</inertial> | ||
</link> | ||
|
||
<joint | ||
name="${prefix}external_antenna_to_${prefix}${frame_id.rstrip('_link')}_joint" | ||
type="fixed"> | ||
<origin xyz="0.045 0.0 0.0058" rpy="0.0 0.0 0.0" /> | ||
<parent link="${prefix}external_antenna_link" /> | ||
<child link="${prefix}${frame_id}" /> | ||
</joint> | ||
|
||
<link name="${prefix}${frame_id}" /> | ||
|
||
<gazebo reference="${prefix}${frame_id}"> | ||
<sensor name="navsat" type="navsat"> | ||
<plugin filename="ignition-gazebo-navsat-system" name="ignition::gazebo::systems::NavSat" /> | ||
<always_on>1</always_on> | ||
<update_rate>5</update_rate> | ||
<topic>${ns}${device_namespace}/fix</topic> | ||
<ignition_frame_id>${prefix}gps</ignition_frame_id> | ||
</sensor> | ||
</gazebo> | ||
</xacro:macro> | ||
</robot> |