Arduino Mega-Roborealm Serial Timing Question
eJMO from United States  [3 posts]
8 year
I am currently working on a telepresence robot using Roborealm.   From a remote computer, I am able to login to the roborealm webserver and drive the robot around albeit in a rather careless way.  What I find is that the ethernet/internet link can have erratic timing which leads to imprecise robot movements.  I have been working on a way of sending a command to the arduino, and then allow the arduino to carry out a series of precise autonomous movements.

For example, I want the robot to turn 90 degrees left, 90 degrees right, or rotate 180 degrees.  This requires the use of encoders.  Instead of using the Encoder functions built in the Roborealm Arduino module, I have elected to run the encoders using a library on the mega.  

To send a remote command, I set a value of  90, 180, 270 on PWM "pin 6".  While the arduino executes the motion, I have roborealm monitor "Pin 51".  LOW means the arduino is busy, and no additional motion commands should be sent.  HIGH means the autonomous command is complete, and either manual or autonomous instructions may be sent.

In my module stack, I have the Arudino Mega module in the first position, and the CScript is in the second position.  I have a few other camera, and image processing modules in 3rd through 6th position.

My question relates to timing.  If I change a variable in the CScript (located in stack position #2), is the variable immediately sent via the serial line, or is the variable updated once the software has cycled through the remaining four modules, and returns back to the Mega module in position #1.

Thank you.

Steven Gentner from United States  [273 posts] 8 year

Thanks for the detail description! The new variable value will have to wait to cycle through the remaining modules wrap around to the start of the pipeline and then send the serial command out. Data is sent/received only when the serial module executes. (Actually receiving is possible at any time but only processed when the serial module executes).

Typically this is not an issue since the PC will be executing the pipeline quite quickly and will certainly saturate a 9600 baud connection almost instantly. 1125K can take quite a bit more.

Are you still noticing delays that might be the culprit of a slow pipeline? If so, trying going to the Options button->Other tab and increase the min fps to something like 90 (3x normal camera rate) which should spin through the pipeline much faster even if the camera is not ready with a new image. If the CPU speed becomes an issue its also possible to filter out these duplicate runs and not reprocess the image but still respond to serial, etc. commands. Let me know if you need an example of that.


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