loading
 
RoboRealm Lagging WIth Arduino
Brandon from Canada  [1 posts]
11 year
So we are using Roborealm and Arduino to make an RC car that follows you around for a school project. At the moment we are using leds to just flash the left one the object goes left and flash the right one when the object goes right. It tends to work ok however after about a minute or so roborealm starts to lag very bad. Can someone tell me why this is happening I am using an I5 and 4GB ram Asus s400 laptop. As well another problem is that if the object doesnt not move after a couple of seconds the leds stop flashing. If anyone could help us we would be most greatful.
ThirdAttempt.zip
program.robo
Steven Gentner from United States  [1446 posts] 11 year
Brandon,

Couple things to try:

1. Remove the

Serial.println(distance);

in the ThirdAttempt.ino since the SSC module does NOT read serial information which can eventually plug up the system ... which could account for the delay.

2. Increase the baud rate from 9600 to as fast as possible.

3. If you don't want to change the code much use the Serial module and

\[COG_X]

as the data. A single \ means a single byte is written which is what you are expecting.

Or you could try the Sparfun_Arduino or MCU_Communicator modules instead of the SSC module to communicate to the Arduino.

STeven.
Anonymous 11 year
Thanks Steven for the advice i think taking out the Serial.println(distance) fixed the lagging. However our next problems is that the led lights need to change instantly depending which side the object turns to. For instance if the object goes right the right led should tunr on, and when it goes left the left led should turn on and the right one off and all this should happen instantly, what are we doing wrong in this case.
Steven Gentner from United States  [1446 posts] 11 year
Couple things you will need to do/check:

1. What is the fps you are getting on RR running on your platform? Nothing below 10fps will not appear to be instant.

2. You will need to increase the baud rate from 9600 to 115200 as nothing at 9600 seems instant!

3. Remove the delay(50) in the Arduino code. Let the serial.read be the function that delays the loop execution. Even at 50 ms you may skip a character or two.

4. Save the current state (left led, right led, etc.) in a variable and only execute DigitalWrite when the state changes. DigitalWrite is not as fast as you might expect ... probably not the cause of your delays but can be a small factor in it. Its an easy fix (i.e. simple state tracking).

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