ROBOTC.net forums
http://robotc.net/forums/

Read position of servo when using Mindsensors NXTservo-v3
http://robotc.net/forums/viewtopic.php?f=41&t=11151
Page 1 of 1

Author:  tpaulson [ Mon May 11, 2015 11:31 pm ]
Post subject:  Read position of servo when using Mindsensors NXTservo-v3

I have a program using the Mindsensors NXTservo-v3 controller with 3 servos connected. The first servo needs to finish its movement before the other servos start moving. The 500ms delay should be sufficient amount of time for the servo to complete its movement. But about 30% of the time servo1 doesn't move before servo2 and servo3 start moving.

When the subroutine below is run, 30% of the time it acts like either the NXTServoSetPos(NXTSERVO, 1, 1550, 100) or the wait1Msec(500) command are never run. The other 70% it works perfectly.

Is there a way to read the current position of a servo connected to the NXTservo controller?
That way I could read the position of the servo 1, if it is not at 1550, then don't try to move the other servos.


Code:
// Open platform
void OpenPlatform(){

   //rotate out - motor 1
   NXTServoSetPos(NXTSERVO, 1, 1550, 100);
   wait1Msec(500);

   //bucket lift - Motor 2
   NXTServoSetPos(NXTSERVO, 2, 1400, 30);
    wait1Msec(5);

   //bucket tilt - motor 3
   NXTServoSetPos(NXTSERVO, 3, 1400, 20);
   wait1Msec(10);
}

Author:  tpaulson [ Mon May 18, 2015 11:53 am ]
Post subject:  Re: Read position of servo when using Mindsensors NXTservo-v

I was able to resolve this issue by removing a call to the NXTservo located in task main.

There was the following battery voltage call in task main. After removing the following two lines the problem completely went away. I am not sure why these two lines caused an issue in another sub, but it did.

voltage = NXTServoReadVoltage(NXTSERVO);
displayCenteredBigTextLine(1, "%dmV", voltage);

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/