A problem with a sensor packet.
Hello.
Could you help us to resolve the strange problem?
We built TurtleBot baced on IRobot Roomba 500. We did some changes in «turtlebot_node.py» for using Roomba. Such as in the «init_params» method:
self.robot_type = rospy.get_param('~robot_type', 'roomba')
self.has_gyro = rospy.get_param('~has_gyro', False)
And in the «reconfigure» method we commented an updating of the «has_gyro» field:
#self.has_gyro = config['has_gyro']
However for the serial communication we decided to use Arduino. So we plugged Roomba to Arduino via MiniDIN cable according to Roomba Open Interface. We also pluggud Arduino to NetBook via USB-cable. We uploaded following sketch on Arduino:
#include <SoftwareSerial.h>
SoftwareSerial myserial(10, 11);
void setup() {
Serial.begin(57600);
myserial.begin(57600);
}
void loop() {
if(Serial.available() > 0) {
myserial.write(Serial.read());
}
if(myserial.available() > 0) {
Serial.write(myserial.read());
}
}
So Arduino is just retransmitting data from CPU to Roomba and vice versa. Also we did some changes for it. Such as in «turtlebot_node.py» we changed default port (because Arduio works on ttyACM0 port):
__init__(self, default_port='/dev/ttyACM0', default_update_rate=30.0)
We just decided to change it in the constructor, because there is no redifinitionining of it when this object initializes.
That's it. It worked perfectly. We even ran «follower» node.
But one day something happened with our TurtleBot. It crashes with the following error:
Failed to contact device with error: [Distance, angle displacement too big, invalid readings from robot. Distance: 5.42, Angle: -46.11]. Please check that the Create is powered on and that the connector is plugged into the Create.
We tested different NetBooks, different ROSes (electric and fuerte), different Roombas, different Ubuntus (12.04 and 11.10), different cables, different bauds (19200 and 57600), different Arduinos at least. We've read every string of the code. But we can't find where is the problem. Roomba periodically is sending noise in sensor packet. Maybe the problem with delay between requsting sensors data and reading it? Could you please help us.
By the way, when we are sending two bytes (142 and 100) on Roomba, it returns 63 bytes of sensor packet instead of expected 80.
Thank you!
I don't have an answer for your question, just a note: you shouldn't comment out or change source code in turtlebot_node.py if not necessary. All the parameters you wanted to change can be changed using ros parameters and that's what you should use.
Thank you, Lorenz. I didn't think about it. I'll try to use rosparams.