Regarding the timeouts you’ve noticed in our
getting_started samples, this is due to the serial connection used while operating RVR with a Raspberry-Pi. Typically users operate our robots through their smartphones over bluetooth. This introduces an inherent latency that allows the firmware to process incoming packets at a rate the onboard chipset can handle without throttling. Since a serial connection is established at a baud rate of 115200, RVR’s chipset can now get flooded with commands coming in too quickly. RVR still needs to support operation over bluetooth, so the chipset is designed around it since it’s the most common use-case. We considered adding a throttled queue under the hood for this initial rollout of the SDK, but we noticed it introduced a slight delay in command processing. We plan on revisiting this concept at some point. For now timeouts are recommended for waking up, driving, and setting the LEDs.
RVR should be given at least 1 second after a wake command in order to ensure any subsequent commands are not ignored.
A single driving command lasts 2 seconds.
Driving, and LED commands can support timeouts as fast at
In reference to a “drive by distance” command for RVR, it is something our firmware team has on their feature roadmap, but we don’t have a concrete timeline for rollout yet.
In lieu of that feature… you can use the
Locator sensor stream which returns X and Y values of a local coordinate system.
When you power-up RVR, it creates a local coordinate system, and starts at 0,0 with RVR’s front pointing towards positive Y. The coordinates represent RVR’s position in meters. As RVR is issued driving commands, it updates its position in the coordinate system using the driving data the user provides. RVR does not update its internal position when it’s not driving. For example, if you were to pick it up after it stops, and position it elsewhere, it would resume from the last coordinates it reported.
Here’s a usage example of the
Locator sensor stream:
from sphero_sdk import SpheroRvrObserver
from sphero_sdk import RvrStreamingServices
rvr = SpheroRvrObserver()
print('Locator data response: ', locator_data)
rvr.drive_with_heading(speed=128, heading=0, flags=0)
There’s also an option to reset the internal coordinates back to 0,0. This can be done in two ways.
You can issue a command to reset the coordinates:
You can also configure RVR to reset the coordinates every time
rvr.reset_yaw() is invoked:
To disable this, issue the command with the
flags parameter set to 0:
I hope this helps with the applications you have in mind. Happy coding!
EDIT: Typos & Code Errors