loading
 
Trying to read serial data from robot
Gary Warren from United States  [9 posts]
15 year
Hi All,
First, I would like to thank Steven and crew for the wonderful work in RoboRealm. I am really enjoying messing with it.

I've been using RR to communicate with my Hitec Robonova. It uses a MR-C3024 controller board. I have been able to use RR to send the commands to the robot very nicely, but so far I have not been able to get any data back.

As near as I can tell, the data is getting to my laptop, but something is eluding me as far as seeing the data in RR. The data is transmitted one byte at a time, and I can view it on my port monitor program. (see attachment) The Hex 30 is normal data sent to the robot, the Hex 39 is the data being sent from the robot. I have tried everything I can think of, but I am not much of a programmer.

I have searched the forum, and read all I can find in the documentation, but I think I am just missing some little thing. I have attached my .robo file, as well as a screen shot of the port monitor.

All I want to do is be able to monitor the robots batterys and see what they are doing. For testing purposes, I'm just sending a static Chr 9 (hex 39).

Question #2.. I have both a button interface, and a Joystick interface for the robot. They both work, but I've noticed that if I enable the Joystick module, the framerate from my camera drops from 30 FPS to 16 FPS. The other modules don't have this effect, so I figured that it just used a lot more overhead for the joystick module. The camera is an Airlink AIC-250W, and works great with the read HTTP module. I'm using a Phillips USB gamepad with the Joystick module.

Thanks Again
Gary

program.robo
Anonymous 15 year
Gary,

#1 Do you see the hex character in the RoboRealm serial console? It does appear that the char is getting to RoboRealm based on your serial port log.

The way you have the read serial configured is perhaps where the issue is. By just putting [TXC] as is currently specified RoboRealm is looking for a string that is terminated by a newline or a zero byte. The reason for this is that most serial devices in this domain operate using some form of text based communication. Since you are dealing with a single byte the correct configuration would be to add a single slash / in front of the [variable] to let RoboRealm know that you just wish to read in a single byte as apposed to a text string. In the receive sequence specify

\[TXC]

which should do it. Note that two slashes // mean read in 4 bytes or a double word. Give that a try and see if that improves things.

#2 Yes, it is the joystick interface that is slowing down the frame rate. As roborealm typically operates on images it is very important to sync all modules with the current image. But some will be slower than others. In your case the Joystick cannot be sampled as quickly as the camera is ... so basically your Joystick appears to have a 16fps max rate. Since the speed of the pipeline depends on the slowest module that's why you get that rate.

If you need the full 30fps let us know and we will extract out the Joystick read routine into its own thread which will increase the fps back up.

STeven.
Gary Warren from United States  [9 posts] 15 year
Hi Steven,
Thanks for the quick response. I do not see anything in the RR serial console except the outgoing data. I have tried the things you suggested but nothing worked. Here is what I have tried.
\[TXC]   with and without brackets around TXC
\[TXC]\   with and without brackets
\\[TXC]\\  with and without brackets
Also all the above combinations with foreward slashes //// instead of backslashes. I also added <cr> and <lf> in various configurations to the above combos.

I also tried every combination I could think with flow control. No love there either.

I tried to configure the robot to send a NUL at the end of the data, but it just strips off the extra info. I also tried to send the data out of the bot as an integer variable instead of a byte, and it just stripped off what it didn't like.

I don't know, It's a puzzle.

As for the Joystick module, I'm just trying to have as many varied ways of controlling the robot as I can get. It will be in competition at RoboGames, and I'm a little paranoid. I can live with the slower framerate.

thanks
Gary

Anonymous 15 year
Hi Again,
Well, along with the things I mentioned in my last post, I tried sending 2 pieces if data from the robot one after another. They showed up on the port monitor program as 2 bytes in a row. But RR still doesn't see them. I sent the data so that it would appear as Hex 00(NUL), 03(ETX), 0A(LF), 0D(Cr), and 30(0). The Port mon program shows the "IRP_MJ_READ  SUCCESS Length 2:  39 30 (in this case, a zero was being sent)

Along with this I tried all of the combinations as mentioned in the previious post.

Thanks
Gary
Anonymous 15 year
Gary,

Seems that the serial console was waiting for '\n' (newline) in order to report any bytes. This has been changed to instead update after reading in a block of data. This should hopefully show the full stream of bytes. If not, also check your flow control as that may cause the incoming stream to be a little off.

Your receive sequence for the end bytes would then be

\16\0\[byte1]\[byte2]\[byte3]

using the 0x10 and 0x00 at the beginning to provide a sync delimiter.

Please download v2.0.8.3 for these changes.

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index