View unanswered posts | View active topics It is currently Wed Jul 23, 2014 10:12 am






Reply to topic  [ 11 posts ] 
Servo Control 
Author Message
Moderator
Moderator
User avatar

Joined: Wed Jan 31, 2007 3:39 am
Posts: 299
Location: San Diego, California. USA
Post 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

_________________
Mmmm Legos B-)

My Robot Projects:
http://www.freewebs.com/robotprojects/


Wed Apr 18, 2007 7:39 pm
Profile WWW
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 601
Post 
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.

_________________
Timothy Friez
ROBOTC Developer - SW Engineer
tfriez@robotc.net


Thu Apr 19, 2007 3:39 pm
Profile
Rookie

Joined: Sun Apr 22, 2007 9:01 pm
Posts: 11
Post 
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


Mon Apr 23, 2007 9:58 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Jan 31, 2007 3:39 am
Posts: 299
Location: San Diego, California. USA
Post 
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.

_________________
Mmmm Legos B-)

My Robot Projects:
http://www.freewebs.com/robotprojects/


Mon Apr 23, 2007 5:40 pm
Profile WWW
Rookie

Joined: Sun Apr 22, 2007 9:01 pm
Posts: 11
Post 
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


Sat Apr 28, 2007 12:55 am
Profile
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 601
Post 
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.

_________________
Timothy Friez
ROBOTC Developer - SW Engineer
tfriez@robotc.net


Tue May 01, 2007 3:26 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Jan 31, 2007 3:39 am
Posts: 299
Location: San Diego, California. USA
Post 
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.

_________________
Mmmm Legos B-)

My Robot Projects:
http://www.freewebs.com/robotprojects/


Tue May 01, 2007 8:09 pm
Profile WWW
Rookie

Joined: Sun Apr 22, 2007 9:01 pm
Posts: 11
Post 
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


Wed May 02, 2007 12:27 am
Profile
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 614
Post 
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.


Wed May 02, 2007 4:30 pm
Profile
Rookie

Joined: Fri Nov 21, 2008 12:05 am
Posts: 4
Post 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


Mon Dec 08, 2008 9:56 pm
Profile
Rookie

Joined: Sat Aug 30, 2008 2:25 am
Posts: 25
Post 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.


Tue Jan 27, 2009 10:25 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 11 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:  



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