I am setting up a controller to interface to the RVR, but running into some issues with async and await.
Not sure the suggested path, but all of my sensor data is coming in over async just like in multi_sensor_stream.py, but now I want to drive with heading based on a command I am receving.
The problem is that I have a callback function that provides the message I want to convert to RVR drive command, and it isn’t an async, so I have done what I can to separate the async and non-async, but still not able to get commands to the rvr.
rvr = SpheroRvrAsync( dal=SerialAsyncDal( loop ) )
def getCommandVel(message): print("here") print(message) driveTheRobot(message)
async def driveTheRobot(message): print("let's try") print(message) await rvr.drive_with_heading( speed=155, heading=0, flags=DriveFlagsBitmask.none.value )
setting up callback in main:
If I try:
I get an error:
File "multi_sensor_stream_rvr.py", line 122 await driveTheRobot(message) ^ SyntaxError: invalid syntax
If I don’t await, then it runs, but doesn’t seem to call the driveTheRobot function.