Alright i know this may be a bit out there but is it possible to get a compass sensor to work well with a robot? If so how would one go about doing so?
We tried one in 2008. Go look up some 364 video’s on TBA for 2008, then come up with a conclusion.
The compass we tried was the biggest pain in the butt we’ve ever used. We could not find a decent place to put it on the robot, so we mounted it up top away from all the motors, then when we went under the steel underpass, guess what started tripping up.
Do yourself a favor and use a Gyro.
Some other teams may have gotten a compass working, but ours was way too sensitive.
Last year I was on 2342 in the USA, and we used a gyro. It wasn’t that hard to program, and it was the main sensor we used in Autonomous mode. I would recommend using it.
Our team used (tried to use) a compass last year. It actually did work, but as the previous post described, they can be sensitive to motors and metal. If you use one I would suggest using it to check your heading, but use the gyro to control. The gyro with the integrator provided by the cRIO is very good, and didn’t seem to lose precision through these relatively short matches.
If you still have interest in a compass, here is basically how it worked:
They started with a mems compass mounted on a breakout board from SparkFun.com The output is I2C, which the FIRST cRIO has on the digital sidecar, but we couldn’t find what we needed in the libraries to use it. So the team used an Arduino (which is an ATmega168 programmed with C), which could talk to the compass on the I2C buss, then sent an analog 0-5 volts to the cRIO that translated to 0-359 degrees. They also had to set a digital output to tell the Arduino to put the compass in calibration mode, then the robot went into a 720 degree spin. This addition seem to help quite a bit, but as I said above, they ended up using a gyro.
The learning experience with the Arduino, and I2C was great, and there is also a lesson in the difference of how well something looks on paper Vs in practice…
We have used a compass in the past. Not as effective as we had hoped. Many require a neutralizing high current pulse to demagnetize the chip and surrounding area before a read. They depend on being able to sense the earth’s magnetic field and can be confused by ferrous metals and other magnetic fields. All of our motors use permanent magnets and trying to position a compass within the robot is a daunting task. Several teams have used them over the years but it does present some challenges.
Alright, Thanks for all the great replies guys, really appreciate everything. So what we are essentially trying to do is to get our Holonomic drive robot to maintain the same direction unless we want to change that “target direction” this will make it easier to control and also give us some cool design possibilities. How would you guys go about achieving this sort of control?
Use a Gyro.
Alright, So before this thread I always thought gyro’s just measure the angle of your robot, heh. So I did some research and now I’m just wondering, how effective will the gyro you get in the KOP be at tracking your angle through the entire match? also how hard would it be to implement a system of “target angle”? If there is anything not clear with my questions just ask away and i’ll explain to the best of my ability.
Alex,
You may not need to know the direction for the entire match. It will help target the robot or perform whatever auto function you want to run during the auto period. If you know where you are at the start of the match then you can move to another point on the field if you know distance traveled and direction you traveled.
It would also be useful if you are using the camera to shoot so that you can know where you are in relation to the goal. i.e. The robot is pointed here but the camera says I should be pointed 30 degrees to the left, so turn left another 30 degrees.
Yeah that is true, but what we are trying to achieve is a mode for our holonomic drive system so that it will stay in the same orientation just moving different ways, so would a gyro be able to hold that the whole match?
Alex,
You could do that but think about the whole game. What is your robot going to do for two minutes? Do you always want it pointing in the same direction?
meh, im always bad at explaining things, What you have is a “target zone” in which you can pick where to point it, so you can change it whenever you want but it will stay in that position until you do change it, and holonomic drives are drives such as mecanum and omni drives so you can strafe.
Just to be clear, the Gyro used in FRC gives you the Rate of Turning, in degrees per second. So if you want to keep your robot from turning, just maintain the gyro value at zero - if it turns at 2 degrees per second for 3 seconds, then turn it back the same 6 degrees.
Just be aware that a gyro has some “drift”; that is, it reports small turn rates even while not moving. This can be mostly managed by adjusting for temperature (there is a temperature sensor on-board) and some empirical measurements, not perfectly but well enough for a 2 minute match. Not to mention your driver can ‘adjust’ the actual position a little if/when necessary, leaving the majority of the work to the automated system.
Thanks a bunch for the info, how difficult do you think it would be to implement a system like this for a programmer with moderate experience?
Alex,
If your are pointed at a goal and then move left or right, the angle to the goal changes. If you stay on the same heading and move forward and back the heading to the goal also changes. It might help for you to draw out various positions on paper and then measure the different angles.
Alex,
This would not be very easy for someone without a lot of experience to implement. They might be able to do it, but it will not be easy.
Gyros are great since they allow you to track small heading changes at a fast rate. The down side is that since you’re using an integral to calculate heading, any small change in the circuit’s bias voltage will cause your heading to drift. You can probably expect about 1 degree of heading drift every 5 to 10 seconds.
If I were you, this is what I would do: use the gyro to track your heading at a fast rate, and use another method to correct the gyro heading calculation whenever it’s able to. You can do this using the magnetic compass (use some logic like if the gyro heading is within a certain tolerance for 1 second and the compass reading is within a tolerance for 1 second, then set the gyro heading to the compass heading).
Another method is to have the driver eyeball the robot heading from the driver station, move a pointer connected to a potentiometer in the driver station to coincide with your eyeballed estimation of the driver heading, and then hit a sync button that tells the robot to reset the gyro heading to the pointer heading. Another method would be to eliminate the sync button and have a knob on a potentiometer in the driver station and use it as a “heading trim” knob so that RobotHeading = GyroHeading + HeadingTrim.
Yet another method is to eliminate the gyro and put two encoders on some unpowered omni wheels and calculate heading from the difference in the encoder turns.
Yet another method is…
There are lot’s of ways to skin a cat. Play around with some of these ideas or invent your own - whoever gets to do it will have a lot of fun (and a lot of frustration).
Last year, we had a first time programmer in Labview accomplish programming the gyro very effectively. We used a gyro to auto-correct our steering, since the floor was slick last year. You could push the robot completely around, and it would correct itself back to the same orientation. I haven’t look at the code on how to do this, and I don’t have LabView installed right now, so I couldn’t even begin to tell you where to begin. I do remember them setting the gyro angle to zero or something, and we never did use the temperature since it wasn’t really needed in our application.
Probably your best application is to use the gyro along with the camera to orient your robot in the right direction for kicking or whatever you want your robot to do. The camera will give you an angle, then apply that to the gyro and the drive base to correct the orientation of your robot. You could just do this with the camera, but I think it would be more reliable to do it with both.