UP | HOME

URDF Activity

Activity

URDF

  1. Clone https://github.com/m-elwin/me495_urdf.git
    • In addition to being used for this activity, the file contains a few examples of xacro files and launch files.
  2. Use the see_robot.launch.xml launchfile to run the demonstration.
    • This launchfile should start rviz2 and the joint_state_publisher_gui
  3. In a new terminal window ros2 topic echo the /joint_states
  4. Slide the sliders for the linear and rotational joints in the gui
    • What happens in rviz?
    • What happens to the joint_states messages?
  5. Pass arguments to see_robot.launch.xml so that it loads a different robot.
  6. Change see_robot.launch.xml so it no longer loads the rviz configuration
    • When rviz loads, set it up to see the robot
      • Set the fixed frame
      • Add a "Robot Model" object
      • Set the "Robot Model" object's "Description Source" to "topic"
      • Set the "Robot Model" object's "Description topic" to "/robot_description"
  7. Rename slidebot.urdf to slidebot.urdf.xacro (mv slidebot.urdf slidebot.urdf.xacro)
  8. Add a rotational joint and another cylindrical link to the end of the slidebot's blue cylindrical link
    • The link should be green
    • The link should rotate in the same plane as the blue cylindrical link

Xacro

  1. Modify slidebot.urdf.xacro so that it is a valid xacro file
    • Add xmlns:xacro="http://wiki.ros.org/wiki/xacro" to the robot tag
  2. Create a parameter called base_radius and use it as the radius of the base sphere
    • Declare this parameter directly as a xacro:property
  3. Make the length of the arm 10 times the radius of the base sphere using a formula in xacro
  4. Using the information in xacro YAML
    • load the base_radius from a yaml file instead of declaring it directly in the xacro file.
    • Use a xacro:macro to add a link to the arm that is the same as the current arm link but on the opposite side of the body

Author: Matthew Elwin.