# lesson_urdf **Repository Path**: bugtransportworker/lesson_urdf ## Basic Information - **Project Name**: lesson_urdf - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-11-27 - **Last Updated**: 2024-11-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Planar 3DOF manipulator robot This project implements a 3D planar robot in urdf. It also contain a launch with a *robot_state_publisher* and a *joint_state_publisher_gui* This urdf create a planar robot with the next chain: ``` robot name is: planar_3dof ---------- Successfully Parsed XML --------------- root Link: world has 1 child(ren) child(1): base_link child(1): link_1 child(1): link_2 child(1): gripper child(1): end ``` This is an adaptation of an old example of ros industrial tutorial(before [docs](https://industrial-training-master.readthedocs.io/) ) about how to create and urdf files ![](robotplanar.PNG) where, $l_1=l_2=0.5$ y $l_3=0.18$ **TODO: put the instruction about how to create the urdf** The full name of URDF (United Robotics Description Format) is a language format used to describe robots in the XML grammar framework. URDF is very popular in ROS world. We can model the robot through URDF and put it in ROS for simulation and analysis. The robot should be described through a tags, where the ***link*** represent the geometry of the robot and the ***joint*** represent the articulation or degree of fredoom of the robot. The tags are documented in [wiki ros](http://wiki.ros.org/urdf/XML), where can be find other tags like sensor or transmission which let to describe this part of robot. Steps to reproduce this repository: - open a terminal inside the docker of [ros2_start](https://github.com/olmerg/ros2_start) or create a workspace. - [create a package](https://docs.ros.org/en/foxy/Tutorials/Creating-Your-First-ROS2-Package.html): ``` cd src ros2 pkg create --build-type ament_python lesson_urdf ``` - Edit the files package.xml to add the next dependencies and your information about the package ``` urdf launch_ros launch_ros robot_state_publisher joint_state_publisher_gui ``` - make a folder urdf inside package ``` cd src/lesson_urdf mkdir urdf gedit planar_3dof.urdf ``` - Create the tag robot inside the file ``` ``` - create a link without geometry which is the world (inside tag ***robot***) ``` ``` - create a link **base_link** which describe the base of the robot of the figure. Note that this link has a ***visual*** tag which describe the ***geometry*** an ***material*** of the piece. It also contain another geometry which is the ***collision*** geometry which could describe a simplified geometry to check collision or other tasks. In this case we represent the base of the robot with a ***cylinder*** of length 0.1 and width 0.2. The cilynde ris created ``` ``` - create a ***joint*** fixed to the world ``` ``` - now create the ***link*** link_1, but now the geometry will be an stl file inside the folder meshes of our project (lesson_urdf). Note that we also can add ***inertial*** propierties of the robot like center of mass and inertia matrix of each link. Also note that collision and visual geometry could be diferrent. Here the cylinder made to simplify the link has a length 0.5 and radius 0.05, but this geometry is created over z axis since -0.25, so in ***origin*** we rotate the figure in y 90 degrees(1.5708) and translate in x 0.25 to start in zero. ``` ``` - now we create the ***joint*** with ***parent*** the base_link and ***child*** the link_1 of type *revolute*. Note that here the ***axis*** of rotation is over z and the link_1 is translated 0.05 over z from the origin of the base_link. ``` ``` - Repetae the process for *link_2*, *gripper* and a link without geomtery *end* ... - save the file - now copy the meshes,rviz and launch folder (TODO [tutorial about launch](https://docs.ros.org/en/foxy/Tutorials/Launch-system.html)) - configure in setup.py the files to be copy: - Add the library at the beginning of the file ``` from glob import glob ``` - append these lines inside data_files ``` ('share/' + package_name, glob('launch/*.py')), ('share/' + package_name+'/urdf/', glob('urdf/*')), ('share/' + package_name+'/rviz/', glob('rviz/*')), ('share/' + package_name+'/meshes/collision/', glob('meshes/collision/*')), ('share/' + package_name+'/meshes/visual/', glob('meshes/visual/*')), ``` - compile the workspace ``` colcon build --symlink-install ``` - add to path the workspace ``` . install/setup.bash ``` - run the launch file ``` ros2 launch lesson_urdf view_robot_launch.py ``` Some error could be: To execute this package please add this to the .bashrc or to the specific console ([Show basic URDF model in Rviz2](https://answers.ros.org/question/348984/show-basic-urdf-model-in-rviz2/) ) echo "export LC_NUMERIC="en_US.UTF-8"" >> ~/.bashrc