View unanswered posts | View active topics It is currently Tue Jan 23, 2018 2:19 am






Reply to topic  [ 2 posts ] 
Read position of servo when using Mindsensors NXTservo-v3 
Author Message
Rookie

Joined: Thu Mar 26, 2015 11:06 am
Posts: 5
Post 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);
}


Mon May 11, 2015 11:31 pm
Profile
Rookie

Joined: Thu Mar 26, 2015 11:06 am
Posts: 5
Post 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);


Mon May 18, 2015 11:53 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.