View Full Version : Catapult Programing Help
Can someone please help me wit the programing of a catapult i built
it is tanks style drive
3 motors driving tank on each side
2 motors driving the catapult
2 limit sensors to tell me when the arm is up and down
the problem i am having is that the arm comes down way to hard and because i manually have to reload the tennis ball every time, i want it th have a switch on the robot so once the arm has been fired, it will stay out until the button has been pressed, so i can let it down softly
can someone please help me put this into code?
bear24rw
01-12-2007, 23:42
Do you have a picture of the robot?
JamesBrown
02-12-2007, 15:33
Can someone please help me wit the programing of a catapult i built
it is tanks style drive
3 motors driving tank on each side
2 motors driving the catapult
2 limit sensors to tell me when the arm is up and down
the problem i am having is that the arm comes down way to hard and because i manually have to reload the tennis ball every time, i want it th have a switch on the robot so once the arm has been fired, it will stay out until the button has been pressed, so i can let it down softly
can someone please help me put this into code?
We can't write code for you. We would need a lot more information to tell you what to write for code.
If you just want ideas the try either reducing the speed of the arm as it returns or try replacing the limit switches with potentiometer and used PID control to let the arm slow down as it returns.
artdutra04
02-12-2007, 16:07
Can someone please help me wit the programing of a catapult i built
it is tanks style drive
3 motors driving tank on each side
2 motors driving the catapult
2 limit sensors to tell me when the arm is up and down
the problem i am having is that the arm comes down way to hard and because i manually have to reload the tennis ball every time, i want it th have a switch on the robot so once the arm has been fired, it will stay out until the button has been pressed, so i can let it down softly
can someone please help me put this into code?So you want to use the limit switches to stop the arm from driving?
The tank drive part isn't hard. First, get the value from two joysticks (I always use tank mode as opposed to arcade) on the transmitter, and store these two two different variables, like leftDrive and rightDrive. Then, use a bunch of SetPWM() functions to set the PWM motors to these values. If you have to invert the values to get the motors to spin the right direction, for example the rightDrive, you can use an assignment of rightDrive = 255 - rightDrive;
To drive the motors for the arm, you would do exactly the same as before, with one modification. Before you actually set the drive motors, check the limit sensors first. Let's say that 0 makes the arm go down, and 255 makes the arm go up. If the bottom limit switch is pressed, and the value you want to send to the motor is less than 127, overwrite the variable with 127. Then you can use SetPWM(); to drive the motor. This way, the arm can only stay put or go up if the lower limit switch is pressed. You would do a similar thing for the upper bound, just inverted.
And if you want to make it drive slower, you can take the raw value coming in from the transmitter, subtract 127, multiply* it by coefficient between 0 and 1, then add 127 back to it.
* Because the Vex controller normally only likes to deal with integers, if you want to get 60% of a value, use something like someVariable = someVariable * 6 / 10;
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.