Hold Arm Position Help

You need sensor feedback from the arm, either encoder or potentiometer.

You need to drive the motors so that, based on the feedback, you maintain the desired position. The common way to do this is with PID control (although most of the time the “I” and “D” can be ignored), there are lots of threads on PID control and example code has been posted more than once.

When you press a button a new “target position” is sent the the controlling code, the arm is moved until the sensor feedback matches the target.

How successful PID control is depends on many factors beyond just the code. Every arm system has slightly different mechanical properties, are elastics being used, how many motors, the gearing, the friction etc. Have you finished the 4-bar you were building? Have you calculated it’s weight and the force on the motors due to that and the sacks being lifted? Are you able to send a small value to the motors and have the arm hold it’s position without tripping the motor or cortex PTCs? These are all things you probably need to do before jumping into the code and assuming it will work.

Edit: Adding some links for you

https://vexforum.com/t/preset-arm-heights-in-easyc-v4/20223/1 (talking EasyC but same idea)

http://vamfun.wordpress.com/2010/10/02/sample-auto_lift-robotc-program/