Skip to content

Commit

Permalink
urdf: added realsense xacro macro
Browse files Browse the repository at this point in the history
  • Loading branch information
PangKW-weston committed Jul 17, 2024
1 parent fdbd584 commit 0b05c6f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<xacro:property name="M_PI" value="3.1415926535897931" />

<xacro:arg name="front_camera" default="realsense_d435"/>
<xacro:arg name="rear_camera" default="realsense_d435"/>
<xacro:arg name="left_camera" default="realsense_d435"/>
<xacro:arg name="right_camera" default="realsense_d435"/>
<xacro:arg name="rear_camera" default="rgb_camera"/>
<xacro:arg name="left_camera" default="rgb_camera"/>
<xacro:arg name="right_camera" default="rgb_camera"/>

<material name="silver">
<color rgba="0.700 0.700 0.700 1.000"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@

<xacro:macro name="perception_kit" params="camera_pos camera_type *origin">

<xacro:arg name="use_nominal_extrinsics" default="false"/>
<xacro:include filename="$(find realsense2_description)/urdf/_d435.urdf.xacro" />
<xacro:property name="type" value="${camera_type}" />

<xacro:if value="${type in ['realsense_d435', 'rgb_camera']}">
<link name="${camera_pos}_camera_link">
<xacro:if value="${type in ['realsense_d435']}">
<xacro:sensor_d435 parent="perception_kit_base_link" name="camera1" use_nominal_extrinsics="$(arg use_nominal_extrinsics)">
<origin xyz="0.1 0 0" rpy="0 0 0"/>
</xacro:sensor_d435>
</xacro:if>

<xacro:if value="${type in ['rgb_camera']}">
<link name="${camera_pos}_rgb_camera_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,14 @@ def generate_launch_description():
]),
condition=IfCondition(camera)
),
Node(
package='tf2_ros',
executable='static_transform_publisher',
name='ugv_devkit_v1_base_link_to_base_camera',
arguments=['--x', '0.0', '--y', '0.0', '--z', '0.150',
'--yaw', '0', '--pitch', '0', '--roll', '0',
'--frame-id', 'ugv_devkit_v1_base_link', '--child-frame-id', 'camera_link']
)
# Node(
# package='tf2_ros',
# executable='static_transform_publisher',
# name='ugv_devkit_v1_base_link_to_base_camera',
# arguments=['--x', '0.0', '--y', '0.0', '--z', '0.150',
# '--yaw', '0', '--pitch', '0', '--roll', '0',
# '--frame-id', 'ugv_devkit_v1_base_link', '--child-frame-id', 'camera_link']
# )
])

return LaunchDescription([
Expand Down

0 comments on commit 0b05c6f

Please sign in to comment.