publishing robot odometry from arduino mega
I'm currently workin on a robot project using ROS noetic navigation stack, and for this project i'm using arduino mega to drive the motors and to read the encoder data, and a Raspberry pi 3 B+ to run ROS.
For this project, i'm currently at the step where i need to publish the odometry for the navigation stack. I did some reasearch on the internet about how to publish the odometry data from arduino, and for like 90% of people, they calculate the robot speed or the encoder ticks in the arduino, and they pusblish it to ROS, and then they use a c++ or python code to calculate the odometry data then publish it to the odom topic.
my question is as follows: Is it possible to publish my robot odometry direcly from my arduino mega? and if yes, is there any code that is available so i can learn how to do that? or should i use the same method mentioned above to publish my robot odometry?
thanks in advance.
The question is: Why? For publishing I take it you use ros serial? I don't use it to publish odom+tf because 1) it does need a lot memory I don't have on the AVR 2) odometry calculation requires floating point which the AVR needs to emulate. (yes, one can do that probably with fixed point but not convenient)
Mr. Humpelstilzchen i believe this means that i should publish my odometry using a C++ or python ROS node, nad not use the Arduino Mega
I recommend to use both. Measure the Odometry with the Mega, send it to your Linux computer and publish from there.
Mr. Humpelstilzchen you are saying that i should compute the odometry in my mega, then not to publish it to the odomtery topic but instead i publish it to the linux pc and from there i publish it to the odometry topic
I would only measure the encoder ticks on the Atmega and run the speed control loop on it.
Hey celebrimbor, i am also stucked in similar kind of situation. Looking for an alternative solution for publishing odom and tf values other then cpp code. Did you find any way to do so ?
Hey Shyam_Majethiya, i used the method that i mentioned earlier, i used the arduino megha to calculate the speed of the robot for each time preiode which was 100ms, then i published the speed to a ros topic (i used vector3stamped message type), after that i calculated the actual odometry using a python script and finally i published the odomtery to the odom and tf topic
i hope this was helpful and im very sorry for the late reply