Coder Social home page Coder Social logo

robot_modelling's Introduction

github icon

doc. robot modelling

A brief overview about urdf files, xacro files etc aimed at exploring the robot description.

๐Ÿš€ Roadmap

  • Pkgs for robot modelling
  • Generalitites about Robot modelling using URDF
  • Create a pkg for the robot description
  • Generalities about xacro files
  • Creating a robot description for a seven DOF robot manipulator
  • Working with the joint_state_publisher and robot_state_publisher for
  • Creating the robot description for a differential wheeled robot
  • Creating the robot description for the explab_2nd
    • Using the ROS MoveIt! and navigation stack for the assignment

Main packages for robot modelling

ROS uses a standard metapackage for designing and creating models named robot_model.

It basically consists in a set of packages whose purpose is to provide support for the 3D model description reflecting the same features of the real hardware. Those packages are:

  1. urdf - it contains a C++ parser for the Unified Robot Description Format which stands for an XML file representing a general robot model
  2. kdl_parser - It stands for Kinematic and Dynamics Library (KDL). It contains parsers tools needed for creating a kinematic tree. This is used to:
    1. publish the joint states
    2. forward and inverse the kinematic of the robot
  3. joint_state_publisher - It contains a node responsible for:
    1. reading the robot model description
    2. finding its joints
    3. publishing joints' values by means of sliders
  4. robot_state_publisher - It reads the current robot joint states and publishes the 3D poses of each robot link using the kinematics tree
  5. collada_urdf

About urdf

As mentioned in the previoius section the URDF parsers are critical for parsing a robot model with some sensors and a working environment

Screenshot 2022-06-25 at 16 44 50

Only robot with links arranged in tree structure can be described through URDF. Hence, the robot must have:

  • rigid links (flexible ones are not allowed)
  • each link is connected with others by means of joints

The URDF basically consists in a bunch of XML tags, and it represents the kinematic and dynamic description of the robot, its visual represetntation and its collision model

Screenshot 2022-06-25 at 16 46 32

about Xacro

XML Macros (aka Xacro) show some add-ons to improve readbility and for building complex robot's descriptions. The Xacro allows to create macros inside the robot description quite useful.

Screenshot 2022-06-25 at 16 48 25

โš ๏ธ xacro files should always be converted in URDF for being employable

using xacros

use this extension for xacro files, as the first declaration of the file ("name" stands for the name of the robot)

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="โ€ฆ">

we can define properties, as for constants (to avoid hardcoding), i.e.:

<xacro:property name="cluedo_link_length" value="0.4" />
<xacro:property name="cluedo_link_radius" value="0.3" />

So that in the urdf file, we can simply refer to the link's lenght through its name, i.e. in the following โ€ฆ

<cylinder length="${cluedo_link_length}" radius="${cluedo_link_radius}"/>

we can also define math expressions using basic operations, i.e.

<cylinder length="${cluedo_link_length+2}" radius="${cluedo_link_radius}"/>
<cylinder length="${cluedo_link_length/3}" radius="${cluedo_link_radius}"/>
<cylinder length="${cluedo_link_length-0.4}" radius="${cluedo_link_radius}"/>

or we can define macros for describing an i.e. an inertial matrix, where the only value that actually changes is its mass, taken as parameter

<xacro:macro name="my_inertial_matrix" params="mass"> 
    <inertial>
        <mass value="${mass}" />
        <inertia ixx="0.3" ixy="0.0" ixz="0.0" iyy="0.2" iyz="0.0" izz="0.5" />
    </inertial>
</xacro:macro>

๐Ÿ”€ From Xacro to urdf

To manually convert the xacro file into urdf, please run

  rosrun xacro xacro simple_robot.xacro --inorder > simple_robot_generated.urdf

Otherwise, to include such conversion inside a launch file, add these two lines:

<param name="robot_description" command="$(find xacro)/xacro --inorder $(find robot_modelling)/urdf/simple_robot.xacro"/>

Being robot_modelling the name of the package

Generalities about robot modelling using URDF

checking the model: step by step

Screenshot 2022-06-25 at 16 58 08

For cheking the model:

  1. save the current model with .urdf extension

  2. check if the current model contains errors (by parsing the urdf tag and show the potentially occuring error)

    check_urdf simple_robot.urdf
  3. for viewing the structure of the robot links and joints graphically (two files will be generated with both .gv and .pdf extensions)

    urdf_to_graphiz simple_robot.urdf
  4. For inspecting the model:

    evince simple_robot.pdf

<<<<<<< HEAD

from xacro to urdf

For ending up with a ".urdf" version of our .xacro file, simply run:

rosrun xacro xacro ???.xacro --inorder > ???.urdf

where ??? simply stands for the name of the file

checking the model: in a wink โ€ฆ

For checking the model, and launch the simulation:

  1. enable "execution" permission

    chmod +x test.py
  2. run the script

    ./test.py 

using Rviz

For taking a look at the robot structure by means of RVIZ, please run:

roslaunch pkgName demo.launch

Tags

For further information about tags click here for the official documentation reference

โ†ช๏ธ Also, remember to substitute values whenever โ€ฆ occurs!

robot def:

<?xml version="1.0"?>
<robot name="<name of the robot>" 
  <link> โ€ฆ </link>
  <link> โ€ฆ </link>
  
  <joint> โ€ฆ </joint>
  <joint> โ€ฆ </joint> 
</robot>

gazebo plugins inclusion:

<gazebo reference="link_ex"> 
  <material>Gazebo/Black</material>
</gazebo>

Link definition

Please note that collision and inertia parameters are needed, for allowing Gazebo to properly simulate the robot model itsef

<link name="<name of the link>"> 
<inertial> 
<mass value ="โ€ฆ">
<inertia ixx="โ€ฆ" ixy="โ€ฆ" ixz="โ€ฆ" iyy="โ€ฆ" iyz="โ€ฆ" izz="โ€ฆ"/>
</inertial> 
  <visual> 
    <geometry>
    < โ€ฆ length="โ€ฆ" radius="โ€ฆ"/> 
    </geometry>
    <origin rpy="โ€ฆ โ€ฆ โ€ฆ" xyz="โ€ฆ โ€ฆ โ€ฆ"/>
  </visual>
  <collision>
    <geometry>
    <cylinder length="โ€ฆ" radius="โ€ฆ"/> 
    </geometry>
    <origin rpy="โ€ฆ" xyz="โ€ฆ"/>
  </collision>
 </link>

Please note the choice of the link's geometry is up to you!

About the geometry tag ... โฌ‡๏ธ There are three shapes of geometries to choose between:
  • The box shape

    <geometry>
        <box size="0.4 0.2 0.08" />
    </geometry>
    
    
  • The cylinder shape

    <geometry>
        <cylinder length="0.05" radius="0.2" />
    </geometry>
    
    
  • The sphere shape

    <geometry>
        <sphere radius="0.08" />
    </geometry>
    
    

Joint definition

Please note that the effort is intended as the maximum force supported by the joint; Moreover, we refer to revolute type joint with radians and to prysmatic type with meters

<joint name="<name of the joint>"> 
  <parent link="โ€ฆ"/>
  <child link="โ€ฆ"/> 
  <origin xyz="โ€ฆ โ€ฆ โ€ฆ"/>
  <axis xyz="โ€ฆ โ€ฆ โ€ฆ" />
  <calibration โ€ฆ />
  <dynamics damping โ€ฆ />
  <limit effort โ€ฆ /> 
</joint>

colors

๐Ÿ”— Find here a Gazebo color palette with xckd color names, by @naoki_mizuno

Files within urdf ...

Please, note that some .xacro files have been taken from the Mastering ROS for robotics programming book, published by Packt. All rights reserved

Repo's overview

.
โ”œโ”€โ”€ CMakeLists.txt
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ launch
โ”‚ย ย  โ”œโ”€โ”€ model_viewer.launch
โ”‚ย ย  โ”œโ”€โ”€ model_viewer_arm.launch
โ”‚ย ย  โ”œโ”€โ”€ model_viewer_cluedo.launch
โ”‚ย ย  โ””โ”€โ”€ model_viewer_mobile.launch
โ”œโ”€โ”€ meshes
โ”‚ย ย  โ””โ”€โ”€ sensors
โ”‚ย ย      โ””โ”€โ”€ xtion_pro_live
โ”‚ย ย          โ”œโ”€โ”€ xtion_pro_live.dae 
โ”‚ย ย          โ””โ”€โ”€ xtion_pro_live.png
โ”œโ”€โ”€ moveit_fixer.py
โ”œโ”€โ”€ package.xml
โ”œโ”€โ”€ test.py
โ”œโ”€โ”€ test_arm.py
โ”œโ”€โ”€ test_cluedo.py
โ”œโ”€โ”€ test_mobile.py
โ””โ”€โ”€ urdf
    โ”œโ”€โ”€ differential_wheeled_base.gv
    โ”œโ”€โ”€ differential_wheeled_base.pdf
    โ”œโ”€โ”€ differential_wheeled_base.urdf
    โ”œโ”€โ”€ differential_wheeled_base.xacro
    โ”œโ”€โ”€ differential_wheeled_robot.gv
    โ”œโ”€โ”€ differential_wheeled_robot.pdf
    โ”œโ”€โ”€ manipulator_arm.gv
    โ”œโ”€โ”€ manipulator_arm.pdf
    โ”œโ”€โ”€ manipulator_arm.urdf
    โ”œโ”€โ”€ manipulator_arm.xacro
    โ”œโ”€โ”€ mobile_and_arm.gv
    โ”œโ”€โ”€ mobile_and_arm.pdf
    โ”œโ”€โ”€ mobile_and_arm.urdf
    โ”œโ”€โ”€ mobile_and_arm.xacro
    โ”œโ”€โ”€ sensors
    โ”‚ย ย  โ”œโ”€โ”€ xtion_pro_live.gazebo.xacro
    โ”‚ย ย  โ””โ”€โ”€ xtion_pro_live.urdf.xacro
    โ”œโ”€โ”€ simple_robot.gv
    โ”œโ”€โ”€ simple_robot.pdf
    โ”œโ”€โ”€ simple_robot.urdf
    โ””โ”€โ”€ wheels.urdf.xacro

6 directories, 34 files

My model assembled

My ultimate model, basically consists in a seven degrees of freedom robotic's manipulator, installed upon a differential wheeled platform, capable of carrying the entire structure within the simulated environment. Moreover, a XTION PRO LIVE motion sensor (rgbd camera) is mounted.

By simply running:

chmod +x test_cluedo.py
./test_cluedo.py

The .xacro file will be converted into urdf. Then, the robot's tree hierarchy will be checked and prompted (by means of a pdf file, as shown in the picture)

Screenshot 2022-07-05 at 11 00 45

Once the pdf file gets closed, the launch file model_viewer_cluedo.launch is triggered and the robot is shown through Rviz

Screenshot 2022-07-05 at 11 31 48

MoveIt configuration

Some remarks

Please note that any implementation of the moveit configuration has been made through a specific version (1.15) of the framework itself. This is the same employed for the Experimental Robotics Laboratory course and it is employed within the package explab_2nd

โš ๏ธ if you have used apt-get ... for downloading MoveIt, please run the script moveit_fixer.py, where all the instructions needed for obtaining the 1.15 moveit framework, have been provided (thanks to Professor Recchiuto )

chmod +x moveit_fixer.py
./moveit_fixer.py

robot_modelling's People

Contributors

fedehub avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.