Using a PING))) IR-sensor to stop when encountering obstacles

asked 2017-04-26 08:17:07 -0500

Meccanoid gravatar image


We're trying to create an "algorithm" for obstacle avoidance for our robot by using multiple Ping)))-sensors. We've been using ROSserial for our project and it's been working fine. However, we are running into problems when we are trying to communicate with both our bottom engines (MD23) and the sensors. The errors we are getting range from "Lost sync with device, restarting..." to "wrong checksum for topic msg and id", to "Serial Port read failure: device reports readiness to read but returned no data (device disconnected or multiple access on port?".

Our code is structured like a state machine - at first, the state is set to 7 and the robot is stationary. We then have a channel called Servo (of type int). When a message is published on this channel, a callback in the arduino code changes the state to make the robot go forward, turn, etc. The case switch for the state is located in the main loop of the code. We basically copied the code from the ping-example (in "Sensors"), and added a condition to our goForward() function that checks that the state is set to 0 and the distance returned from the sensors is larger than 50 centimeters. The sensors work just fine as long as rosserial isn't started.

We are running on a Jetson TX1, with ubuntu. If it matters we are using a USB-hub between the jetson and the arduino, to connect a mouse and keyboard aswell.

Any help would be greatly appreciated!

edit retag flag offensive close merge delete


I'd guess an error in the serial communication, not a ROS error. Check if it works with only one sensor, then two, then three until you get the error.

Humpelstilzchen gravatar image Humpelstilzchen  ( 2017-04-26 10:21:33 -0500 )edit