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

Servo Control
http://www.robotc.net/forums/viewtopic.php?f=11&t=137
Page 1 of 1

Author:  starwarslegokid [ Wed Apr 18, 2007 7:39 pm ]
Post subject:  Servo Control

I don't see any documentation on how to control a servo connected to the VEX controller, can you fill us in on the commands and functions if any?

Scott

Author:  tfriez [ Thu Apr 19, 2007 3:39 pm ]
Post subject: 

You can use a servo motor as a regular motor with the motor[port] command... but to use a positional servo (like from 0-255), that is not yet supported in RobotC Vex.

Author:  jkjellman [ Mon Apr 23, 2007 9:58 am ]
Post subject: 

Any idea when this feature will come about?

Also, am I reading your post correctly in that the motor speed will determine the servo position?

Take care,
KJohn

Author:  starwarslegokid [ Mon Apr 23, 2007 5:40 pm ]
Post subject: 

Sadly no, what he means is you can move the servo forward and backward using the motor command, but there is currently no way of controlling it to a given position using its built in encoder.

Author:  jkjellman [ Sat Apr 28, 2007 12:55 am ]
Post subject: 

Sorry gents but after doing a bit of research I have to disagree. The motors in the Vex kit are continuous rotation servos (i.e. servos modified to turn 360 degrees).

So if a motor command can set the PWM pulse duration for a motor then the exact same function will set the position for a servo.

As a matter of fact, EasyC (the default Vex programming tool) has a single function called SetPWM which is used to control both motors and servos. EasyC has no way to tell if a servo or a motor is attached to a given motor port.

Hope this makes sense.

Take care,
KJohn

Author:  tfriez [ Tue May 01, 2007 3:26 pm ]
Post subject: 

Yes, you are correct about the Servo's going 360 degrees. They are modified servos that have the mechanical stops removed to allow full rotation.

Unless you would attach a hobby servo to the Vex controller, there would be no way to gain positional control. And even then, the functionality to use the build in encoders in RobotC is not there.

Author:  starwarslegokid [ Tue May 01, 2007 8:09 pm ]
Post subject: 

Vex does have positional servos with the stops inside, they look exactly the same as the servo motors and are easily confused. The motors and Servos are labeled on the sides.

you can hook up normal hobby servos as well, you just have to have a male to male PWM cable converter of some sort.

Author:  jkjellman [ Wed May 02, 2007 12:27 am ]
Post subject: 

OK, I think we are all saying nearly the same thing. Here's my read just to be sure:

1) Vex motors are continuous rotation servos
2) Vex servos can have their position set via the motor command
3) Vex servos CANNOT use the RobotC PID routines as they have no exposed encoders

NOTE: In #2 above, I am basically saying that the Vex servo position is set like a normal R/C servo, the motor "speed" value provides a PWM'd series of pulses to the servo and it's internal electronics use this to position itself.

Hope this makes sense, I think I am clear here.

Take care,
KJohn

Author:  Dick Swan [ Wed May 02, 2007 4:30 pm ]
Post subject: 

JKjellman's not is almost correct. Some clarification on PID

RobotC supports a number of platforms. Some of those platform have classical PWM motor control and not servos. These platforms also support motor encoders. On these platforms, RobotC has integrated PID algorithms to provide precise positional and speed control.

Precise speed control is not required in the firmware because it is built into the servo itself. So this functionality is not built into the RobotC VEX firmware.

It is easy to write a PID control in RobotC code. It's only about 10 lines of code. There are VEX applications where this might be useful. In particular, using PID to control distance travelled (and not speed). In this case, want to use PID to have the motor move a precise distance-- for example four revolutions -- and stop precisely at that point.

Author:  mtl6 [ Mon Dec 08, 2008 9:56 pm ]
Post subject:  Re: Servo Control

So to get this straight...

I have a servo mounted on top of a modded squarebot and I want to basically turn it to look for objects (The motor shaft turns a sonar rangefinder). Would I be better off using a regular motor for this application? Or is there actually a way to configure this setup using robot C to position the servo (and say, in a different application, store the distance value in an array corresponding to the servo position)?

I am new to the whole concept of PWM waves and how to generate them. How does one generate a pulsetrain with the VEX in Robot C?

-M

Author:  fryfrog [ Tue Jan 27, 2009 10:25 pm ]
Post subject:  Re: Servo Control

I'm pretty sure that if you send -127 or 127 to a servo module, it will go to its end position. Send it 60 or -60 and it'll go ~half way to the end position. 0 would be neutral or the middle. Obviously, it isn't going to be *perfect* but it is close. Pretty sure I built a sonar device that wiggled back and forth using a servo.

You could use a potentiometer to make it even more accurate, if you wanted, I imagine.

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