Creating a URDF File
Define our robot in 3D Space
Last updated
Define our robot in 3D Space
Last updated
In this section, we will understand how to build a URDF(Unified Robotics Description Format) file which is a variant of xml syntax which is used to model our wolf system for a simulated environment. We create a bunch of files in URDF files and a tool called xacro combiles them into a single complete URDF (Unified Robotics Description Format). This is passed to robot_state_publisher which makes the data available on the /robot_description topic, and also broadcasts the appropriate transforms.
On your development machine, download all the contents of this Github page.
The download will have multiple folders each starting with t#. Save it in a location away from your workspace. (Eg: Downloads or Home directory)
If you do not have a GitHub account already, create one and login. Setup ssh connection between your machine and GitHub so that any modifications on either side can be in sync. For more information, follow the guide below:
From the downloaded folder, copy wolf-robot
folder to src
folder in your workspace.
We need to build the workspace and compile the codes downloaded. But before that, we need to install required packages.
Now we will build the workspace.
If we now check contents (ls
)in our workspace cd /dev_ws
, we will find that there are other folders generated viz. build
, log
, install
. If colcon build says successful, our package is compiled correctly and we can run the package.
The best way to edit files is using an IDE. VS Code helps in formatting and viewing all the files in our workspace. Since we have a few folders and files in our workspace, its a good time to open VS Code and go through all the files created, their extensions and code.
Run the below commands, each on a separate terminal. Before running, make sure to source the environment on each terminal by typing source install/setup.bash
. You may choose to add this to the bashrc file, but we will keep it like this for now.
This should open Rviz2. Rviz2 is a port of Rviz (ROS Visualization tool) is a graphical interface that allows users to view a simulated robot model, log sensor information from the robot's sensors, and replay the logged sensor information. By visualising what the robot is seeing, thinking, and doing, the user can debug a robot application from sensor inputs to planned actions.
On the Rviz window, set fixed frame to "base_link" and add a "RobotModel". Add a TF (Transform System) to visualise the joints in our robot. This shows our simulated robot in a 3D world.
Since the collusion is also added in the code, check and uncheck Visual Enabled and Collusion Enabled to visualize the robot