move_linear()
  • 1 Minute to read

move_linear()


Article summary

Move the robot in linear direction, for a given distance [meters].

Reference

Arguments

ArgumentsTypeDefault value
distancefloatThe distance of movement, in meters [m]. Distance must be positive.
x_velocityfloatx velocity, in meters per second [m/s]
y_velocityfloat0.0y velocity, in meters per second [m/s]
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.

Return

None

Exceptions

  • RayaWrongArgument
  • RayaAlreadyMoving
  • RayaNotValidMotionCommand

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 motion.move_linear(distance = 2, x_velocity=1.0, wait=True)
      ...
      
    async def finish(self):
      ...

See the Motion example to check some valid uses.


Was this article helpful?

What's Next