ProtoTwin API
    Preparing search index...

    Class MotorComponent

    Motor with integrated motion controller. Used to drive joints/axes and transport surfaces.

    Hierarchy (View Summary)

    Index

    Properties

    entity: Entity

    The entity to which the component is attached.

    Accessors

    • get bound(): boolean

      Whether the motor is currently bound to a joint.

      Returns boolean

    • get currentForce(): number

      The current force.

      Returns number

    • get currentPosition(): number

      The current position.

      Returns number

    • set currentPosition(value: number): void

      Parameters

      • value: number

      Returns void

    • get currentVelocity(): number

      The current velocity.

      Returns number

    • get forceLimit(): number

      The maximum force/torque that the motor can apply in order to achieve the motion trajectory.

      Returns number

    • set forceLimit(value: number): void

      Parameters

      • value: number

      Returns void

    • get initialized(): boolean

      Whether the component has been initialized.

      Returns boolean

    • get io(): MotorIO

      The IO signals provided by the motor.

      Returns MotorIO

    • set io(value: MotorIO): void

      The IO signals provided by the component.

      Parameters

      Returns void

    • get name(): string

      The component name.

      Returns string

    • set name(value: string): void

      Parameters

      • value: string

      Returns void

    • get reporting(): boolean

      Whether value monitoring for the current position and force/torque is enabled.

      Returns boolean

      Reporting may be disabled for improved performance when not required.

    • set reporting(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get stalled(): boolean

      Whether the motor has stalled.

      Returns boolean

    • get stallTimeout(): number

      The stall timeout.

      Returns number

      A stall is detected when the stall tolerance is exceeded continuously for the duration of the stall timeout.

    • set stallTimeout(value: number): void

      Parameters

      • value: number

      Returns void

    • get stallTolerance(): number

      The stall tolerance.

      Returns number

      A stall is detected when the stall tolerance is exceeded continuously for the duration of the stall timeout.

    • set stallTolerance(value: number): void

      Parameters

      • value: number

      Returns void

    • get state(): boolean

      The current state of the motor (on/off).

      Returns boolean

    • set state(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get targetAcceleration(): number

      The maximum acceleration.

      Returns number

    • set targetAcceleration(value: number): void

      Parameters

      • value: number

      Returns void

    • get targetDeceleration(): number

      The maximum deceleration.

      Returns number

    • set targetDeceleration(value: number): void

      Parameters

      • value: number

      Returns void

    • get targetPosition(): number

      The target position for the position/servo controller.

      Returns number

    • set targetPosition(value: number): void

      Parameters

      • value: number

      Returns void

    • get targetVelocity(): number

      The target/maximum velocity.

      Returns number

    • set targetVelocity(value: number): void

      Parameters

      • value: number

      Returns void

    • get world(): World

      The virtual world to which the owning entity belongs.

      Returns World

    Methods

    • Added function called immediately after the component is attached to an entity.

      Returns void

    • Creates a handle (weak reference) to a trackable object.

      Type Parameters

      Parameters

      • type: TrackableType<T>

        The type of object that is to be referenced.

      • value: null | T = null

        The object that is initially referenced by the handle.

      Returns Handle<T>

      A handle to a trackable object.

      Handles created through this function are automatically cleared when the component is detached/removed.

    • Asynchronous initialization function called immediately before simulating when the model is initialized.

      Returns Promise<void>

    • Sets the target position for the motor, returning a future that resolves when the position is reached.

      Parameters

      • targetPosition: number

        The target position for the move.

      Returns Future<number>

      The future that is resolved once the target position is achieved.

    • Asynchronous post-update function called after physics has been updated.

      Parameters

      • dt: number

        The timestep (seconds).

      Returns Promise<void>

    • Immediately triggers asynchronous initialization if the component hasn't already been initialized.

      Returns Promise<void>

      This can be used in cases where one component references another in its asynchronous initialize function, but it is required that the referenced component has already been asynchronously initialized.

    • Immediately triggers initialization if the component hasn't already been initialized.

      Returns void

      This can be used in cases where one component references another in its initialize function, but it is required that the referenced component has already been initialized.

    • Subscribes to a subscribable object.

      Subscriptions created through this function are automatically unsubscribed when the component is detached/removed.

      Type Parameters

      • T

      Parameters

      • object: Subscribable<T>

        The subscribable object for which to subscribe.

      • subscriber: Subscriber<T>

        The callback function that is triggered when the object's value is updated.

      Returns void

    • Determines the time that it will take to move to the specified target position.

      Parameters

      • targetPosition: number

        The target position.

      • OptionaltargetVelocity: number

        The (optional) target velocity.

      Returns number

      The total duration.

    • Unsubscribes from a subscribable object.

      Type Parameters

      • T

      Parameters

      • object: Subscribable<T>

        The object from which to unsubscribe.

      • subscriber: Subscriber<T>

        The callback function for the subscription.

      Returns boolean

      True if the subscription was canceled, false otherwise.

    • Asynchronous update function called every timestep when simulating.

      Parameters

      • dt: number

        The timestep (seconds).

      Returns Promise<void>