Skip to content

Commit

Permalink
Improve model and mecanum description for simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
rbonghi committed Oct 13, 2024
1 parent 792fb8e commit b2cf8df
Show file tree
Hide file tree
Showing 11 changed files with 384 additions and 416 deletions.
8 changes: 0 additions & 8 deletions nanosaur_description/launch/description.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def launch_setup(context: LaunchContext, support_package):
xacro_path = LaunchConfiguration('xacro_path')
head_type = LaunchConfiguration('head_type')
flap_type = LaunchConfiguration('flap_type')
diff_drive_emulation = LaunchConfiguration('diff_drive_emulation')
use_nominal_extrinsics = LaunchConfiguration('use_nominal_extrinsics')

robot_state_publisher_node = Node(
Expand All @@ -56,7 +55,6 @@ def launch_setup(context: LaunchContext, support_package):
'xacro ', xacro_path, ' ',
'head_type:=', head_type, ' ',
'flap_type:=', flap_type, ' ',
'diff_drive_emulation:=', diff_drive_emulation, ' ',
'use_nominal_extrinsics:=', use_nominal_extrinsics, ' ',
])
}]
Expand Down Expand Up @@ -95,11 +93,6 @@ def generate_launch_description():
default_value='empty',
description='Flap type to use. Options: empty, LD06.')

declare_simulation_cmd = DeclareLaunchArgument(
name='diff_drive_emulation',
default_value='false',
description='Enable urdf for differential drive emulation, for simulation.')

declare_use_nominal_extrinsics_cmd = DeclareLaunchArgument(
name='use_nominal_extrinsics',
default_value='false',
Expand All @@ -109,7 +102,6 @@ def generate_launch_description():
ld = LaunchDescription()
ld.add_action(nanosaur_cmd)
ld.add_action(declare_model_path_cmd)
ld.add_action(declare_simulation_cmd)
ld.add_action(declare_head_type_cmd)
ld.add_action(declare_flap_type_cmd)
ld.add_action(declare_use_nominal_extrinsics_cmd)
Expand Down
9 changes: 1 addition & 8 deletions nanosaur_description/launch/display.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def generate_launch_description():
gui = LaunchConfiguration('gui')
head_type = LaunchConfiguration('head_type')
flap_type = LaunchConfiguration('flap_type')
diff_drive_emulation = LaunchConfiguration('diff_drive_emulation')
rvizconfig = LaunchConfiguration('rvizconfig')

default_rviz_config_path = os.path.join(nanosaur_description_path, 'rviz', 'urdf.rviz')
Expand All @@ -56,11 +55,6 @@ def generate_launch_description():
default_value='empty',
description='Flap type to use. Options: empty, LD06.')

declare_simulation_cmd = DeclareLaunchArgument(
name='diff_drive_emulation',
default_value='false',
description='Enable urdf for differential drive emulation, for simulation.')

declare_gui_cmd = DeclareLaunchArgument(
name='gui',
default_value='True',
Expand Down Expand Up @@ -97,15 +91,14 @@ def generate_launch_description():
# https://answers.ros.org/question/306935/ros2-include-a-launch-file-from-a-launch-file/
description_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource([nanosaur_description_path, '/launch/description.launch.py']),
launch_arguments={'head_type': head_type, 'flap_type': flap_type, 'diff_drive_emulation': diff_drive_emulation}.items()
launch_arguments={'head_type': head_type, 'flap_type': flap_type}.items()
)

# Define LaunchDescription variable and return it
ld = LaunchDescription()

ld.add_action(declare_head_type_cmd)
ld.add_action(declare_flap_type_cmd)
ld.add_action(declare_simulation_cmd)
ld.add_action(declare_gui_cmd)
ld.add_action(declare_rvizconfig_cmd)
ld.add_action(description_launch)
Expand Down
162 changes: 162 additions & 0 deletions nanosaur_description/urdf/base.urdf.xacro
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
<?xml version="1.0"?>
<robot name="nanosaur_base" xmlns:xacro="http://ros.org/wiki/xacro">

<xacro:macro name="nanosaur_base" params="base_name length width height mass">

<link name="${base_name}">
<collision>
<origin xyz="${nanosaur_body_offset_x} 0 ${height / 2 - nanosaur_wheel_offset_z}" rpy="0 0 0"/>
<geometry>
<box size="${length} ${width} ${height}" />
</geometry>
</collision>

<xacro:inertial_box m="${mass}" x="${length}" y="${width}" z="${height}">
<origin xyz="${nanosaur_body_offset_x} 0 ${height / 2 - nanosaur_wheel_offset_z}" rpy="0 0 0"/>
</xacro:inertial_box>
</link>

<joint name="nansosaur_chassis_joint" type="fixed">
<origin xyz="0 0 ${0.042 - nanosaur_wheel_offset_z}" rpy="0 0 0"/>
<parent link="${base_name}"/>
<child link="nanosaur_chassis"/>
</joint>

<link name="nanosaur_chassis">
<visual>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry><mesh filename="${path_meshes}/nanosaur_base.stl" scale="0.001 0.001 0.001"/></geometry>
<material name="Green" />
</visual>
</link>

<joint name="nanosaur_cover_batteries_joint" type="fixed">
<origin xyz="0 0 0" rpy="0 0 0" />
<parent link="nanosaur_chassis"/>
<child link="nanosaur_cover_batteries"/>
</joint>

<link name="nanosaur_cover_batteries">
<visual>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry><mesh filename="${path_meshes}/nanosaur_cover_batteries.stl" scale="0.001 0.001 0.001"/></geometry>
<material name="Green" />
</visual>
</link>

<joint name="nanosaur_cover_electronics_joint" type="fixed">
<origin xyz="0 0 0" rpy="0 0 0" />
<parent link="nanosaur_chassis"/>
<child link="nanosaur_cover_electronics"/>
</joint>

<link name="nanosaur_cover_electronics">
<visual>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry><mesh filename="${path_meshes}/nanosaur_cover_electronics.stl" scale="0.001 0.001 0.001"/></geometry>
<material name="Green" />
</visual>
</link>

<joint name="NVIDIA_jetson_joint" type="fixed">
<origin xyz="0.056 0.0078 0.0085" rpy="0 0 0"/>
<parent link="nanosaur_chassis"/>
<child link="NVIDIA_jetson"/>
</joint>

<link name="NVIDIA_jetson">
<visual>
<origin xyz="0 0 0" rpy="0 0 ${M_PI}" />
<geometry><mesh filename="${path_meshes}/parts/NVIDIA_Jetson_Orin_Nano_DevKit.stl"/></geometry>
<material name="DarkGrey" />
</visual>
</link>

<joint name="motor2040_joint" type="fixed">
<origin xyz="0 0 -0.035" rpy="0 ${M_PI} 0"/>
<parent link="nanosaur_chassis"/>
<child link="motor2040"/>
</joint>

<link name="motor2040">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry><mesh filename="${path_meshes}/parts/motor2040.stl"/></geometry>
<material name="DarkGrey" />
</visual>
</link>


<joint name="nanosaur_PCB_electronics_joint" type="fixed">
<origin xyz="-0.046 -0.015 0.0225" rpy="0 0 0" />
<parent link="nanosaur_chassis"/>
<child link="nanosaur_PCB_electronics"/>
</joint>

<link name="nanosaur_PCB_electronics">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry><mesh filename="${path_meshes}/parts/nanosaur_PCB_electronics.stl"/></geometry>
<material name="DarkGrey" />
</visual>
</link>

<joint name="nanosaur_PCB_oleds_joint" type="fixed">
<origin xyz="0.053 0 0.037" rpy="0 ${M_PI / 5.5} 0" />
<parent link="nanosaur_chassis"/>
<child link="nanosaur_PCB_oleds"/>
</joint>

<link name="nanosaur_PCB_oleds">
<visual>
<origin xyz="0 0 0" rpy="0 0 ${M_PI / 2}" />
<geometry><mesh filename="${path_meshes}/parts/nanosaur_PCB_oleds.stl"/></geometry>
<material name="DarkGrey" />
</visual>
</link>

<joint name="display_left_joint" type="fixed">
<origin xyz="-0.0122 0.021 0.003" rpy="0 0 0" />
<parent link="nanosaur_PCB_oleds"/>
<child link="display_left"/>
</joint>

<link name="display_left">
<inertial>
<mass value="0.01"/>
<origin rpy="0 0 0" xyz="0 0 0"/>
<inertia ixx="1.6666666666666668e-07" ixy="0" ixz="0" iyy="1.6666666666666668e-07" iyz="0" izz="1.6666666666666668e-07"/>
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 ${M_PI/2}" />
<geometry>
<mesh filename="${path_meshes}/parts/OLED_Module.stl"/>
</geometry>
<material name="Black" />
</visual>
</link>

<joint name="display_right_joint" type="fixed">
<origin xyz="-0.0122 -0.021 0.003" rpy="0 0 0" />
<parent link="nanosaur_PCB_oleds"/>
<child link="display_right"/>
</joint>

<link name="display_right">
<inertial>
<mass value="0.01"/>
<origin rpy=" 0 0 0" xyz="0 0 0"/>
<inertia ixx="1.6666666666666668e-07" ixy="0" ixz="0" iyy="1.6666666666666668e-07" iyz="0" izz="1.6666666666666668e-07"/>
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 ${M_PI/2}" />
<geometry>
<mesh filename="${path_meshes}/parts/OLED_Module.stl"/>
</geometry>
<material name="Black" />
</visual>
</link>

</xacro:macro>

</robot>
77 changes: 0 additions & 77 deletions nanosaur_description/urdf/materials.gazebo.xacro

This file was deleted.

31 changes: 0 additions & 31 deletions nanosaur_description/urdf/materials.urdf

This file was deleted.

Loading

0 comments on commit b2cf8df

Please sign in to comment.