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/source/browse/ros_workspace/fuerte/Serial/src/r2Serial.cpp?r=b3ad5adc6b1e885620b615c5f56ccf929cfbcdc2 .
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.
Originally posted by sumanth on ROS Answers with karma: 86 on 2014-08-04
Post score: 0
Original comments
Comment by dpiet on 2014-08-04:
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?
Comment by sumanth on 2014-08-04:
Yeah I can recieve the data from ROS PC to uC properly, But I am unable to send the data from uC to ROS.
Comment by sumanth on 2014-08-04:
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.
Comment by sumanth on 2014-08-04:
But the data gets drifted continuously, any insights why this is happening
Comment by ahendrix on 2014-08-05:
fgets is probably expecting a newline. Are you sure your microcontroller is sending a newline after every packet?
Comment by sumanth on 2014-08-05:
No I don't send any newline from micro controller.
Comment by sumanth on 2014-08-05:
@ahendrix, or Do I have any other serial port library so that I can use with my micro controller.
Comment by dpiet on 2014-08-06:
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.