Robot Lift help

Hi I’m new to the vex forums and fairly new to programming so please forgive me for anything I do wrong.
OK so I am my Robotics clubs programer the club is small and I was the only one interested in programming, my task is to program our robot
we are using an Holonomic X drive and for the lift I believe its a 4-bar. I have the drive working for the most part but my problem is the lift, I found some code on the forums a while ago and found it worked for the previous arms we made so i tried it for our new one and it has not worked we are using rubber bands but we know they are placed badly, but I read about something called a pid loop I wanted to be able to press a button and the arm go to a certain height and it stay there in till I pressed another but I have absolutely no idea how to do that yet and I’m using Robot C. Can anyone help me with this?:confused:

Thank you,
Willie

Does your present code work at all? In other words, when you push buttons, will it at least raise the arm to approximately where you want it to go?

I don’t suggest you attempt to get involved with PID loops until you have the basics down. PID (Proportional Integral Differential) control provides a way of tuning your system so it behaves better, but if you are still struggling outside the ballpark, then it is best to focus on major issues first.

Sometimes getting the elastics (rubber bands) tuned just right is all that you will need to keep your arm in position. Sometimes just having a holding value on your motor of about 20 will do the trick, too. Perhaps post a picture of your robot that shows what you are doing with the elastics, then forum members can evaluate what you are trying to do.

What you can do is to program the arm such that you can drive it normally, but when you stop activating it, it freezes where it is.

The way you do it is that you use a separate task that runs PID for the lift. You create a variable and only assign lift sensor value to it when controller button is pressed. The variable is the PID target. In your main loop, you only assign the calculated output of the PID loop to the motors when controller button is not pressed.

You might want to read a little more about PID before starting to use some more advanced programs involving tricky applications of PID. The concept is not difficult and some practice will help you grasp the tuning of three constants fairly fast.

Edit: For your current situation, maybe tuning elastics better is a nice choice. Don’t stress too much over programming. Like what Cody said, programming is a step by step process. You can only comprehend the next step when you get over the current step.

This is our robot
also The code i wrote before I knew about holding the arm at a predetermined position, for some reason only brought the arm down there are servos on the arm right now because i thought about trying that but we were using 393’s
robot.jpg
robot2.jpg
robot3.jpg

It looks like you have plenty of room in (what I presume to be) the rear of your robot, so is there any way to make an extension on the C-channel to which your rubber bands are connected? If you can extend the effective “lever arm” on which your rubber bands pull, then you might get some better performance. Just a thought.

ok ill try that
can you help me with my other problems? the drive stopped working the motors start one at a time and the codes still a little bit hazy
and at the moment I don’t have a code to even make the arm go up and down
and on top of that the robots out of constraints.

Post the code and we can help with that.

ill be able to do that in one to two days I dont have acces to the code right now.

This is the code
and more pictures
robotsie view.jpg
Robot top view.jpg
Current Robot Code For skyrise.c (3.29 KB)

I haven’t had time to look at this in any detail but the first thing that jumps out at me is that it looks like you’re using one button command (Button 5U or 5D) to operate both Pickupmotor and locomotor. Or am I wrong about that? :confused:

Also, maybe you could explain how this machine works and what sensors you have on it. In your pragma statements I don’t see any sensors configured.

Yeah I never got to test that so i never changed it, its not supposed to be the same

I also don’t have any sensors on at the moment
I haven’t been able to test the autonomous or write it for that matter
but other wise the arm is gear for torque and at the end for pick up there is a motor connected to an axle that moves the pick up its also something that i would like certain positions for
pick up.jpg