set_velocity()
  • 1 Minute to read

set_velocity()


Article summary

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

ArgumentsTypeDefault value
x_velocityfloatForward (positive) or backward (negative) velocity, in meters per second [m/s].
y_velocityfloatLateral left (positive) or right (negative) velocity, in meters per second [m/s].
angular_velocityfloatRotational velocity. Positive: left. Negative: right.
durationfloatTime (in seconds) to move at the selected velocity. The value must be positive
callbackfuncNoneIf you define a callback, it will be called when the movement finishes.
waitboolfalseWait until the movement finishes before moving to next line of code.
ang_unitANG_UNITANG_UNIT.DEGThe angle's unit for rotation (angular_velocity). ANG_UNIT.DEG for degrees, ANG_UNIT.RAD for radians.

Return

None

Exceptions

ExceptionCondition
RayaWrongArgumentDuration is negative or equal to zero
RayaAlreadyMovingThere is another motion command in progress
RayaBridgeExceptionCommand 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?