Reading Roomba sensor data

Inside the Roomba and Scooba and more, Cool mods, Repair and Upgrades - including the all new iRobot Create Kit. Let's void that warranty baby!

Reading Roomba sensor data

Postby El Escalador » January 5th, 2016, 2:03 pm

Having some trouble with my Roomba 535 connected to my raspberry pi. I can read the ascii startup data and send some commands, but when it comes to reading sensor data I just get garbage (trying to read using minicom). Ultimately, I need to read with C++ ... I guess it's sending binary....anyone point me towards a tutorial on 1 - making that display correctly in minicom or 2 - reading this with a C++ program (which I'm pretty new at using C++). Thanks.
El Escalador
 
Posts: 3
Joined: January 5th, 2016, 1:48 pm

Re: Reading Roomba sensor data

Postby vic7767 » January 5th, 2016, 6:26 pm

It's not binary data but it is HEX.
Last edited by vic7767 on January 6th, 2016, 8:25 pm, edited 1 time in total.
Roomba and Neato Mods, come visit: http://www.vic7767.com/

http://www.Robot-Doc.com/
User avatar
vic7767
Robot Master
 
Posts: 14191
Joined: January 14th, 2006, 8:31 pm
Location: Haughton Louisiana - USA

Re: Reading Roomba sensor data

Postby mfortuna » January 5th, 2016, 8:45 pm

Here is what I did using shell commands:

viewtopic.php?f=4&t=18282&p=128523&hilit=intel+edison#p128523

Scroll up to the top.
Mike
Reds x 3, Dirt Dog, Disco (now a parts bot), Create, Scooba 350, and Security Dawg
Evolution Mint
Neato XV-11
User avatar
mfortuna
Robot Master
 
Posts: 5725
Joined: February 5th, 2006, 10:35 am
Location: NH

Re: Reading Roomba sensor data

Postby El Escalador » January 6th, 2016, 1:58 pm

Very helpful to know it's hex! So I'm able to get a visible characters now... using [142, 22] I should get millivolts back.
printf (" -> %x\n", serialGetchar (usbport))

What I get is:
-> 3b
-> 8
-> 3a
-> ec
-> 3a
-> ec
-> 3a
-> ec


Is there some way to format this so I can make sense of it? According to the Roomba OI manual, every data stream should start with 19 (I guess every stream starts with this header) but I don't see one. Should look like
[19],[n-bytes],[packet ID],[packet data(2 bytes)]

But you see that I get 8 bytes and most of those are redundant. Any clues?
El Escalador
 
Posts: 3
Joined: January 5th, 2016, 1:48 pm

Re: Reading Roomba sensor data

Postby mfortuna » January 6th, 2016, 8:04 pm

Not sure why you are getting 8 bytes instead of 2. Note you are not sending the stream command which is 148.

The 3A EC looks reasonable because it comes out to about 15000mV which is 15V.
Mike
Reds x 3, Dirt Dog, Disco (now a parts bot), Create, Scooba 350, and Security Dawg
Evolution Mint
Neato XV-11
User avatar
mfortuna
Robot Master
 
Posts: 5725
Joined: February 5th, 2006, 10:35 am
Location: NH

Re: Reading Roomba sensor data

Postby mfortuna » January 7th, 2016, 9:16 am

One thing I noticed is you are sending a newline \n. You don't need to do that. I am not sure if that makes a difference.

If you look at my shell commands I put the USB serial port into raw mode, turned off echo and turned off newline to carriage return conversion. You may want to try that.
Mike
Reds x 3, Dirt Dog, Disco (now a parts bot), Create, Scooba 350, and Security Dawg
Evolution Mint
Neato XV-11
User avatar
mfortuna
Robot Master
 
Posts: 5725
Joined: February 5th, 2006, 10:35 am
Location: NH

Re: Reading Roomba sensor data

Postby El Escalador » January 8th, 2016, 9:00 am

Ahh..thanks! At first I didn't recognize the high byte/low byte separation and was confused as heck. I also tried it so many ways I forgot that I put it all in a for loop at some point so it ran 4 times.

I'm able to collect and make sense of the data now by hand...learning to write C++ that will separate and make sense of it all...that's a new challenge.

Thank you much!
El Escalador
 
Posts: 3
Joined: January 5th, 2016, 1:48 pm


Return to Robotic Hacking

Who is online

Users browsing this forum: JM1010, TechGuy and 211 guests