set_velocity()
- 1 Minute to read
set_velocity()
- 1 Minute to read
Article summary
Did you find this summary helpful?
Thank you for your feedback
set_velocity()
Set the linear and rotational velocities of the robot.
With this function, you can move the robot to any direction simultanously.
Reference
Arguments
Arguments | Type | Default value | |
---|---|---|---|
x_velocity | float | Forward (positive) or backward (negative) velocity, in meters per second [m/s]. | |
y_velocity | float | Lateral left (positive) or right (negative) velocity, in meters per second [m/s]. | |
angular_velocity | float | Rotational velocity. Positive: left. Negative: right. | |
duration | float | Time (in seconds) to move at the selected velocity. The value must be positive | |
callback | func | None | If you define a callback, it will be called when the movement finishes. |
wait | bool | false | Wait until the movement finishes before moving to next line of code. |
ang_unit | ANG_UNIT | ANG_UNIT.DEG | The angle's unit for rotation (angular_velocity). ANG_UNIT.DEG for degrees, ANG_UNIT.RAD for radians. |
Return
None
Exceptions
Exception | Condition |
---|---|
RayaWrongArgument | Duration is negative or equal to zero |
RayaAlreadyMoving | There is another motion command in progress |
RayaBridgeException | Command was rejected by bridge |
See the complete list of Raya Exceptions.
Example
Rotate to the right for 1 second:
await motion.set_velocity(x_velocity=0.0, y_velocity=0.0, angular_velocity=-0.5, duration=1.0, wait=True)
Was this article helpful?