Setting Up the Robot Model - umigv/simulation_stack GitHub Wiki

This guide shows you how to set up a URDF file from a physical robot. When creating a new package, you should use marvin_simulation as a basis and modify it accordingly. Note that having experience with CAD will be immensely helpful for this process.

Segmentation

First, break the robot down into its major components. This usually includes the chassis body, wheels, casters, and the individual sensors. Approximate each part as basic geometric shapes (sphere, cylinder, box).

Measurement Collection

The next step is to measure the dimensions and offset of each robot components. This can either be done physically with a tape measure or by measuring the CAD provided by the platform team. I recommend creating a sketch in Solidworks to record all of these data, as shown below.

Offset Calculation

Define a point on the robot as the base_link. Calculate the offset from the base_link to the joint origin of the other major components. This can be easily done using the smart dimension tool within Solidworks sketch.

Make URDF

The best way to learn will be by referencing past files. Build the model using the measured dimensions and offsets, then check the model using the display.launch.py launch file.

Sensor Constants

Lastly, you may have to update sensor constants if new sensors are used. Check what constants are needed for the Gazebo plugin and ask the sensors / computer vision subteam for relevant info.

Testing the Model

Launch Gazebo and RViz (which can be done using the simulation.launch.py launch file). You can control the robot using your keyboard using the teleop_twist_keyboard package. Run ros2 run teleop_twist_keyboard teleop_twist_keybaord to launch the node, then just follow the instructions. Note that the terminal running the node will have to be at the top for keyboard inputs to be registered. If the model is correct, you should see all the transforms moving along. The individual sensors should also be outputting the correct data when visualized in RViz.