ROS 2.0 basics

NOTE: Work in progress. We're continuously improving the documentation, stay tuned for updates

MARA makes use of HRIM, capturing relevant information to improve the user experience and ensure a correct operation of the whole robotic system. Six of the available topics/services are generic messages such as:

  • ID.srv which publishes the general identity of the component.
  • Power.msg that publishes the power consumption.
  • Status.msg which inform about the resources that are consumed, SpecsCommunication.msg and StateCommunication.msg that are created to inform about communication aspects.
  • Simulation3D.srv and SimulationURDF.srv.msg that sends the device 3D model and related information.
  • Specs.srv is a custom message which reports the main features of the device.
  • StateCommunication.msg is a custom message which reports the state of the device network.
  • SpecsCommunication.srv is a custom message which reports the specs of the device network.

The following table shows more information about the topics:

Topic Name Rate Pub/Sub
goal /hros_actuation_servomotor_000000000001/goal 50 Hz Sub
state /hros_actuation_servomotor_000000000001/state 100 Hz Pub
status /hros_actuation_servomotor_000000000001/status 1 Hz Pub
power /hros_actuation_servomotor_000000000001/power 1 Hz Pub
state comm /hros_actuation_servomotor_000000000001/state_comm 1 Hz Pub

The following table shows more information about the services:

Service Name
id /hros_actuation_servomotor_000000000001/id
 module_3d /hros_actuation_servomotor_000000000001/module_3d
 module_urdf /hros_actuation_servomotor_000000000001/module_urdf
specs comm /hros_actuation_servomotor_000000000001/specs_comm
specs /hros_actuation_servomotor_000000000001/specs

Remember that the naming convention is for:

  • nodes /hros_<device_kind>_<device_name>_<instance_id>
  • topic /hros_<device_kind>_<device_name>_<instance_id>/<topic_name>.
  • service /hros_<device_kind>_<device_name>_<instance_id>/<service_name>.

To visualize the nodes that are running in the ROS 2.0 network in the terminal, you should run ros2 node list:

/hros_actuation_servomotor_000000000001
/hros_actuation_servomotor_000000000002
/hros_actuation_servomotor_000000000003

To visualize the topics that are been exposed by MARA, you should run ros2 topic list. Then, you will see the following topics:

/hros_actuation_servomotor_000000000001/goal
/hros_actuation_servomotor_000000000001/power
/hros_actuation_servomotor_000000000001/state
/hros_actuation_servomotor_000000000001/state_comm
/hros_actuation_servomotor_000000000001/status
/hros_actuation_servomotor_000000000001/trajectory
/hros_actuation_servomotor_0000000000012/goal
/hros_actuation_servomotor_0000000000012/state
/hros_actuation_servomotor_0000000000012/trajectory

To visualize the services that are been exposed by MARA, you should run ros2 service list. Then, you will see the following topics:

/hros_actuation_servomotor_000000000001/id
/hros_actuation_servomotor_000000000001/module_3d
/hros_actuation_servomotor_000000000001/module_urdf
/hros_actuation_servomotor_000000000001/specs
/hros_actuation_servomotor_000000000001/specs_comm

To visualize the topic, you need to type ros2 topic echo /hros_actuation_servomotor_000000000001/power

header:
  stamp:
    sec: 1277
    nanosec: 848000000
  frame_id: ''
voltage: 48.0
current_consumption: 0.10000000149011612
current_surplus: 0.0
power_consumption: 4.800000190734863
power_surplus: 0.0

To visualize the topic, you need to type ros2 topic echo /hros_actuation_servomotor_000000000001/status

header:
  stamp:
    sec: 1326
    nanosec: 580000000
  frame_id: ''
instance_id: 0
system_cpu: 0.0
core_temperature: 0.0
system_ram_total: 0
system_ram_used: 0
system_ram_free: 0
system_io_in: 0.0
system_io_out: 0.0
system_ipv4_received: 0.0
system_ipv4_sent: 0.0
ipv4_tcpsock: 0
ipv4_tcppackets_received: 0.0
ipv4_tcppackets_sent: 0.0
ipv4_tcp_errors: 0.0
ipv4_udppackets_received: 0.0
ipv4_udppackets_sent: 0.0
ipv4_udp_errors: 0.0
cpu_interrupts: 0.0
cpu_context_switches: 0.0
softnet_processed: 0
softnet_dropped: 0
softnet_squeezed: 0
softnet_received_rps: 0
softnet_flow_limit_count: 0
softirqs_hi: 0
softirqs_timer: 0
softirqs_net_tx: 0
softirqs_net_rx: 0
softirqs_block: 0
softirqs_irq_poll: 0
softirqs_tasklet: 0
softirqs_sched: 0
softirqs_hrtimer: 0
softirqs_rcu: 0
load1: 0.0
load5: 0.0
load15: 0.0

To visualize the topic, you need to type ros2 service call /hros_actuation_servomotor_000000000001/id hrim_generic_srvs/ID {}

response:
hrim_generic_srvs.srv.ID_Response(device_kind_id=2, device_name='', vendor_id=0, product_id=0, instance_id=0, hrim_version='Anboto', hros_version='Ardent')

This service shows the device features using the service SpecsRotaryServo.srv. To visualize the information in the terminal type: ros2 service call /hros_actuation_servomotor_000000000001/specs hrim_actuator_rotaryservo_srvs/SpecsRotaryServo {}

response:
hrim_actuator_rotaryservo_srvs.srv.SpecsRotaryServo_Response(control_type=4, range_min=-6.27, range_max=6.27, precision=8.722222e-05, rated_speed=1.46607657, reachable_speed=1.46607657, rated_torque=9.0, reachable_torque=13.0, temperature_range_min=-10.0, temperature_range_max=50.0)

This topic controls the position, velocity or/and effort by using the message GoalRotaryServo.msg. To visualize the topic in the terminal, just type: ros2 topic echo /hros_actuation_servomotor_000000000001/goal

header:
  stamp:
    sec: 0
    nanosec: 0
  frame_id: ''
control_type: 1
position: 0.05236
velocity: 0.08726666867733002
effort: 0.0

The state topic gives us information about the motor conditions and the causes in case of error by using the message StateRotaryServo. To visualize the information about this topic in the terminal, you need to type ros2 topic echo /hros_actuation_servomotor_000000000001/state:

header:
  stamp:
    sec: 2198
    nanosec: 553000000
  frame_id: ''
goal: 0.0
position: -1.2887455911325674e-06
error: 1.2887455911325674e-06
velocity: -2.501547525126175e-07
effort: 0.0
load: 0.0
moving: false
fault: 0
control_type: 0

The communication state topic gives us information about the network conditions using the message SpecsCommunication.msg. To visualize the information about this topic in the terminal, you need to type ros2 topic echo /hros_actuation_servomotor_000000000001/state_comm:

header:
  stamp:
    sec: 720
    nanosec: 205000000
  frame_id: ''
comm_rate: 0.0
size_msgs: 0.0

The communication specs service gives us information about the specs of the device network using the service StateCommunication. To visualize the information about this service in the terminal, you need to type ros2 service call /hros_actuation_servomotor_000000000001/specs_comm hrim_generic_srvs/SpecsCommunication {}:

response:
hrim_generic_srvs.srv.SpecsCommunication_Response(min_comm_rate=0.0, max_comm_rate=0.0, max_size_msgs=0.0)