Recently one team approached me with a question along the lines of "How can we program our robot arm to better fight gravity?" The reason was, the drivers were having a difficult time controlling their arm with a joystick since it would go down very quickly and then take a long time to come back up.

To account for gravity all you have to do is set different motor speeds depending on the direction. Another simple thing to try is to add a velocity bias to your motor to hold the arm in place an compensate for the force of gravity. If you were writing code it would be a series of logical statements along the following lines:

// Arm moving down
if (joystickInput < 0)
// Arm moving up 
else if (joystickInput > 0)
// Adding bias to fight gravity and hold the position

You can tune all these numbers depending on your robot and also try controls with and without the bias and this should be of great help to the drivers. You can also use this same method to have separate speeds to move up and down the current.

If you use Simulink, you could write this as MATLAB code or use saturation blocks to split the two different signal paths. I have attached a model that shows how to do this and you can also see the image below.


Hope this helps and best of luck on all events!


Jose Avendano
MATLAB and Simulink PASS Competitions Hub
Quote 1 0
The arm will need different holding power at different positions per sin table.   BEST provides an angle sensor to connect to the arm axle to provide an analog input about the arm position.   
   Is there a packaged  PID module to use to hold the arm in desired position?
Quote 0 0

PID would definitely be the best to implement the arm control. Closed-loop control using a sensor will mean that you can actively fight the force of gravity to achieve a desired position of the arm and Simulink does have a block for implementing it. Please bear with me if this response is a little long, but I am hoping it can be a good resource to students. Here is what I would suggest for implementing PID control:

I have attached to this post a Simulink demo model for implementing closed-loop PID control of a motor for the position. The model is meant to control the position of a motor between two reference values. In this case 0 and 1500, this values would be determined by the potentiometer (analog sensor) readings at two desired positions.

1. I recommend using Simulink external mode to get an idea of the reference values from the sensor first. Here is the video we currently have on using external mode, this is a good resource.

2. Once you have an idea of the reference values you want to use. You can select the form of PID you want and start tuning the parameters (See image). Here are some suggestions:
     - Start by only having a Proportional constant to make sure the output of the PID block is on the same range as the motor inputs (-127 to 127). (Please keep safety in mind since you might inadvertently send maximum motor                   commands)
     - Then you can start adding and Integral term and finally a Derivative term.
     - This is where external mode might be most useful. Try tuning these parameters and monitoring them using external to make sure they are affecting the arm control as you expect. You might have to bypass the use of the                    controller since it requires the usb connection. I recommend watching Part 2 of our Mobile Robotics Training since it will help understand how the different PID terms will affect the system although it is not specific to arm                    control.

3. When you find some parameters you like, you can stop using external mode and replace your joystick input blocks and deploy it to the hardware permanently.

In general tuning a PID can be cumbersome, these are some tips that will make it easier. There are other implementations that can be explored as well, let me know if you had anything else in mind. Everybody can feel free to give this a try and reply back with questions, I am always happy to help out.

Best regards,

MATLAB and Simulink PASS Competitions Hub

Quote 0 0
Zach M
A mechanical way to keep the arm from lowering when you don't want it to is to use a compound gear system. This year our team used a 1:27 gear ratio (with 6 2"-4.5" gears) on a large motor. The arm reached about 3 feet from gear it was mounted to and never started lowering when the motor wasn't engaged. I think this is because the force required to make the arm start descending unintentionally is now 27 times greater than if it were on a motor by itself.  I highly recommend compound gear systems. You can pack a lot of punch in a small area with them.   
Quote 0 0