Search the Community
Showing results for tags 'NXC'.
-
Hi all! I'm programming a robot that has limited travel on one of its articulations. I don't require precision on its position, just that it stops the motor as soon as it hits the limit. NXC has the MotorOverLoad function, which appears to do exactly what I want... however, it always returns "false" even if the motor is completely stalled! Digging a bit, I found that MotorOverload is actually a shortcut for one of the fields of GetOutput (like "GetOutput(OUT_A, OverloadField)"). Checking the field's documentation, I see that, for it to work, I need to set the motor according to numerous parametres... but, after setting them, I can't get the motor to actually run! This is what I wrote to get the motor running, while enabling MotorOverload: SetOutput( OUT_C, RunStateField, OUT_RUNSTATE_RUNNING, OutputModeField, OUT_MODE_MOTORON + OUT_MODE_REGULATED, RegModeField, OUT_REGMODE_SPEED, PowerField, power_C * d); (power_C and d are variables I defined) If I use the normal "OnFwd" instead, the motor is never stopped: if(MotorOverload(OUT_C)) { Stop(OUT_C); } What could I be doing wrong? Thanks in advance!
- 13 replies
-
- NXC
- MotorOverload
-
(and 2 more)
Tagged with: