When the programme starts, it calculates the tilt of the robot using the gyro sensor readings. This value would be used as my equilibrium value in the main programme.įigure 5 shows a general overview of the main programme. After running my mini programme several times, I identified the bias of my gyro sensor.
ROBOTC PID CONTROL DRIVERS
Instead of using the drivers from the manufacturer which will help me print out values ranging from +360 to -360, I printed raw values ranging from 0 to 1024 because I read that, using raw values makes the readings more accurate. This was done to find out the bias of the sensor, since different gyro sensors have different biases. The programmes were designed to only print out readings from the gyroscope. Implementation in RobotC programming language:īefore using the gyroscope from HiTechnic, I tested it with a few mini programmes that I wrote. This gyroscope only returns readings on a single axis, and according to the manufacturer measures up to +/- 360 degrees per second of rotation. gyro sensor) provides a way to measure the rate of rotation, also known as angular rate. The only sensor used in this project was an NXT gyro sensor from HiTechnic. I used this sample program as the basis for my implementation. C:\Program Files (x86)\Robomatter Inc\ROBOTC Development Environment\Sample Programs\NXT\Miscellaneous) which implemented a PID controller on a two-wheeled robot. Fortunately, I found a sample program in the RobotC IDE directories (i.e. For this project, the PID (proportional-integral-derivative) controller was chosen because of my familiarity with it. Linear-quadratic regulator, lead-lag, state-feedback, pole placement, fuzzy controller, and proportional-integral-derivative controller, are all controllers that have been successfully used to control such an inherently unstable system like this Segway-type robot. Figure 2: An inverted pendulum on a cart