rotate()
  • 1 Minute to read

rotate()


Article summary

Rotate the robot (left or right).

Reference

Arguments

ArgumentsTypeDefault value
anglefloatThe angle of movement. Positive values will rotate the robot left, and negative values will rotate the robot to the right
angular_speedfloatRotational velocity[d/s]. Value must be positive
callback_feedbackCallableNoneCallable function for feedback (optional).
callback_finishCallableNoneCallable function for finish (optional).
waitboolfalseWait until the movement finishes before moving to the next line of code.
ang_unitANGLE_UNITANGLE_UNIT.DEGREESunit of measurement for angle (DEGREES or RADIANS).

Return

None

Exceptions

  • RayaWrongArgument
  • RayaAlreadyMoving

See the complete list of motion exceptions.

Usage Example

Move forward 2 meters (1 meter/second velocity) and wait until it finish moving those 2 meters before moving to the next line of code:

...

class RayaApplication(RayaApplicationBase):

    async def setup(self):
        self.motion = await self.enable_controller('motion')
        ....
        
    async def loop(self):
     ....
        await self.motion.rotate(
                angle=-1.5708, 
                angular_speed=0.349, 
                ang_unit=ANG_UNIT.RAD, 
                callback_finish=self.cb_motion_finished
            )
      ...
      
    async def finish(self):
      ...

See the Motion example to check some valid uses.


Was this article helpful?