|
Page 1 of 1
|
[ 5 posts ] |
|
| Author |
Message |
|
dellestj
Rookie
Joined: Mon Jan 03, 2011 10:52 pm Posts: 22
|
 Servo Position Issue
I have the following code: The problem: the servo(contain) is set to 250 before I run this part of the code. However, when this starts, it begins rotating toward the 0 position and then it rotates back to the 250 position. This is very bad for us as we drop what we are holding. Any and all help is loved. Thanks,
|
| Sat Feb 05, 2011 2:53 am |
|
 |
|
alanlevezu
Rookie
Joined: Wed Feb 24, 2010 11:43 pm Posts: 34
|
 Re: Servo Position Issue
I think we need some of the other code... that function is not what is changing the servo as best as we can tell...
|
| Sat Feb 05, 2011 7:20 am |
|
 |
|
MHTS
Guru
Joined: Sun Nov 15, 2009 5:46 am Posts: 1023
|
 Re: Servo Position Issue
Yep, RobotC does that. No matter what position you initialize the servo, RobotC will reset it to 0 first. I don't know how to stop RobotC from doing that. You can do one of two things: 1. Remount your servo such that your default position is 0. 2. Load the batons after your code initializes it to 250.
|
| Sat Feb 05, 2011 7:24 am |
|
 |
|
alanlevezu
Rookie
Joined: Wed Feb 24, 2010 11:43 pm Posts: 34
|
 Re: Servo Position Issue
Actually, RobotC seems to put the servos to 128 the first time any of them are positioned. If you (in the initializerobot() function) set all the servos at the same time to the place you want them to be, it basically doesn't move them. Although the system sets them to 128 when it first runs, if you instantly set it to the desired location, it doesn't move them to 128 first.
We have a routine that sets the servo and at the same time stores that setpoint to a file (in the autonomous program). In the teleop program, during initialize(), we read that file and then set the servos to the same setpoint they were when the autonomous program stopped. They, thus, don't move.
Alan
|
| Mon Feb 07, 2011 3:46 am |
|
 |
|
MHTS
Guru
Joined: Sun Nov 15, 2009 5:46 am Posts: 1023
|
 Re: Servo Position Issue
That's interesting. Our code initialized all servos to their proper positions in initrobot but some of them still decided to move to different positions before coming back to the positions we set them. That's why we concluded RobotC firmware was doing it. You are probably right about it being 128 instead of 0. I don't remember which extreme it was that the firmware init them, but it was different from our intented position.
|
| Mon Feb 07, 2011 6:14 am |
|
|
|
Page 1 of 1
|
[ 5 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 5 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
|
|