Problems controlling servos with RobotC
| Author |
Message |
|
Jeff McBride
Professor
Joined: Fri Sep 19, 2008 1:22 am Posts: 200
|
 Problems controlling servos with RobotC
We set up a bot with the standard one motor controller + one servo controller on port S1 configuration. The motors work fine. We can't get any of the servos to work.
#pragma config(Hubs, S1, HTMotor, HTServo, none, none) #pragma config(Motor, mtr_S1_C1_1, motorRight, tmotorNormal, PIDControl) #pragma config(Motor, mtr_S1_C1_2, motorLeft, tmotorNormal, PIDControl) #pragma config(Servo, servo1, ServoArm, tServoNormal) ... servoTarget[ServoArm] = 50;
The servo does not twitch at all. We used an oscilloscope to look for pulses on all of the servo ports and didn't see anything.
Is there some setup step that we are missing?
Jeff McBride and John DeLacy Benson Robotics Club
_________________ Jeff McBride Benson Robotics Club
|
| Fri Sep 19, 2008 1:28 am |
|
 |
|
CC335
Expert
Joined: Sat Sep 20, 2008 12:16 pm Posts: 106 Location: Curently fighting aliens on P3X-828
|
 Re: Problems controlling servos with RobotC
Have you tried using any input commands for the servos?
_________________ Sorry, your program could not be downloaded. Please reboot your computer. FTC Team #2959 Team Smash Bros CLICK HERE.(or click www) Agreed
|
| Sat Sep 20, 2008 12:40 pm |
|
 |
|
Jeff McBride
Professor
Joined: Fri Sep 19, 2008 1:22 am Posts: 200
|
 Re: Problems controlling servos with RobotC
What do you mean by "input commands"? As I mentioned, we are setting the ServoTarget[].
_________________ Jeff McBride Benson Robotics Club
|
| Sat Sep 20, 2008 3:09 pm |
|
 |
|
CC335
Expert
Joined: Sat Sep 20, 2008 12:16 pm Posts: 106 Location: Curently fighting aliens on P3X-828
|
 Re: Problems controlling servos with RobotC
Are you trying to run the robot autonomously or with remote control?
_________________ Sorry, your program could not be downloaded. Please reboot your computer. FTC Team #2959 Team Smash Bros CLICK HERE.(or click www) Agreed
|
| Sat Sep 20, 2008 3:26 pm |
|
 |
|
Jeff McBride
Professor
Joined: Fri Sep 19, 2008 1:22 am Posts: 200
|
 Re: Problems controlling servos with RobotC
It doesn't matter. Neither work. The only important question is, have you successfully used RobotC with the FTC Servo Controller? We were in the Tetrix beta program and competed in the Showcase Tournament in Atlanta last April. The prototype controller that we had for the beta kit worked fine. The final (commercial) controller that we just received does not appear to work at all. So, I'm asking if anyone has had any luck with it or not. If not, can we determine if it is a hardware (controller) problem or a software (RobotC/driver) problem?
Jeff
_________________ Jeff McBride Benson Robotics Club
|
| Sat Sep 20, 2008 3:55 pm |
|
 |
|
CC335
Expert
Joined: Sat Sep 20, 2008 12:16 pm Posts: 106 Location: Curently fighting aliens on P3X-828
|
 Re: Problems controlling servos with RobotC
I have not yet used the ftc servo board, but I had the same problem with a Parallax Sumobot. You might have a faulty board. Contact FTC to see if you can get a new board.
_________________ Sorry, your program could not be downloaded. Please reboot your computer. FTC Team #2959 Team Smash Bros CLICK HERE.(or click www) Agreed
|
| Sun Sep 21, 2008 10:37 am |
|
 |
|
JohnPeabody
Rookie
Joined: Sun Sep 21, 2008 10:34 am Posts: 4
|
 Re: Problems controlling servos with RobotC
We also had no success with our initial attempt to program the servos using the servoTarget command. This attempt was made with the RobotC that was shipped with the FTC kits. I plan to install the new 1.43 BETA version of RobotC and give it another attempt. We were able to drive the DC motor with the shipped version.
|
| Sun Sep 21, 2008 10:39 am |
|
 |
|
CC335
Expert
Joined: Sat Sep 20, 2008 12:16 pm Posts: 106 Location: Curently fighting aliens on P3X-828
|
 Re: Problems controlling servos with RobotC
It's probably not a programing issue though. As I said before, I had the same problem with a Parallax Sumobot, and when I replaced the PC board, it worked.
_________________ Sorry, your program could not be downloaded. Please reboot your computer. FTC Team #2959 Team Smash Bros CLICK HERE.(or click www) Agreed
|
| Sun Sep 21, 2008 10:43 am |
|
 |
|
cdvenkat
Rookie
Joined: Sun Sep 21, 2008 1:43 am Posts: 11
|
 Re: Problems controlling servos with RobotC
Not working for me either, but I have provide my observations. We tried with servos that came with FTC kit. I have used standard connection configuration: S1 --> Motor Controller --> Servo Controller Here is my program #pragma config(Muxes, S1, HTMotor, HTServo, none, none) #pragma config(Motor, motorA, rightM, tmotorNxtEncoderClosedLoop) #pragma config(Motor, motorC, LeftM, tmotorNxtEncoderClosedLoop) #pragma config(Motor, motor_S1_C1_1, rightWheel, tmotor14VEncoderClosedLoop) #pragma config(Motor, motor_S1_C1_2, leftWheel, tmotor14VEncoderClosedLoop) #pragma config(Servo, servo_S1_C1_7, leftarm, tServoNormal) #pragma config(Servo, servo_S1_C1_8, rightarm, tServoNormal) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// task main() { servoTarget[servo1] = 150; motor[motorD]= 100; wait1Msec(1000); }
Here are my observations are: 1. When powered they, servo do make small twitch turn. - i think it is good. 2. When run program, neither servo nor Motor move. 2. When we do the power on and off many times, some times, the servo rotates - some kind of random behavior 3. I am not able to use alias names for servos and DC motors - I get compile errors - **Error**:Undefined variable 'leftarm'. 'short' assumed. 4. In motor and sensor setup dialog, DC motors are showing up as "14V motor with Speed Ctrl" in the drop down..
Any help really helpful..
|
| Sun Sep 21, 2008 3:07 pm |
|
 |
|
Jeff McBride
Professor
Joined: Fri Sep 19, 2008 1:22 am Posts: 200
|
 Re: Problems controlling servos with RobotC
 |  |  |  | cdvenkat wrote: #pragma config(Muxes, S1, HTMotor, HTServo, none, none) #pragma config(Motor, motorA, rightM, tmotorNxtEncoderClosedLoop) #pragma config(Motor, motorC, LeftM, tmotorNxtEncoderClosedLoop) #pragma config(Motor, motor_S1_C1_1, rightWheel, tmotor14VEncoderClosedLoop) #pragma config(Motor, motor_S1_C1_2, leftWheel, tmotor14VEncoderClosedLoop) #pragma config(Servo, servo_S1_C1_7, leftarm, tServoNormal) #pragma config(Servo, servo_S1_C1_8, rightarm, tServoNormal) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
|  |  |  |  |
You've got a couple of problems. 1) The FTC Motor Controller does not support the 14V motors you have defined they should not appear in the dropdown at all. What build of RobotC are you running? What platform is it configured for? What tabs do you see when you open the Motor and Sensor Setup Wizard? 2) The addresses of your servos should be servo_S1_C2_? since they are on the second controller in the chain on port S1. Furthermore, the FTC Servo Controller only supports 6 servos so the _7 and _8 addresses make no sense at all. Again, I think you've got something very confused. I suggest going back into the Motor and Sensor setup wizard, deleting all of the defined controllers, motors and servos. Then save and close. Reopen RobotC and go back into the wizard and redefinging everything. Then verify that the motors are on C1 and are of type tMotorNormal and that the servos are on C2. It certainly won't work the way you have it now. Jeff
_________________ Jeff McBride Benson Robotics Club
|
| Sun Sep 21, 2008 4:50 pm |
|
 |
|
JohnPeabody
Rookie
Joined: Sun Sep 21, 2008 10:34 am Posts: 4
|
 Re: Problems controlling servos with RobotC
Once the wizard is configured correctly, how do you reference that servo? Do you refer to it as "rightarm" or servo_S1_C1_#?
If configured as: #pragma config(Servo, servo_S1_C1_1, rightarm, tServoNormal)
Do you say: servo[rightarm] = 50;
or: servo[servo_S1_C1_1] = 50;
|
| Mon Sep 22, 2008 8:59 am |
|
 |
|
Jeff McBride
Professor
Joined: Fri Sep 19, 2008 1:22 am Posts: 200
|
 Re: Problems controlling servos with RobotC
The statements are logically identical. If you look at RobotCInstrinsics.c you will find the following code:  |  |  |  | Code: ... #if defined(FTC)
typedef enum { // // HiTechnic and Mindsensor Servo Controllers. // - Each controller supports two motors // = Up to four controllers per sensor port. // servo1 = 8, servo2, servo3, servo4, servo5, servo6, servo7, // Hitechnic supports six servos, Mindsensors supports 8 servo8,
srvo_S1_C1_1 = 0, srvo_S1_C1_2, srvo_S1_C1_3, srvo_S1_C1_4, ... |  |  |  |  |
The #pragma statement defines "rightarm" to be the same numeric value as the enum position of that port. In other words, in your example they would both equal 0. Jeff
_________________ Jeff McBride Benson Robotics Club
|
| Mon Sep 22, 2008 10:07 am |
|
 |
|
tfriez
Site Admin
Joined: Wed Jan 24, 2007 10:42 am Posts: 537
|
 Re: Problems controlling servos with RobotC
We just got our production hardware today (Monday)... they changed the servo controllers around from the "production" hardware we tested with... and the servo controller is slightly different! We're working on a fix. ROBOTC 1.44 will be released by tomorrow at the latest with a fix for the actual production servo controllers. Sorry about this everyone! 
_________________Timothy Friez ROBOTC Developer - SW Engineer tfriez@robotc.net
|
| Mon Sep 22, 2008 12:14 pm |
|
 |
|
Jeff McBride
Professor
Joined: Fri Sep 19, 2008 1:22 am Posts: 200
|
 Re: Problems controlling servos with RobotC
Thank you!  I'm teaching an Advanced RobotC workshop for FTC coaches and mentors Wednesday evening and I wasn't looking forward to doing with when half my examples didn't work. Jeff
_________________ Jeff McBride Benson Robotics Club
|
| Mon Sep 22, 2008 12:29 pm |
|
 |
|
tfriez
Site Admin
Joined: Wed Jan 24, 2007 10:42 am Posts: 537
|
 Re: Problems controlling servos with RobotC
It's coming soon. I promise  If you need any help with your Advance ROBOTC stuff, let Dick or myself know before wednesday and we can answer any questions about the FTC stuff.
_________________Timothy Friez ROBOTC Developer - SW Engineer tfriez@robotc.net
|
| Mon Sep 22, 2008 4:51 pm |
|
|
Who is online |
Users browsing this forum: No registered users and 0 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
|
|