Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LargeMotor

EV3 large servo motor

Hierarchy

Index

Constructors

constructor

Properties

Protected _deviceIndex

_deviceIndex: number

connected

connected: boolean

deviceDirName

deviceDirName: string

Protected deviceIndexRegex

deviceIndexRegex: RegExp

deviceRoot

deviceRoot: string

Static overrideSysClassDir

overrideSysClassDir: string

Accessors

address

  • get address(): string
  • Returns the name of the port that this motor is connected to.

    Returns string

command

commandValues

  • get commandValues(): object

commands

  • get commands(): string[]
  • Returns a list of commands that are supported by the motor controller. Possible values are run-forever, run-to-abs-pos, run-to-rel-pos, run-timed, run-direct, stop and reset. Not all commands may be supported.

    • run-forever will cause the motor to run until another command is sent.
    • run-to-abs-pos will run to an absolute position specified by position_sp and then stop using the action specified in stop_action.
    • run-to-rel-pos will run to a position relative to the current position value. The new position will be current position + position_sp. When the new position is reached, the motor will stop using the action specified by stop_action.
    • run-timed will run the motor for the amount of time specified in time_sp and then stop the motor using the action specified by stop_action.
    • run-direct will run the motor at the duty cycle specified by duty_cycle_sp. Unlike other run commands, changing duty_cycle_sp while running will take effect immediately.
    • stop will stop any of the run commands before they are complete using the action specified by stop_action.
    • reset will reset all of the motor parameter attributes to their default value. This will also have the effect of stopping the motor.

    Returns string[]

countPerM

  • get countPerM(): number
  • Returns the number of tacho counts in one meter of travel of the motor. Tacho counts are used by the position and speed attributes, so you can use this value to convert from distance to tacho counts. (linear motors only)

    Returns number

countPerRot

  • get countPerRot(): number
  • Returns the number of tacho counts in one rotation of the motor. Tacho counts are used by the position and speed attributes, so you can use this value to convert rotations or degrees to tacho counts. (rotation motors only)

    Returns number

deviceIndex

  • get deviceIndex(): number

driverName

  • get driverName(): string
  • Returns the name of the driver that provides this tacho motor device.

    Returns string

dutyCycle

  • get dutyCycle(): number
  • Returns the current duty cycle of the motor. Units are percent. Values are -100 to 100.

    Returns number

dutyCycleSp

  • get dutyCycleSp(): number
  • set dutyCycleSp(value: number): void
  • Writing sets the duty cycle setpoint. Reading returns the current value. Units are in percent. Valid values are -100 to 100. A negative value causes the motor to rotate in reverse.

    Returns number

  • Writing sets the duty cycle setpoint. Reading returns the current value. Units are in percent. Valid values are -100 to 100. A negative value causes the motor to rotate in reverse.

    Parameters

    • value: number

    Returns void

encoderPolarityValues

  • get encoderPolarityValues(): object

fullTravelCount

  • get fullTravelCount(): number
  • Returns the number of tacho counts in the full travel of the motor. When combined with the count_per_m atribute, you can use this value to calculate the maximum travel distance of the motor. (linear motors only)

    Returns number

isHolding

  • get isHolding(): boolean

isOverloaded

  • get isOverloaded(): boolean

isRamping

  • get isRamping(): boolean

isRunning

  • get isRunning(): boolean

isStalled

  • get isStalled(): boolean

maxSpeed

  • get maxSpeed(): number
  • Returns the maximum value that is accepted by the speed_sp attribute. This may be slightly different than the maximum speed that a particular motor can reach - it's the maximum theoretical speed.

    Returns number

polarity

  • Sets the polarity of the motor. With normal polarity, a positive duty cycle will cause the motor to rotate clockwise. With inversed polarity, a positive duty cycle will cause the motor to rotate counter-clockwise. Valid values are normal and inversed.

    Returns PolarityValue

  • Sets the polarity of the motor. With normal polarity, a positive duty cycle will cause the motor to rotate clockwise. With inversed polarity, a positive duty cycle will cause the motor to rotate counter-clockwise. Valid values are normal and inversed.

    Parameters

    Returns void

polarityValues

  • get polarityValues(): object

position

  • get position(): number
  • set position(value: number): void
  • Returns the current position of the motor in pulses of the rotary encoder. When the motor rotates clockwise, the position will increase. Likewise, rotating counter-clockwise causes the position to decrease. Writing will set the position to that value.

    Returns number

  • Returns the current position of the motor in pulses of the rotary encoder. When the motor rotates clockwise, the position will increase. Likewise, rotating counter-clockwise causes the position to decrease. Writing will set the position to that value.

    Parameters

    • value: number

    Returns void

positionD

  • get positionD(): number
  • set positionD(value: number): void

positionI

  • get positionI(): number
  • set positionI(value: number): void

positionP

  • get positionP(): number
  • set positionP(value: number): void

positionSp

  • get positionSp(): number
  • set positionSp(value: number): void
  • Writing specifies the target position for the run-to-abs-pos and run-to-rel-pos commands. Reading returns the current value. Units are in tacho counts. You can use the value returned by counts_per_rot to convert tacho counts to/from rotations or degrees.

    Returns number

  • Writing specifies the target position for the run-to-abs-pos and run-to-rel-pos commands. Reading returns the current value. Units are in tacho counts. You can use the value returned by counts_per_rot to convert tacho counts to/from rotations or degrees.

    Parameters

    • value: number

    Returns void

rampDownSp

  • get rampDownSp(): number
  • set rampDownSp(value: number): void
  • Writing sets the ramp down setpoint. Reading returns the current value. Units are in milliseconds and must be positive. When set to a non-zero value, the motor speed will decrease from 0 to 100% of max_speed over the span of this setpoint. The actual ramp time is the ratio of the difference between the speed_sp and the current speed and max_speed multiplied by ramp_down_sp.

    Returns number

  • Writing sets the ramp down setpoint. Reading returns the current value. Units are in milliseconds and must be positive. When set to a non-zero value, the motor speed will decrease from 0 to 100% of max_speed over the span of this setpoint. The actual ramp time is the ratio of the difference between the speed_sp and the current speed and max_speed multiplied by ramp_down_sp.

    Parameters

    • value: number

    Returns void

rampUpSp

  • get rampUpSp(): number
  • set rampUpSp(value: number): void
  • Writing sets the ramp up setpoint. Reading returns the current value. Units are in milliseconds and must be positive. When set to a non-zero value, the motor speed will increase from 0 to 100% of max_speed over the span of this setpoint. The actual ramp time is the ratio of the difference between the speed_sp and the current speed and max_speed multiplied by ramp_up_sp.

    Returns number

  • Writing sets the ramp up setpoint. Reading returns the current value. Units are in milliseconds and must be positive. When set to a non-zero value, the motor speed will increase from 0 to 100% of max_speed over the span of this setpoint. The actual ramp time is the ratio of the difference between the speed_sp and the current speed and max_speed multiplied by ramp_up_sp.

    Parameters

    • value: number

    Returns void

speed

  • get speed(): number
  • Returns the current motor speed in tacho counts per second. Note, this is not necessarily degrees (although it is for LEGO motors). Use the count_per_rot attribute to convert this value to RPM or deg/sec.

    Returns number

speedD

  • get speedD(): number
  • set speedD(value: number): void
  • The derivative constant for the speed regulation PID.

    Returns number

  • The derivative constant for the speed regulation PID.

    Parameters

    • value: number

    Returns void

speedI

  • get speedI(): number
  • set speedI(value: number): void
  • The integral constant for the speed regulation PID.

    Returns number

  • The integral constant for the speed regulation PID.

    Parameters

    • value: number

    Returns void

speedP

  • get speedP(): number
  • set speedP(value: number): void
  • The proportional constant for the speed regulation PID.

    Returns number

  • The proportional constant for the speed regulation PID.

    Parameters

    • value: number

    Returns void

speedSp

  • get speedSp(): number
  • set speedSp(value: number): void
  • Writing sets the target speed in tacho counts per second used for all run-* commands except run-direct. Reading returns the current value. A negative value causes the motor to rotate in reverse with the exception of run-to-*-pos commands where the sign is ignored. Use the count_per_rot attribute to convert RPM or deg/sec to tacho counts per second. Use the count_per_m attribute to convert m/s to tacho counts per second.

    Returns number

  • Writing sets the target speed in tacho counts per second used for all run-* commands except run-direct. Reading returns the current value. A negative value causes the motor to rotate in reverse with the exception of run-to-*-pos commands where the sign is ignored. Use the count_per_rot attribute to convert RPM or deg/sec to tacho counts per second. Use the count_per_m attribute to convert m/s to tacho counts per second.

    Parameters

    • value: number

    Returns void

state

  • Reading returns a list of state flags. Possible flags are running, ramping, holding, overloaded and stalled.

    Returns StateValue[]

stateValues

  • get stateValues(): object

stopAction

  • Reading returns the current stop action. Writing sets the stop action. The value determines the motors behavior when command is set to stop. Also, it determines the motors behavior when a run command completes. See stop_actions for a list of possible values.

    Returns StopActionValue

  • Reading returns the current stop action. Writing sets the stop action. The value determines the motors behavior when command is set to stop. Also, it determines the motors behavior when a run command completes. See stop_actions for a list of possible values.

    Parameters

    Returns void

stopActionValues

  • get stopActionValues(): object

stopActions

  • get stopActions(): string[]
  • Returns a list of stop actions supported by the motor controller. Possible values are coast, brake and hold. coast means that power will be removed from the motor and it will freely coast to a stop. brake means that power will be removed from the motor and a passive electrical load will be placed on the motor. This is usually done by shorting the motor terminals together. This load will absorb the energy from the rotation of the motors and cause the motor to stop more quickly than coasting. hold does not remove power from the motor. Instead it actively tries to hold the motor at the current position. If an external force tries to turn the motor, the motor will 'push back' to maintain its position.

    Returns string[]

timeSp

  • get timeSp(): number
  • set timeSp(value: number): void
  • Writing specifies the amount of time the motor will run when using the run-timed command. Reading returns the current value. Units are in milliseconds.

    Returns number

  • Writing specifies the amount of time the motor will run when using the run-timed command. Reading returns the current value. Units are in milliseconds.

    Parameters

    • value: number

    Returns void

Methods

connect

  • connect(driverName: string, nameConvention?: string, propertyConstraints?: object): void
  • Parameters

    • driverName: string
    • Optional nameConvention: string
    • Optional propertyConstraints: object
      • [propertyName: string]: any

    Returns void

Protected constructPropertyPath

  • constructPropertyPath(property: string, deviceRoot?: string): string

hasState

readNumber

  • readNumber(property: string, deviceRoot?: string): number
  • Parameters

    • property: string
    • Optional deviceRoot: string

    Returns number

readProperty

  • readProperty(property: string, deviceRoot?: string): any

readString

  • readString(property: string, deviceRoot?: string): string
  • Parameters

    • property: string
    • Optional deviceRoot: string

    Returns string

readStringArray

  • readStringArray(property: string, deviceRoot?: string): string[]

readStringArrayAsType

  • readStringArrayAsType<T>(property: string, deviceRoot?: string): T[]

readStringAsType

  • readStringAsType<T>(property: string, deviceRoot?: string): T

readStringSelector

  • readStringSelector(property: string, deviceRoot?: string): string

registerEventCallback

  • registerEventCallback(callbackFunction: function, eventPredicate: function, firstTriggerOnly?: boolean, userCallbackData?: any): void
  • Parameters

    • callbackFunction: function
        • (err?: Error, userData?: any): void
        • Parameters

          • Optional err: Error
          • Optional userData: any

          Returns void

    • eventPredicate: function
        • (userData?: any): boolean
        • Parameters

          • Optional userData: any

          Returns boolean

    • Default value firstTriggerOnly: boolean = false
    • Optional userCallbackData: any

    Returns void

registerEventPromise

  • registerEventPromise(eventPredicate: function, userCallbackData?: any): Promise<any>
  • Parameters

    • eventPredicate: function
        • (userData?: any): boolean
        • Parameters

          • Optional userData: any

          Returns boolean

    • Optional userCallbackData: any

    Returns Promise<any>

reset

  • reset(): void

runForDistance

  • runForDistance(distance?: number, speedSp?: number, stopAction?: StopActionValue): void

runForTime

  • runForTime(timeMs: number, speedSp?: number, stopAction?: StopActionValue): void

runForever

runToAbsolutePosition

  • runToAbsolutePosition(position?: number, speedSp?: number, stopAction?: StopActionValue): void

runToPosition

  • runToPosition(position?: number, speedSp?: number, stopAction?: StopActionValue): void

runToRelativePosition

  • runToRelativePosition(relPos?: number, speedSp?: number, stopAction?: StopActionValue): void

sendCommand

set

  • set(propertyDefs: any): void
  • Parameters

    • propertyDefs: any

    Returns void

setNumber

  • setNumber(property: string, value: number): void

setProperty

  • setProperty(property: string, value: any): any

setStopAction

setString

  • setString(property: string, value: string): void

start

stop

  • stop(): void

Generated using TypeDoc