Go Down

Topic: [Help] Hold Position Sytem Use Servo, IMU and PID (Read 888 times) previous topic - next topic

mamette

Hi, i want to make holding position system using servo motor, IMU and PID controller.

IMU will read position every time, for example, i will set the position at 90 degree. If i tilt the sensor below or above 90 degree, servo will rotating until sensor position back to 90 degree. So, this system will maintain position always at 90 degree. May be it is like a balancing robot, but i using servo motor. Am i need PID controller for this system? Is there any reference that i can learn?

thank you...


PaulS

Quote
May be it is like a balancing robot

Sounds to me like it is EXACTLY like a self-balancing robot. Where do you see differences?

Quote
Am i need PID controller for this system?

Maybe. Maybe not. Depends on how fast you need the system to react, and how fast the system CAN react.

Quote
Is there any reference that i can learn?

No. Google will be down until you finish your project. So, hurry it up. Millions of people are waiting.

Did you have a programming question?

mamette

#2
May 17, 2013, 02:41 pm Last Edit: May 17, 2013, 03:06 pm by mamette Reason: 1

Quote
May be it is like a balancing robot

Sounds to me like it is EXACTLY like a self-balancing robot. Where do you see differences?

Quote
Am i need PID controller for this system?

Maybe. Maybe not. Depends on how fast you need the system to react, and how fast the system CAN react.

Quote
Is there any reference that i can learn?

No. Google will be down until you finish your project. So, hurry it up. Millions of people are waiting.

Did you have a programming question?


Well, so far i make close loop system like this:

Code: [Select]
Error = CenterVal - rollmap; //finds error between the wanted value and what it currently is
 rollServo += Error;
 roll.write(rollServo);



where,
CenterVal= 90 (90 degree), this is the value that i want to maintain
rollmap= angle that detected by IMU (current position), i have use Kalman Filter for rollmap.
Error = difference between  CenterVal and rollmap
rollServo = how far servo move

So, servo will move if error detected, servo will continue to move until Error value back to 0, which mean stable position has been reached. I have done it, servo will move until stable position reached, but servo move very slow. And the system not start smoothly. Firstly, servo will move back and forth continuously until rollServo value reach around 1500, not always 1500 but around 1500 (i print it on the serial monitor, i know servo move between 0-180, but i don't know why rollServo value has been reached around 1500 and still can make servo works), then system will works like i explain before.

I can't find out where the problem is. Can you help me?

PeterH

It's not clear what your physical setup is. Are you saying that you have a base which can be moved around, and you have a platform mounted on it that you want to keep level?

If so, is the intrumentation mounted on the base or the platform?
I only provide help via the forum - please do not contact me for private consultancy.

UKHeliBob

The rollServo value sounds like it is the centre point between 1000 and 2000 when using the writeMicroseconds() method from the servo library.  Using that method allows finer control of the servo position, 1000 steps instead of 180 using the write() method from the library.

http://arduino.cc/en/Reference/ServoWriteMicroseconds
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Go Up