Help in using serial library on Ubuntu for communication with ROS
Hello,
I am currently working on my custom robot project, for which I need my robot to communicate with the ROS running on a linux-ubuntu PC, so I need a Serial library running on linux Pc which is capable of communicating with the ROS and the Robot.
I can use rosserial but I don't have C++ support on my controller (Rather I can't write code in C++ as the existing code is in C, I want to reuse the already available framework), the micro controller on the robot is a non-aurdino one.
I have tried using the r2serial code from the link : http://code.google.com/p/team-diana/s... .
I am running this code on the ROS PC, with this I am able to receive the data from Linux PC to the robot, but I am able to send the data from the robot to the linux PC.
Can any one guide me on what's going wrong with the code I am using..? or there is any other solution/ serial library that I can use for my project.
Many Thanks in advance.
That package is essentially a translator between ROS and raw serial. Have you checked that all your serial port settings are correct? Can you use a port monitor to check if the correct data are being sent and returned from the uC?
Yeah I can recieve the data from ROS PC to uC properly, But I am unable to send the data from uC to ROS.
strange observation is uC will send data every 100ms which I cannot see on ROS pc, but when I connect the serial port through the H-term (UART visualiser link: http://www.der-hammer.info/terminal/) and click on "connect" I can see data on ROS PC also.
But the data gets drifted continuously, any insights why this is happening
fgets is probably expecting a newline. Are you sure your microcontroller is sending a newline after every packet?
No I don't send any newline from micro controller.
@ahendrix, or Do I have any other serial port library so that I can use with my micro controller.
You could continue debugging that package and make sure it's publishing to the ROS topic with dummy values. If that's working then you know it's a serial read issue.