Topics_quiz: a few questions

I’ve finished with 100% accuracy the Topics_quiz (yay!). But there are a few outstanding (very simple) questions in my mind:

1- how do I get from rostopic show the size of the msg.ranges array? I’ve used “msg.ranges[360]” because I’ve looked the forum discussions.

2- My robot was either too fast (and crashing), or too slow (and not moving). In the end I’ve got it running all right with move.linear.x += 0.01. How can I calculate the robot speed? What is the unit of this (m/s) ?

3- I interpreted the quiz info as if I had to write two programs, one subscriber and one publisher. That seems neat, but as I didn’t know how to do that, I’ve written a single program. What would be the best way of doing this? Independent programs for publisher and subscriber, or a single one?

Thanks in advance.

Hi @paedusan, welcome to the community! And congratulations on completing the quiz :wink:.

I’m assuming you took the Python version of the quiz (if not, please let me know). So…

Size of the array is 720, representing the scan points on the laser scan device, spread over the front part of the robot.

msg.ranges[360] represents the middle scan point, which is at the front-center of the robot.

Also, you can check the size of the array in code by using len(msg.ranges) (Python).

This is simulated velocity and not in m/s. Speeds btw 0.1-0.5 for both angular and linear should work fine: not too fast or slow (it did for me).

You chose the best option! One program (node) is fine and easier. This a very simple program so two different programs would be overkill IMHO.

This is a good case-in-point that a single node can contain both a subscriber and a publisher.

Many thanks for the excellent answers!

1 Like