1 Service and Topic

We provide service and topic to interact with mycobot.

1.1 Service

On the command line, enter:

source ~/<ros-workspace>/devel/setup.bash # Add environment variable
roslaunch ultraarm_communication communication_service.launch

Supported parameters:

  • port:Connection serial port string
  • baud:Baud rate

Open a new command line:

# Display active service information
rosservice list

#/get_joint_angles
#/get_joint_coords
#/set_joint_angles
#/set_joint_coords
#/switch_gripper_status
#/switch_pump_status

Relevant commands and descriptions:

Command Detailed description
rosservice list Display active service information
rosservice info [Service name] Displays information about the specified service
rosservice type [Service name] Show service types
rosservice find [Service tyoe] Find the service of the specified service type
rosservice uri [Service name] Show ROSRPC URI service
rosservice args [Service name] Display service parameters
rosservice call [Service name] [Parameter] Request service with the input parameters

1.2 Topic

On the command line, enter:

source ~/<ros-workspace>/devel/setup.bash
roslaunch ultraarm_communication communication_topic.launch

Supported parameters:

  • port:Connection serial port string
  • baud:Baud rate

Open a new command line:

# Display active service information
rostopic list

#/mycobot/angles_goal
#/mycobot/coords_goal
#/mycobot/angles_real
#/mycobot/coords_real
#/mycobot/pump_status
#/mycobot/gripper_status

Relevant commands and descriptions:

Command Detailed description
rostopic list Display the active topic directory
rostopic echo [Topic Name] Display the message content of the specified topic in real time
rostopic find [Type name] Show topics using messages of the specified type
rostopic type [Topic Name] Display the message type of the specified topic
rostopic bw [Topic Name] Display the message bandwidth of the specified topic(bandwidth)
rostopic hz [Topic Name] Display the message data release cycle of the specified topic
rostopic info [Topic Name] Display information of the specified topic
rostopic pub [Topic Name] [Message Type] [Parameter] Publish a message with the specified topic name

Difference between service and topic:

service topic
Synchronization Asynchronous Synchronization
Communication model Release/Subscribe Server/Client
Underlying protocol ROSTCP/ROSUDP ROSTCP/ROSUDP
Feedback mechanism No Yes
Buffer Yes No
Real-time Weak Strong
Node relationship Many To Many One To Many
Applicable scenarios Data transmission Logical processing

You can go to service and topic to deeply understand the use of these two functions

2 Introduction to msg and srv

  • msg:The msg file is a simple text file that describes the ROS message fields.They are used to generate source code for messages in different languages (c++or python, etc.).
  • srv:The srv file is used to describe the service.It consists of two parts: request and response. The msg file is stored in the msg directory of the package, while the srv file is stored in the srv directory.

2.1 rosmsg

Rosmsg is a command-line tool for displaying information about ROS message types.

rosmsg Demonstration:

rosmsg show       # Show message description
rosmsg info       # Show message information
rosmsg list       # List all messages
rosmsg md5        # Display message after md5 encryption
rosmsg package    # Display all messages under a function package
rosmsg packages   # List feature packs containing messages
  • rosmsg list All msg in the current ROS will be listed

  • rosmsg packages List all packages containing messages

  • rosmsg package List all msg under a package

//rosmsg package  # Package Name 
rosmsg package turtlesim
  • rosmsg show :Show message description
//rosmsg show # Message Name
rosmsg show turtlesim/Pose
# Result:
float32 x
float32 y
float32 theta
float32 linear_velocity
float32 angular_velocity
  • The role of rosmsg info is the same as that of rosmsg show

  • rosmsg md5 :A Verification Algorithm,ensure the consistency of data transmission

2.2 rossrv

rossrv is a command line tool used to display information about ROS service types, which is highly similar to the syntax used by rosmsg.

rossrv show       # Show service message details
rossrv info       # Display service message related information
rossrv list       # List all service information
rossrv md5        # Display the service message after md5 encryption
rossrv package    # Display all service messages under a package
rossrv packages   # Show all packages containing service messages
  • rossrv list : All srv messages in the current ROS will be listed

  • rossrv packages: List all packages containing service messages

  • rossrv package: List all msg under a package

//rossrv package # Package name 
rossrv package turtlesim
  • rossrv show: Show message description
//rossrv show # Message name
rossrv show turtlesim/Spawn
# Result:
float32 x
float32 y
float32 theta
string name
---
string name
  • rossrv info: The function is consistent with rossrv show

  • Rossrv md5 uses md5 verification (encryption) for service data

3 URDF Introduce

  • Unified Robot Description Format,unified robot description format,referred to as URDF.The urdf function package in ROS contains a C++parser for URDF,the URDF file uses XML format to describe the robot model.
  • URDF cannot be used alone. It needs to be combined with Rviz or Gazebo. URDF is just a file that needs to be rendered into a graphical robot model in Rviz or Gazebo.

3.1 urdf file description

Code example:

Only some codes are intercepted here for display:

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

<xacro:property name="width" value=".2" />


  <link name="base">
    <visual>
      <geometry>
         <!--- 0.0 0 -0.04  1.5708 3.14159-->
       <mesh filename="package://mycobot_description/urdf/ultraArm_urdf/ultraArm-base.dae"/>
      </geometry>
      <origin xyz = " 0 0 0.0 " rpy = " 0 0 0"/>
    </visual>
    <collision>
      <geometry>
         <!--- 0.0 0 -0.04  1.5708 3.14159-->
        <mesh filename="package://mycobot_description/urdf/ultraArm_urdf/ultraArm-base.dae"/>
      </geometry>
      <origin xyz = " 0 0 0.0 " rpy = " 0 0 0"/>
    </collision>

  </link>

  <link name="link1">
    <visual>
      <geometry>
       <mesh filename="package://mycobot_description/urdf/ultraArm_urdf/ultraArm-1.dae"/>
      </geometry>
      <origin xyz = "0 0 0.122 " rpy = " 3.1415926 0 0"/>
    </visual>
    <collision>
      <geometry>
        <mesh filename="package://mycobot_description/urdf/ultraArm_urdf/ultraArm-1.dae"/>
      </geometry>
      <origin xyz = "0 0  0.122 " rpy = " 3.1415926 0 0"/>
    </collision>
  </link>

  <link name="link2">
    <visual>
      <geometry>    
       <mesh filename="package://mycobot_description/urdf/ultraArm_urdf/ultraArm-2.dae"/>
      </geometry>
      <origin xyz = "-0.03  0.112 0.0  " rpy = " 1.5708 0 0"/>
    </visual>
    <collision>
      <geometry>    
       <mesh filename="package://mycobot_description/urdf/ultraArm_urdf/ultraArm-2.dae"/>
      </geometry>
      <origin xyz = "-0.03  0.112 0.0  " rpy = " 1.5708 0 0"/>
    </collision>     

  </link>

  <link name="link3">
    <visual>
      <geometry>
       <!--- 0.0 0 -0.04 -->
       <mesh filename="package://mycobot_description/urdf/ultraArm_urdf/ultraArm-3.dae"/>
      </geometry>
      <origin xyz = "-0.03 0.23  0.0 " rpy = "1.5708 0 0"/>
    </visual>
    <collision>
      <geometry>
       <!--- 0.0 0 -0.04 -->
       <mesh filename="package://mycobot_description/urdf/ultraArm_urdf/ultraArm-3.dae"/>
      </geometry>
      <origin xyz = "-0.03 0.23  0.0 " rpy = "1.5708 0 0"/>
    </collision>
  </link>


</robot>

It can be seen that the urdf file is not complicated. It is mainly composed of two parts: link and joint.

The link element describes a rigid body with inertia, visual characteristics, and collision attributes

3.2.1 Attribute

name: the name used to describe the link itself

3.2.2 Element

  • <inertial> (Optional)
    • Inertia characteristics of connecting rod
    • <origin> (Optional,defaults to identity if not specified)
      • Defines the reference coordinate of the inertial reference system relative to the connecting rod coordinate system, which must be defined at the center of gravity of the connecting rod, and its coordinate axis can not be parallel to the inertial principal axis.
      • xyz (Optional, default to zero vector) Represents the offset in the x, y, z x, y, zx, y, z directions,the unit is meter.
      • rpy(Optional: defaults to identity if not specified) Represents the rotation of the coordinate axis in the RPY direction, the unit is radian.
    • <mass> Mass properties of connecting rod
    • <inertia> 3 × 3 Rotational inertia matrix,which consists of six independent quantities:ixx, ixy, ixz, iyy, iyz, izz。
  • <visual> (Optional)
    • Visual properties of the connecting rod。It is used to specify the shape of the connecting rod (rectangle, cylinder, etc.). The same connecting rod can have multiple visual elements, and the shape of the connecting rod is formed by two of multiple elements. In general, the model is more complex, and stl calls can be generated after drawing through soildwork. Simple shapes, such as adding end effectors, can be written directly. At the same time, the position of the geometric shape can be adjusted according to the gap between the theoretical model and the actual model.
    • <namel> (Optional) The name of the connecting rod geometry.
    • <origin> (Optional,defaults to identity if not specified)
      • Geometry coordinate system relative to the coordinate system of the connecting rod.
      • xyz (optional: defaults to zero vector) Represents the offset in the x , y , z x,y,zx,y,z directions,the unit is meter.
      • rpy (optional: defaults to identity if not specified) Represents the rotation of the coordinate axis in the RPY direction,the unit is radian.
  • <geometry> (Essential)
    • The shape of the visualization object can be one of the following:
    • <box> Rectangle, the elements include length, width and height. The origin is in the center.
    • <cylinder> Cylinder, the elements include radius and length. Center of origin.
    • <sphere> Sphere, element contains radius. The origin is in the center.
    • <mesh> The grid is determined by the file, and scale is provided to define its boundary.It is recommended to use the Collada. dae file. The. stl file is also supported, but it must be a local file.
  • <material> (Optional)
    • Material of visual components.It can be defined outside the link tag, but it must be inside the robot tag. When defining outside the link tag, it needs to reference the name of the link.
    • <color>(Optional) Colour,it is composed of red/green/blue/alpha,size range is within [0,1]
    • <texture>(Optional) Material properties,defined by file.
  • <collision> (Optional)
    • Collision properties of the link. The collision attributes are different from the visual attributes of the link, and simple collision models are often used to simplify the calculation. The same link can have multiple collision attribute labels, and the collision attribute representation of the link is composed of its defined geometry set.
    • <name> (Optional) Specifies the name of the link geometry
    • <origin> (Optional,defaults to identity if not specified)
      • The reference coordinate system of the impact component is relative to the reference coordinate system of the linkage coordinate system.
      • xyz (Optional, default zero vector) Represents the offset in the x , y , z x,y,zx,y,z directions,the unit is meter.
      • rpy (Optional, defaults to identity if not specified) Represents the rotation of the coordinate axis in the RPY direction,the unit is radian.
    • <geometry> Same as the above description of geometry element

Detailed elements and their functions can be found in Official Documents

3.3 joint Section

The joint section describes the kinematics and dynamics of the joint, and specifies the safety limits of the joint.

3.3.1 Properties of joint:

name:

Specify a unique name for the joint

type:

Specifies the type of joint, where the type can be one of the following:

  • Revolute - The range of hinge joint rotating along the axis is specified by the upper and lower limits.
  • Continuity - A continuous hinge joint that rotates about an axis without upper and lower limits.
  • Prismatic - A slip joint that slides along an axis, the range of which is specified by the upper and lower limits.
  • Fixed - This is not a real joint because it cannot move. All degrees of freedom are locked. This type of joint does not require a shaft, calibration, dynamics, limit or safety_controller.
  • Float - This joint allows movement of all 6 degrees of freedom.
  • Plane - This joint allows movement in a plane perpendicular to the axis.

3.3.2 Element of joint

  • <origin> (Optional,defaults to identity if not specified) Transformation from parent link to child link,joint is located at the origin of the child link,modifying this parameter can adjust the position of the connecting rod, which can be used to adjust the error between the actual model and the theoretical model. However, it is not recommended to modify significantly, because this parameter affects the position of the connecting rod stl, which is easy to affect the impact detection effect.

    • xyz (Optional: Default to zero vector) Represents the offset in the x , y , z x,y,zx,y,z direction,the unit is meter.
    • rpy (Optional,defaults to identity if not specified) Represents the angle of rotation around a fixed axis: roll around the x axis, pitch around the y axis, and yaw around the z axis, expressed in radian.
  • <parent> (Essential)

    • The name of the parent link is a mandatory attribute.
    • link The name of the parent link is the name of the link in the robot structure tree.
  • <child> (Essential)

    • The name of the child link is a mandatory attribute.
    • link The name of child link is the name of the link in the robot structure tree.
  • <axis>(Optional:default is(1,0,0))

    • The axis axis of the joint is in the coordinate system of the joint. This is the rotational joint, the axis of prismatic joint movement, and the standard plane of the planar joint. This axis is specified in the joint coordinate system. Modify this parameter to adjust the axis around which the joint rotates. It is often used to adjust the direction of rotation. If the model rotation is contrary to the actual direction, just multiply by - 1. Fixed and floating joints do not need this element.
    • xyz(Essential) The x, y, z x, y, zx, y, z components representing the axis vector are normalized vectors.
  • <calibration> (Optional)

    • The reference point of the joint, which is used to correct the absolute position of the joint.
    • rising (Optional) When joint moves forward, the reference point will trigger a rising edge.
    • falling (Optional) When joint moves in the positive direction, the reference point will trigger a falling edge.
  • <dynamics>(Optional)

    • This element is used to specify the physical performance of the joint. Its value is used to describe the modeling performance of the joint, especially in simulation.

<limit> (Required when the joint is a rotation or movement joint)

  • This element is a joint kinematic constraint.
  • lower (Optional, 0 by default) Attributes that specify the lower bound of the joint's range of motion(The unit of revolute joint is radian, and the unit of primitive joint is meter),this attribute is ignored for continuous joints.
  • upper (Optional, 0 by default) Attributes that specify the upper bound of the joint's range of motion(The unit of revolute joint is radian, and the unit of primitive joint is meter),this attribute is ignored for continuous joints.
  • effort (Essential) This attribute specifies the maximum force at which the joint runs.
  • velocity (required) This attribute specifies the maximum speed at which the joint runs.

<mimic>(Optional)

  • This tag is used to specify the defined joint to imitate the existing joint.The value of this joint can be calculated by the following formula: value = multiplier * other_joint_value + offset
  • joint(Required) The name of the joint to be imitated.
  • multiplier(Optional) Specify the multiplier factor in the above formula.
  • offset(Optional) Specify the offset term in the above formula.0 by default

<safety_controller> (Optional)

  • This element is a security control restriction. Data under this element will be read into move_group, but it is invalid in practice. Move_group will skip this restriction and directly read the parameter content under limit. Setting this element at the same time may cause planning failure.
  • soft_lower_limit (Optional, 0 by default) This attribute specifies the lower bound of the joint security control boundary and is the starting limit point of the joint security control. This value must be greater than the lower value in the limit above.
  • soft_upper_limit (Optional, 0 by default) This attribute specifies the upper bound of the joint security control boundary and is the starting limit point of the joint security control. This value should be less than the upper value in the above limit.
  • k_position(Optional, 0 by default) This attribute is used to describe the relationship between position and speed.
  • k_velocity(Essential) This attribute is used to describe the relationship between force and velocity.

Detailed elements and their functions can be found in http://wiki.ros.org/urdf/XML/joint

results matching ""

    No results matching ""