Made cones work

This commit is contained in:
wittenator 2023-10-29 17:05:48 +01:00
parent cde8343a33
commit f581d25590
4 changed files with 359 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,24 @@
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="dcaiti_control">
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="cone">
<model
<xacro:include filename="inertial_macros.xacro"/>
<link name="cone">
<collision>
<geometry>
<cylinder radius="0.112" length="0.3"/>
</geometry>
</collision>
<visual>
<geometry>
<!-- <cylinder radius="0.112" length="0.3"/> -->
<mesh filename="file://$(find dcaiti_control)/description/assets/yellow_cone.dae"/>
</geometry>
</visual>
<xacro:solid_cylinder_inertial
rpy="0 0 0" xyz="0 0 0"
mass="0.5"
radius="0.112" length="0.3" />
</link>
</robot>

View File

@ -17,7 +17,6 @@ from launch.actions import RegisterEventHandler
from launch.event_handlers import OnProcessExit
def generate_launch_description():
# Include the robot_state_publisher launch file, provided by our own package. Force sim time to be enabled
@ -34,6 +33,7 @@ def generate_launch_description():
)
gazebo_params_path = os.path.join(get_package_share_directory(package_name),'config','gazebo_config.yml')
world_path = os.path.join(get_package_share_directory(package_name),'worlds')
description_path = os.path.join(get_package_share_directory(package_name),'description')
# Include the Gazebo launch file, provided by the gazebo_ros package
gazebo = IncludeLaunchDescription(
@ -52,6 +52,17 @@ def generate_launch_description():
output='screen'
)
cone_xacro = f'{description_path}/yellow_cone.xacro'
cone_config = Command(['xacro ', cone_xacro])
spawn_cone = Node(package='ros_gz_sim', executable='create',
arguments=[
'-string', cone_config,
'-name', 'spawned_cone',
'-z', '10',
],
output='screen'
)
# Bridge
bridge = Node(
package='ros_gz_bridge',
@ -104,6 +115,7 @@ def generate_launch_description():
rsp,
gazebo,
spawn_entity,
spawn_cone,
delayed_diff_drive_spawner,
delayed_joint_broad_spawner,
])

View File

@ -22,7 +22,6 @@ def generate_launch_description():
# Process the URDF file
pkg_path = os.path.join(get_package_share_directory('dcaiti_control'))
xacro_file = os.path.join(pkg_path,'description','robot.urdf.xacro')
# xacro_file = "/home/nvidia/ros2_humble/src/turtlebot3_simulations/turtlebot3_gazebo/urdf/turtlebot3_waffle.urdf"
robot_description_config = Command(['xacro ', xacro_file, ' use_ros2_control:=', use_ros2_control, ' use_sim:=', use_sim_time])
twist_mux_params = os.path.join(