Friday, March 19, 2021

ROS node communication

Alright, its been a while since my last update. I have started a new job and moved to a different city, so I have not been able to work on the robot that much lately. I'm also hitting a difficult part of the process. I can now start thinking about the different nodes in the robot operating system and the computation that each of them will do.

 

Last time I left off trying to figure out serial communication. The way that it is done between the raspberry pi and the arduino is to make the arduino into a node on the ROS. In ROS the computation is distributed across nodes, which allows us to compartmentalize certain functions of the robot. In my case the Arduino is responsible to spinning the motors and reading the encoders. It would also be smart to connect my ultrasonic distance sensor to it, but I don't want to rewire it. 

So the arduino for now is just going to send the data from the magnetic encoders on the wheels. Each encoder has about 200 ticks per revolution. That is a relatively small number and I can send it using what is called a message in ROS. 

You see, the nodes in ROS communicate via messages, that have a certain format. Similar to conversations between people the messages pertain to a topic. For example the topic could be velocity and the message is 2 m/s. 

So I will use a standard message type int16 to send numbers in range of -200 to 200. Then another node on the raspberry pi will receive it and translate it to stuff like distance travelled. If I have the time stamped on these messages I will also be able to figure out how fast the robot is going assuming the wheels don't slip.

No comments:

Post a Comment

NEW Project Autonomous underwater vehicle!

  I have been more and more interested in Autonomous Underwater Vehicles and ocean exploration. I live on the coast with direct access to th...