FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you use a gyroscope to level something controlled by two motors?

Hello,

I'm from team 3053 and I’m asking for help making an auto leveling system for our part on our robot. It is kind of like a scissor lift. We are using two motors to control it.

Can someone assist me in doing this please. I attached our code that we have right now.

So basically, we have two motors, one is controlling the right side, one is controlling the left side. When both motors are moving, the scissor lift like mechanism raises. we wanted to attach a gyroscope to the bottom of it to automatically adjust the speed of the motors as we manually raise it with a button.

0 Kudos
Message 1 of 3
(5,443 Views)

To do leveling you will want to use the accelerometer not the Gyro.

The accelerometer has an x,y and z axis that detect acceleration.

If you robot is not moving the largest acceleration detected will be gravity.

If you orientate the accelerometer so the z axis is exactly perpendicular to the floor it will read a value and the x and y values will be close to zero.

When the accelerometer is tilted the x and y axis will increase and the z will decrease.

Using trigonometry and physics you can figure out the angle of tilt and send motor commands to level the platform.

There is an example of using accelerometers to get you started.

0 Kudos
Message 2 of 3
(4,082 Views)

Hi Mark,

I am new to this and am looking to create a stabilization platform for a small camera. Do yo know of any examples or have any that I can get ideas from? I am waiting on my crio student kit and am hoping to start messing with it soon.

Thanks!

0 Kudos
Message 3 of 3
(4,082 Views)