ResetPosition

Resets the position counter of the given motor(s).

Contents

Syntax

OBJ.ResetPosition()

OBJ.ResetPosition(HANDLE)

Description

Reset the position of the motor specified in OBJ. Only the internal states of the NXT brick corresponding to the specified motor(s) are reset. The motor is not moved. This resets the field .Position you can read out using .ReadFromNXT.

Specify HANDLE (optional) to identifiy the connection to use for this command. Otherwise the defaul handle (set using COM_SetDefaultNXT) will be used.

Note:

For advanced users: The field Position maps to the NXT firmware's register / IOmap counter RotationCount. It can also be reset using NXT_ResetMotorPosition(port, false). That's in fact what this method does.

Example:

     motorC = NXTMotor('C', 'Power', -20, 'TachoLimit', 120);
     motorC.SendToNXT();
     motorC.WaitFor();
     data = motorC.ReadFromNXT()
     %>> data =
     %            Port: 2
     %           Power: 0
     %       IsRunning: 0
     % SpeedRegulation: 0
     %      TachoLimit: 120
     %      TachoCount: -120
     %        Position: -120

     motorC.ResetPosition();
     data = motorC.ReadFromNXT()
     %>> data =
     %            Port: 2
     %           Power: 0
     %       IsRunning: 0
     % SpeedRegulation: 0
     %      TachoLimit: 120
     %      TachoCount: -120
     %        Position: 0

See also

NXTMotor, ReadFromNXT, NXT_ResetMotorPosition, NXT_GetOutputState, NXC_ResetErrorCorrection,

Signature