Skip to content

Subun-01/ros_task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Creating the package and Robot Description

If

the mini_bot_1.urdf.xacro file was ready, i.e.:

  • mini_bot_1.urdf.xacro file would have the definition of all the links and joints on the robot, along with the planar move gazebo plugin to define a model for actuating and feedback.

Then

we would be able to

  • run ros2 launch ros_task_2.launch.py to open gazebo with the bot inside it
    This launch file will be provided by us. (Linking will be found in this document)
  • and ros2 run teleop_twist_keyboard teleop_twist_keyboard.py to control the simulated robot!

But

the mini_bot_1.urdf.xacro is not ready yet… So let's get started with that.


Now for the mini_bot_1.urdf.xacro file, Following is part of the contents of the urdf file:

<?xml version="1.0" ?>
<!-- 
*****************************************************************************************
*
*        =============================================
*                  Cyborg ROS Task-2
*        =============================================
*
*
*  Filename:            mini_bot.urdf.xacro
*  Created:            	11-09-2023 (by:Srivenkateshwar(e-yantra team))
*  Last Modified:       04-07-2024
*  Modified by:         SOumitra Naik   
*  
*****************************************************************************************
-->


<robot name="mini_bot" xmlns:xacro="http://www.ros.org/wiki/xacro">
    <xacro:include filename="$(find mini_bot)/urdf/materials.xacro"/>
    
    <link name ="footprint_link">

    </link>
    <joint name="footprint_joint" type="fixed">
         <origin
                xyz="0.0 0.0 0.0"
                rpy="0 0 1.047" />
        <parent link="footprint_link"/>
        <child link="base_link"/>
        
        
    </joint>

    <!--Base link-->
    <link name ="base_link">
        <inertial>
            <origin xyz="0 0.0 0.28" rpy="0 0 0" />
            <mass
                value="0.28" />
            <inertia
                ixx="0.011666666666667"
                ixy="0"
                ixz="0"
                iyy="0.011666666666667"
                iyz="0"
                izz="0.011666666666667" />    

        </inertial>
         <collision name="collision">
            <origin
                xyz="0 0.0 0.28"
                rpy="0 0 0" />
          
            <geometry>
                <mesh filename ="file://$(find mini_bot)/meshes/bot_1.dae" scale="0.01  0.01 0.01"/>
                    
            </geometry>
        </collision>
        <visual>
            <origin
                xyz="0 0 0.28"
                rpy="0 0 0" />
            <geometry>
                <mesh 
                filename ="file://$(find mini_bot)/meshes/bot_1.dae" scale="0.01  0.01 0.01"/>
            </geometry>
         
        </visual>
    </link>
.
.
<!-- lot more stuff needs to go here -->
.
.   
</robot>

This is how we’ll need to start the robot definition.

<?xml version="1.0" ?>

This XML declaration just describes some of the most general properties of the document.

<robot name="mini_bot">
<!-- Start of Robot Definition
Inside which we shall have all of the remaining definitions, which will end with the last line of the file: -->
</robot>
<link name="base_link">
</link>

This element is the definition of the chassis of the robot. A single rigid body.

  • inertial: To define the inertial properties of the rigid body (chassis)
    • origin
    • mass
    • inertia matrix: this was generated by solidworks and may or may not accurate, but do note it is a diagonal matrix as expected.
  • visual: To describe only how it LOOKS.
    • origin
    • geometry: Here we enter an STL file (mesh file) for the purpose of visualisation.
  • collision: To describe its interaction with the world.
    • origin
    • geometry: Here we simplify the shape to simple cylinders to make processing collisions easier for gazebo (while still maintaining a reasonable match with the real shape).

Similarly here is the definition of one more link: the right wheel of a three-omni-wheeled bot:

 
     <!-- right_wheel -->
    <link name ="Right_wheel">
        <inertial>
            <origin
                xyz="0.0 -0.05 0.0"
                rpy="-1.57 0.0 0.0"/>
            <mass
                value="0.060" />
            <inertia
                ixx="1.825e-4"
                ixy="0"
                ixz="0.00000000"
                iyy="1.825e-4"
                iyz="0"
                izz="1.825e-4" /> 
            
        </inertial>
         <collision name="R_collision">
         <origin
                xyz="0.0 -0.05 0.0"
                rpy="-1.57 0.0 0.0" />
          <geometry>
            <cylinder length="0.13" radius="0.14"/>
          </geometry>
        </collision>

        <visual>
            <origin
            xyz="0.0 0.0 0.0"
            rpy="0 0 0.0" />
            <geometry>
                <mesh filename ="file://$(find mini_bot)/meshes/wheel.stl" scale="5 5 5"/>
            </geometry>
            
        </visual>
    </link>

This is almost exactly the same as the chassis link definition. So with no further explanation, Let’s add this to the above robot definition.

Now that we have two links in our file, let’s add a joint between the two.

    <!-- Joint -->
    <!--Right wheel joint -->
    <joint name ="Right_wheel_joint" type="continuous" >
        <origin
             xyz="0.58 -0.36 0.18"
            rpy="0.0 0.0 -2.12" />
        <parent link="base_link"/>
        <child link="Right_wheel"/>
        <axis xyz="0.0 1.0 0.0"/>
         <limit
            effort="5"
            velocity="5" />
    </joint>

This element is how we define a joint between two links.

<joint name="right_wheel_joint" type="continuous">
</joint>

the type = “continuous” here means to create a simple revolute joint.

The elements within this element are pretty self-explanatory.

The origin x,y,z, roll, pitch, yaw, is what defines the position of the joint between the “parent link” and the “child link”. The axis define the axis of the revolute joint being defined. And the limit puts some limit on the motion of the joint.

And there you go! we have a robot with one wheel!😄 All we need to do now is add two more wheels to the bot, and of course the gazebo plugin!

...


Problem Statement: Add one more wheel (rear wheel) to the xacro file.

One useful hint: the main element that changes from front wheel to left or right wheel is it’s origin. The x and y will change to +/-0.58 and +/-0.36 for the left/right wheels. We’ll let you figure out the roll, pitch, and yaw by yourself.

Just launch the launch file, run the teleop node as described at the start and have fun driving around the Mini Bot!

BONUS: Observe the Holonomic Mode in teleop package. and figure out what teleop is actually doing by using echo and info. For Ex:ros2 topic info /cmd_vel.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published