Skip to content

Commit

Permalink
Merge branch 'ros2' into add-antenna
Browse files Browse the repository at this point in the history
  • Loading branch information
rafal-gorecki committed Jun 12, 2024
2 parents f764bbb + 20b5c9b commit 3d478f8
Show file tree
Hide file tree
Showing 17 changed files with 41 additions and 103 deletions.
16 changes: 6 additions & 10 deletions config/gz_orbbec_astra_remappings.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
---
# https://github.com/orbbec/OrbbecSDK_ROS2#all-available-topics
- ros_topic_name: <robot_namespace><device_namespace>/<camera_name>/color/camera_info
gz_topic_name: <robot_namespace><device_namespace>/color/camera_info
- topic_name: <robot_namespace><device_namespace>/color/camera_info
ros_type_name: sensor_msgs/msg/CameraInfo
gz_type_name: ignition.msgs.CameraInfo
lazy: true

- ros_topic_name: <robot_namespace><device_namespace>/<camera_name>/color/image_raw
gz_topic_name: <robot_namespace><device_namespace>/color/image_raw
- topic_name: <robot_namespace><device_namespace>/color/image_raw
ros_type_name: sensor_msgs/msg/Image
gz_type_name: ignition.msgs.Image
lazy: true

- ros_topic_name: <robot_namespace><device_namespace>/<camera_name>/depth/camera_info
gz_topic_name: <robot_namespace><device_namespace>/depth/camera_info
- topic_name: <robot_namespace><device_namespace>/depth/camera_info
ros_type_name: sensor_msgs/msg/CameraInfo
gz_type_name: ignition.msgs.CameraInfo
lazy: true

- ros_topic_name: <robot_namespace><device_namespace>/<camera_name>/depth/image_raw
gz_topic_name: <robot_namespace><device_namespace>/depth/image_raw
- topic_name: <robot_namespace><device_namespace>/depth/image_raw
ros_type_name: sensor_msgs/msg/Image
gz_type_name: ignition.msgs.Image
lazy: true

- ros_topic_name: <robot_namespace><device_namespace>/<camera_name>/depth/points
gz_ros_topic_name: <robot_namespace><device_namespace>/depth/image_raw/points
- ros_topic_name: <robot_namespace><device_namespace>/depth/points
gz_topic_name: <robot_namespace><device_namespace>/depth/image_raw/points
ros_type_name: sensor_msgs/msg/PointCloud2
gz_type_name: ignition.msgs.PointCloudPacked
lazy: true
1 change: 1 addition & 0 deletions config/gz_ouster_os_remappings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
gz_topic_name: <robot_namespace><device_namespace>/ouster/points/points
ros_type_name: sensor_msgs/msg/PointCloud2
gz_type_name: ignition.msgs.PointCloudPacked
lazy: true
1 change: 1 addition & 0 deletions config/gz_slamtec_rplidar_remappings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
- topic_name: <robot_namespace><device_namespace>/scan
ros_type_name: sensor_msgs/msg/LaserScan
gz_type_name: ignition.msgs.LaserScan
lazy: true
1 change: 1 addition & 0 deletions config/gz_velodyne_remappings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
gz_topic_name: <robot_namespace><device_namespace>/velodyne_points/points
ros_type_name: sensor_msgs/msg/PointCloud2
gz_type_name: ignition.msgs.PointCloudPacked
lazy: true
44 changes: 9 additions & 35 deletions launch/gz_orbbec_astra.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,15 @@
def fix_depth_image_tf(context, *args, **kwargs):
robot_namespace = LaunchConfiguration("robot_namespace").perform(context)
device_namespace = LaunchConfiguration("device_namespace").perform(context)
tf_prefix = LaunchConfiguration("tf_prefix").perform(context)
camera_name = LaunchConfiguration("camera_name").perform(context)

device_namespace_ext = device_namespace + "/"
if device_namespace == "":
device_namespace_ext = ""

tf_prefix_ext = tf_prefix + "_"
if tf_prefix == "":
tf_prefix_ext = ""

parent_frame = tf_prefix_ext + camera_name + "_depth_optical_frame"
child_frame = (
"panther/base_link//"
+ device_namespace_ext
+ tf_prefix_ext
+ camera_name
+ "_orbbec_astra_depth"
)

if robot_namespace.startswith('/'):
robot_namespace = robot_namespace[1:] + "/"

if device_namespace.startswith('/'):
device_namespace = device_namespace[1:]

parent_frame = robot_namespace + device_namespace + "_depth_optical_frame"
child_frame = "panther/base_link/" + robot_namespace + device_namespace + "_orbbec_astra_depth"

static_transform_publisher = Node(
package="tf2_ros",
Expand All @@ -68,15 +58,13 @@ def generate_launch_description():

robot_namespace = LaunchConfiguration("robot_namespace")
device_namespace = LaunchConfiguration("device_namespace")
camera_name = LaunchConfiguration("camera_name")
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,
"<camera_name>": camera_name,
},
)

Expand All @@ -86,24 +74,12 @@ def generate_launch_description():
description="Sensor namespace that will appear before all non absolute topics and TF frames, used for distinguishing multiple cameras on the same robot.",
)

declare_tf_prefix = DeclareLaunchArgument(
"tf_prefix",
default_value="",
description="Prefix added for all links of device. Here used as fix for static transform publisher.",
)

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_camera_name = DeclareLaunchArgument(
"camera_name",
default_value="camera",
description="Name of the camera. It will appear before all tfs and topics.",
)

declare_gz_bridge_name = DeclareLaunchArgument(
"gz_bridge_name",
default_value="gz_bridge",
Expand All @@ -123,8 +99,6 @@ def generate_launch_description():
[
declare_device_namespace,
declare_robot_namespace,
declare_tf_prefix,
declare_camera_name,
declare_gz_bridge_name,
gz_bridge,
OpaqueFunction(function=fix_depth_image_tf),
Expand Down
29 changes: 18 additions & 11 deletions urdf/components.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
<xacro:property name="device_namespace" value="${component['device_namespace']}"
scope="parent" />

<xacro:if value="${robot_namespace == ''}">
<xacro:property name="ns" value="None" scope="parent" />
</xacro:if>
<xacro:unless value="${robot_namespace == ''}">
<xacro:property name="ns" value="${robot_namespace}" scope="parent" />
</xacro:unless>

<xacro:if value="${type == 'ANT02'}">
<xacro:include
filename="$(find ros_components_description)/urdf/teltonika_003R-00253.urdf.xacro"
Expand All @@ -37,7 +44,7 @@
parent_link="${parent_link}"
xyz="${xyz}"
rpy="${rpy}"
namespace="${robot_namespace}"
namespace="${ns}"
device_namespace="${device_namespace}"
/>
</xacro:if>
Expand All @@ -51,7 +58,7 @@
parent_link="${parent_link}"
xyz="${xyz}"
rpy="${rpy}"
namespace="${robot_namespace}"
namespace="${ns}"
device_namespace="${device_namespace}"
/>
</xacro:if>
Expand All @@ -66,7 +73,7 @@
parent_link="${parent_link}"
xyz="${xyz}"
rpy="${rpy}"
namespace="${robot_namespace}"
namespace="${ns}"
device_namespace="${device_namespace}"
/>
</xacro:if>
Expand All @@ -81,7 +88,7 @@
parent_link="${parent_link}"
xyz="${xyz}"
rpy="${rpy}"
namespace="${robot_namespace}"
namespace="${ns}"
device_namespace="${device_namespace}"
/>
</xacro:if>
Expand All @@ -105,7 +112,7 @@
parent_link="${parent_link}"
xyz="${xyz}"
rpy="${rpy}"
namespace="${robot_namespace}"
namespace="${ns}"
device_namespace="${device_namespace}"
model="${ouster_models_dict[type]}"
/>
Expand All @@ -121,7 +128,7 @@
parent_link="${parent_link}"
xyz="${xyz}"
rpy="${rpy}"
namespace="${robot_namespace}"
namespace="${ns}"
device_namespace="${device_namespace}"
/>
</xacro:if>
Expand Down Expand Up @@ -167,7 +174,7 @@
parent_link="${parent_link}"
xyz="${xyz}"
rpy="${rpy}"
namespace="${robot_namespace}"
namespace="${ns}"
device_namespace="${device_namespace}"
kinova_type="gen3"
dof="6"
Expand All @@ -186,7 +193,7 @@
parent_link="${parent_link}"
xyz="${xyz}"
rpy="${rpy}"
namespace="${robot_namespace}"
namespace="${ns}"
device_namespace="${device_namespace}"
kinova_type="gen3"
dof="6"
Expand All @@ -205,7 +212,7 @@
parent_link="${parent_link}"
xyz="${xyz}"
rpy="${rpy}"
namespace="${robot_namespace}"
namespace="${ns}"
device_namespace="${device_namespace}"
kinova_type="gen3"
dof="7"
Expand All @@ -224,7 +231,7 @@
parent_link="${parent_link}"
xyz="${xyz}"
rpy="${rpy}"
namespace="${robot_namespace}"
namespace="${ns}"
kinova_type="gen3"
dof="7"
gripper="robotiq_2f_85"
Expand All @@ -241,7 +248,7 @@
parent_link="${parent_link}"
xyz="${xyz}"
rpy="${rpy}"
namespace="${robot_namespace}"
namespace="${ns}"
device_namespace="${device_namespace}"
robotiq_type="2f_85"
/>
Expand Down
8 changes: 2 additions & 6 deletions urdf/intel_realsense_d435.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,7 @@
<near>0.02</near>
<far>300.0</far>
</clip>
<ros>
<namespace>${ns}${device_namespace}</namespace>
</ros>

</sensor>

<sensor type="depth_camera" name="${ns}${device_namespace}_intel_realsense_d435_depth">
Expand Down Expand Up @@ -222,9 +220,7 @@
<stddev>0.005</stddev>
</noise>
</camera>
<ros>
<namespace>${ns}${device_namespace}</namespace>
</ros>

</sensor>
</gazebo>
</xacro:macro>
Expand Down
3 changes: 0 additions & 3 deletions urdf/kinova.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,6 @@
<visualize>true</visualize>
<topic>${ns}${device_namespace}/wrist_mounted_camera</topic>
<enable_metrics>false</enable_metrics>
<ros>
<namespace>${ns}${device_namespace}</namespace>
</ros>
</sensor>
</gazebo>

Expand Down
10 changes: 2 additions & 8 deletions urdf/orbbec_astra.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<topic>${ns}${device_namespace}/color/image_raw</topic>
<visualize>false</visualize>

<ignition_frame_id>${device_namespace}_color_optical_frame</ignition_frame_id>
<ignition_frame_id>${ns}${device_namespace}_color_optical_frame</ignition_frame_id>
<horizontal_fov>${60.0/180.0*pi}</horizontal_fov>
<image>
<width>640</width>
Expand All @@ -111,9 +111,6 @@
<near>0.6</near>
<far>8.0</far>
</clip>
<ros>
<namespace>${ns}${device_namespace}</namespace>
</ros>
</sensor>

<sensor type="depth_camera" name="${ns}${device_namespace}_orbbec_astra_depth">
Expand All @@ -124,7 +121,7 @@
<topic>${ns}${device_namespace}/depth/image_raw</topic>
<visualize>false</visualize>

<ignition_frame_id>${device_namespace}_depth_optical_frame</ignition_frame_id>
<ignition_frame_id>${ns}${device_namespace}_depth_optical_frame</ignition_frame_id>
<camera>
<horizontal_fov>${60.0/180.0*pi}</horizontal_fov>
<image>
Expand All @@ -142,9 +139,6 @@
<stddev>0.005</stddev>
</noise>
</camera>
<ros>
<namespace>${ns}${device_namespace}</namespace>
</ros>
</sensor>
</gazebo>

Expand Down
5 changes: 0 additions & 5 deletions urdf/ouster.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,6 @@
<frame_id>${ns}${prefix}os_lidar</frame_id>
<ignition_frame_id>${ns}${prefix}os_lidar</ignition_frame_id>
<always_on>true</always_on>

<ros>
<namespace>${ns}${device_ns}</namespace>
</ros>

</sensor>
</gazebo>
</xacro:macro>
Expand Down
3 changes: 0 additions & 3 deletions urdf/slamtec_rplidar_a2.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@
</ray>
<always_on>true</always_on>
<visualize>false</visualize>
<ros>
<namespace>${ns}${device_ns}</namespace>
</ros>
</sensor>
</gazebo>
</xacro:macro>
Expand Down
3 changes: 0 additions & 3 deletions urdf/slamtec_rplidar_a3.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@
</ray>
<always_on>true</always_on>
<visualize>false</visualize>
<ros>
<namespace>${ns}${device_ns}</namespace>
</ros>
</sensor>
</gazebo>

Expand Down
3 changes: 0 additions & 3 deletions urdf/slamtec_rplidar_s1.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@
</ray>
<always_on>true</always_on>
<visualize>false</visualize>
<ros>
<namespace>${ns}${device_ns}</namespace>
</ros>
</sensor>
</gazebo>

Expand Down
3 changes: 0 additions & 3 deletions urdf/slamtec_rplidar_s2.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@
</ray>
<always_on>1</always_on>
<visualize>false</visualize>
<ros>
<namespace>${ns}${device_ns}</namespace>
</ros>
</sensor>
</gazebo>

Expand Down
3 changes: 0 additions & 3 deletions urdf/slamtec_rplidar_s3.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@
</ray>
<always_on>1</always_on>
<visualize>false</visualize>
<ros>
<namespace>${ns}${device_ns}</namespace>
</ros>
</sensor>
</gazebo>

Expand Down
Loading

0 comments on commit 3d478f8

Please sign in to comment.