ReadFromNXT
Reads current state of specified motor from NXT brick
Contents
Syntax
DATA = OBJ.ReadFromNXT
DATA = OBJ.ReadFromNXT(HANDLE)
[DATA1 DATA2] = OBJ.ReadFromNXT
[DATA1 DATA2] = OBJ.ReadFromNXT(HANDLE)
Description
Request the current state of the motor object OBJ from the NXT brick. NXTmotor object OBJ is not modified. DATA is a structure with property/value pairs.
If the NXTmotor object OBJ controls two motors, DATA1 and DATA2 hold the parameters of the first and the second motor respectively. If only one output argument is given, the parameters of the first motor are returned.
Use the optional parameter HANDLE to identifiy the connection to use for this command. Otherwise the default handle (see COM_SetDefaultNXT) will be used.
The returned struct contains the following fields:
- Port - The motor port these data apply to.
- Power - The currently set power level (from -100 to 100).
- IsRunning - A boolean indicating wether the motor is currently spinning or actively braking (after having called Stop('brake'). It will only be false, once the motor is in free-running "coast" mode, i.e. when the power to this motor is turned off (i.e. after calling Stop('off') or when the set TachoLimit was reached).
- SpeedRegulation - A boolean indicating wether the motor currently uses speed regulation. This is turned off during synchronous driving (when driving with 2 motors at the same time).
- TachoLimit - The currently set goal for the motor to reach. If set to 0, the motor is spinning forever.
- TachoCount - This counter indicates the progress of the motor for its current goal -- i.e. if a TachoLimit ~= 0 is set, TachoCount will count up to this value during movement.
- TurnRatio - The currently set turnratio. This only matters during synchronous driving (when 2 motors are being controlled during the same time). See NXTmotor for more details.
See also
NXTmotor, SendToNXT, NXT_GetOutputState
Signature
- Author: Aulis Telle, Linus Atorf (see AUTHORS)
- Date: 2008/11/12
- Copyright: 2007-2008, RWTH Aachen University