diff --git a/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_description/config/physical_parameters.yaml b/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_description/config/physical_parameters.yaml index b3c5a65d..b8ec8378 100644 --- a/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_description/config/physical_parameters.yaml +++ b/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_description/config/physical_parameters.yaml @@ -2,6 +2,7 @@ chassis: length: 1.17 width: 0.807 height: 0.2 + mass: 20 #assuming 20kg wheels: # Should match values defined in uwrt_mars_rover_drivetrain_hw/config/drivetrain_controllers.yaml diff --git a/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_description/launch/gazebo.launch.py b/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_description/launch/gazebo.launch.py new file mode 100644 index 00000000..7b736be3 --- /dev/null +++ b/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_description/launch/gazebo.launch.py @@ -0,0 +1,56 @@ +import os +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + + +from launch_ros.actions import Node +import xacro + + +def generate_launch_description(): + + # Specify the name of the package and path to xacro file within the package + pkg_name = 'uwrt_mars_rover_drivetrain_description' + file_subpath = 'urdf/drivetrain.urdf.xacro' + + + # Use xacro to process the file + xacro_file = os.path.join(get_package_share_directory(pkg_name),file_subpath) + robot_description_raw = xacro.process_file(xacro_file).toxml() + + + # Configure the node + node_robot_state_publisher = Node( + package='robot_state_publisher', + executable='robot_state_publisher', + output='screen', + parameters=[{'robot_description': robot_description_raw, + 'use_sim_time': True}] # add other parameters here if required + ) + + + + gazebo = IncludeLaunchDescription( + PythonLaunchDescriptionSource([os.path.join( + get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), + ) + + + spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', + arguments=['-topic', 'robot_description', + '-entity', 'my_bot'], + output='screen') + + + + + + + # Run the node + return LaunchDescription([ + gazebo, + node_robot_state_publisher, + spawn_entity + ]) \ No newline at end of file diff --git a/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_description/urdf/drivetrain.macro.xacro b/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_description/urdf/drivetrain.macro.xacro index bf94a90b..cfc26de4 100644 --- a/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_description/urdf/drivetrain.macro.xacro +++ b/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_description/urdf/drivetrain.macro.xacro @@ -13,11 +13,18 @@ + + + + + + + @@ -34,6 +41,26 @@ + + + + + + + + + + + + + + @@ -60,7 +87,7 @@ - + diff --git a/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_description/urdf/drivetrain.urdf.xacro b/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_description/urdf/drivetrain.urdf.xacro index 7b7c7c27..9225e7f3 100644 --- a/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_description/urdf/drivetrain.urdf.xacro +++ b/uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_description/urdf/drivetrain.urdf.xacro @@ -29,7 +29,7 @@ - +