set_velocity()¶
Set the linear and rotational velocities of the robot. With this function, you can move the robot to any direction simultanously. If a new command is launched while one is running, the old command will be overwritten by the new one.
Reference¶
Arguments¶
Arguments |
Type |
Default value |
|
|---|---|---|---|
x_velocity |
|
Forward (positive) or backward (negative) velocity, in meters per second [m/s]. |
|
y_velocity |
|
Lateral left (positive) or right (negative) velocity, in meters per second [m/s]. |
|
angular_velocity |
|
Rotational velocity. Positive: left. Negative: right. |
|
duration |
|
Time (in seconds) to move at the selected velocity. The value must be positive |
|
ang_unit |
|
|
unit of measurement for angle (DEGREES or RADIANS). |
callback_feedback |
|
|
Callable function for feedback (optional). |
callback_finish |
|
|
Callable function for finish (optional). |
wait |
|
|
Boolean indicating whether to wait for user response (optional). |
Return¶
None
Exceptions¶
RayaWrongArgumentRayaNotValidMotionCommand
See the complete list of motion exceptions.
Usage Example¶
...
class RayaApplication(RayaApplicationBase):
async def setup(self):
self.motion = await self.enable_controller('motion')
....
async def loop(self):
....
await motion.set_velocity(
x_velocity=1.0,
y_velocity=0.0,
angular_velocity=0.0,
duration=1.0,
wait=True
)
...
async def finish(self):
...
See the Motion example to check some valid uses.