TF Listener python script, model name is "cam_bot"

In Example 3.4.1, the constructor of CamBotMove in the python script move_generic_model.py uses model_name as “cam_bot”, From where did you get this “cam_bot” name?
Is it the name of the urdf file of the robot?

Also, I could not find the urdf files for the turtle and cambot in the package, could you please show where they are?

Hello @Irfan45,

element or objects in Gazebo must have an unique name. This way we can refer to elements within Gazebo by name. There are many ways to provide a name to an element or object in Gazebo. You can for instance create a .world file that is loaded when Gazebo starts and include objects or elements or you can spawn new objects or elements to a running simulation. Either way you must provide an unique name.

You can use this command to see the elements or objects in the current simulation:

ros2 service call /get_model_list 'gazebo_msgs/srv/GetModelList'

You should see the names cam_bot and turtle in the list.

The name is provided in the launch file that is used to spawn the robot to Gazebo, not in the urdf file.
In this case that file is called cam_bot_spawn.launch.py and is located inside the package spawn_robot_tools, which is located here:

/home/simulations/ros2_sims_ws/src/spawn_robot_tools/spawn_robot_tools_pkg

If you open that file, you will find the name in this portion of the code:

  # Base Name or robot
    robot_base_name = "cam_bot"


    entity_name = robot_base_name

    # Spawn ROBOT Set Gazebo
    spawn_robot = Node(
        package='gazebo_ros',
        executable='spawn_entity.py',
        name='cam_bot_spawn_entity',
        output='screen',
        emulate_tty=True,
        arguments=['-entity',
                   entity_name,
                   '-x', str(position[0]), '-y', str(position[1]
                                                     ), '-z', str(position[2]),
                   '-R', str(orientation[0]), '-P', str(orientation[1]
                                                        ), '-Y', str(orientation[2]),
                   '-topic', '/cam_bot_robot_description'
                   ]

Hope this clarifies your doubts,

Roberto

1 Like

Thanks a lot for the solution

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.