The pingpong scripts sends a std_msgs/Header message on the topic uros_ping and subscribes to the topic uros_pong. It is assumed that there is a node which subscribes to the ping topic and re-publishes the message to the pong topic unchanged. One example node that does is the uros_pong_server example from the Nuttx-version of Micro-ROS.
- The
stampfield of the message contains, to a very good approximation, the time of message creation - The
frame_idfield containsping <count> <timestamp>, where 'ping' is just for preventing conflictscountcounts message sent, and is initialized to 0 once the first message is received (this marks completed network setup)timestampis the same timestamp contained in thestampfield, but as a string
- It sets up publishers and receivers as described above and starts sending messages at 10Hz (by default)
- Upon receiving the first message, it goes to an
initializedstate - In the
initializedstate, it does the following- A count from 0 is started and stored both internally and in the
frame_idfield (see above). - Each message sent is appended to an internal list.
- Upon receiving a message, the
frame_idfield is parsed to yield the count and the string-version of the timestamp. - The received message count is compared to the front of the internal list.
- If the received count is larger than the front, internal messages are popped from the list until count is reached. The tool reports a lost message error for each message it had to skip.
- Once it found a match, it compares its content both internally (stamp to frame_id) and to what was stored upon sending.
- A log message is produced with the elapsed time and a status.
- Status is "OK" if the content matched, "ERR" otherwise.
- A count from 0 is started and stored both internally and in the
Example status:
20164 OK 26409237 1579168155135103369 1579168155161512606 1579168155135103369 ""
This is the 20164'th message, status is OK, elapsed time is 26409237 nanoseconds (about 26ms), message stamp is 1579168155135103369 nanoseconds since epoch (2020-01-16 09:49:15.135103369), receive time is 1579168155161512606 (2020-01-16 09:49:15.161512606), and the frame time parsed from the frame_id field is 1579168155135103369 (same as what's in the stamp, as expected). The comment is therefore empty ("").
For the serial test, we use the pingpong configuration (currently only found in the drive_base branch).
Cabling is as follows:
- USART3 is used for the console -- this is not important, a USB console on OTG1 could be used just as well, but it takes longer to come up, so I prefer the serial console
- USART6 is used for the connection to the agent. Note that I wired up the RTS/CTS pins to be able to use hardware flow-control. At the moment, it's running at 115200 baud.
Two things are important to get consistent and low results:
- The
micro_ros_agentand thepingpongnode are both started withchrt -r 50. This makes them real-time scheduled. - When using FTDI-TTL232 cables, the latency_timer is 16ms by default. It needs to be reduced to 1ms, by doing
echo 1 > /sys/bus/usb-serial/devices/<device>/latency_timer
