set_velocity()
  • 1 Minute to read

set_velocity()


Article summary

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

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
ang_unitANGLE_UNITANGLE_UNIT.DEGREESunit of measurement for angle (DEGREES or RADIANS).
callback_feedbackCallableNoneCallable function for feedback (optional).
callback_finishCallableNoneCallable function for finish (optional).
waitboolFalseBoolean indicating whether to wait for user response (optional).

Return

None

Exceptions

  • RayaWrongArgument
  • RayaNotValidMotionCommand

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.


Was this article helpful?