Reference Source Test
public class | source

MotionService

Extends:

src/drivers/motion/MotionDriverSimulator.js~EventEmitter → MotionService

Provides a very abstract way to control and estimate robot position

Method Summary

Public Methods
public

go(tunedPoint: TunedPoint, parameters: Object): Promise

Move the robot, set new position of the robot

public

rotate(tunedAngle: TunedAngle, options: Object): Promise

Rotate robot for an angle

public

stop(softStop: Boolean): *

Stop the robot

public

straight(millimeters: Number, params: Object): Promise

Move robot forward or backward depending on param millimeters

Private Methods
private

_goSingleTarget(point: misc.Point, params: Object): Promise

Go to single point without advanced features

Public Methods

public go(tunedPoint: TunedPoint, parameters: Object): Promise source

Move the robot, set new position of the robot

Params:

NameTypeAttributeDescription
tunedPoint TunedPoint

Point that should be reached

parameters Object
  • optional

Configuration options.

parameters.pf Boolean
  • optional

Use terrain finding algorithm.

parameters.backward Boolean
  • optional

Set backward robot moving.

parameters.rerouting Boolean
  • optional

Enable rerouting during the movement.

parameters.relative Boolean
  • optional

Use relative to previous position.

parameters.tolerance Number
  • optional

Position will consider as reached if Euclid's distance between current and required position is less than tolerance.

parameters.speed Number
  • optional

Speed of the robot movement in range (0, 255).

parameters.obstacle Number
  • optional

Time [ms] after command will be rejected (with TaskError.action === 'obstacle') if obstacle is detected in hazard region

parameters.friend Number
  • optional

Time [ms] after command will be rejected (with TaskError.action === 'friend') if friend is detected in hazard region

Return:

Promise

public rotate(tunedAngle: TunedAngle, options: Object): Promise source

Rotate robot for an angle

Params:

NameTypeAttributeDescription
tunedAngle TunedAngle

Angle to rotate

options Object

Additional options

Return:

Promise

public stop(softStop: Boolean): * source

Stop the robot

Params:

NameTypeAttributeDescription
softStop Boolean

If true robot will turn of motors

Return:

*

public straight(millimeters: Number, params: Object): Promise source

Move robot forward or backward depending on param millimeters

Params:

NameTypeAttributeDescription
millimeters Number

Path that needs to be passed. If negative robot will go backward

params Object
params.speed Number
  • optional

Speed

Return:

Promise

Private Methods

private _goSingleTarget(point: misc.Point, params: Object): Promise source

Go to single point without advanced features

Params:

NameTypeAttributeDescription
point misc.Point

Target point

params Object

Additional options

params.backward Boolean
  • optional

Move robot backward

params.tolerance Number
  • optional

Max radius

params.speed Number
  • optional

Speed

Return:

Promise