ros arduino sensor
I greet everyone and have a nice day. I come to you with a question on the experience, especially regarding ros and arduino. I have been composing code for arduino and sensors for two years, now I want to switch to ros. Compiling the code for arduino was not easy, I found many instructions on each peripheral I use. It was essential to put the codes into one so that I could receive data for all the sensors at once and send the data at the same time. I was hoping for something similar in Ros.
In arduin i have this code: link text ,
in order to be able to use ros and therefore read the data from the arduino and the sensor to more nodes I have to compose the codes for the ultrasonic sensor in the arduino.
while this code I would need. For the ultrasonic sensor link text has the data published directly to the ros node,
this code link text does not contain anything from dew. Nevertheless, in rviz I am able to help him display a green cube with x y and z vectors, including acceleration.
In the first code i use is to see a gyroscope, oled display, bmp280, ultrasonic sensor, servo shield pca9685, several diodes.
Please, how is the easiest way to convert this code (currently the code in arduino takes up 96 percent of memory) so that ros (rosserial_python) reads all the data that arduino provides? Am I forced to write the whole code from scratch, with the fact that I will expand my knowledge of python about the part of ros, or do I have some possibility to add the whole code, about sending data to several nodes of ros? Now arduino sends data in the form "x, y, z gyroscope, x, y, z acceleration, gyro temperature, ultrasonic sonar measurement, pressure, altitude, ambient temperature".
ps .: from the github I cloned a repository in which there was a package for controlling a robo dog, but in it I used nodes for servo shield and gyroscope I was not able to put into operation, but similar nodes, I work for me. In order to use this cloned package, do I have to find in it all the links to the relevant packages that I do not eat and replace them? Or ros understands that if I call in the package "i2cpwm_board" which does not work, but in the workspace there is "pca9685_node" which goes to use it, or it is governed exclusively by the code written in the package?
Many THX for all answers, Jacob .
I don't have much experience porting entire Arduino projects to ROS, I usually start the project knowing that I need ROS for various reasons and add/build my code accordingly. A couple things you mentioned are of concern for sure, that you already at 96% memory and even though rosserial is pretty light, there will be overhead to consider.
My suggestion is to take a modular approach. Rather than port all at once, port functions, create nodes, test them, make sure you are pretty happy with the outcome and keep building on it. For the long term, I think moving to ROS is the right thing to do for Arduino projects, you will be able to do so much more and the advantage it's you don't have to reinvent the wheel. Finally, in this forum, it's encouraged to ask a single question so the community can ...(more)