|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
HM55B Digital Compass - How do I program the controller to read it?
Here's the story:
It's Sunday before the ship date, and I'm out in the shop trying to get our gear tooth sensors to work, yet the robot had a tendency to veer left and attempt to crash into the virtual lane divider which composed of some tables. I'm very certain the code for the gear tooth sensors work, but one side drags a little more due to some meshing issues in the gears. I'm sure that both gear tooth sensors work, and these are not those provided in the kit. So to sum that up, 2 days before ship, and autonomous doesn't work at all. In week 2, I did some research on digital compasses, and found the Parallax HM55B. So after waiting 4 more weeks, I decided to buy it and try it out. Well... it finally came in last week, and I took it home and played with it on a BOE-bot, and it worked great. Very accurate, and I was able to drive the BOE-bot down our 20' hall way in my house without it getting off course at all. Of course, the BOE-bot uses PBASIC, and our IFI controller is C. I did some research around the internet for source code for the HM55B, and was able to come up with a few sources, but I do not understand how they work or how to implement them into our system. Right now I have Kevin's 3.0 code installed on our controller. The compass works through the TTTL port on our controller. I also believe I understand how to wire the compass in... I just need help on the programming side. I'm a 1st year programmer, and have never been introduced into serial communications or how Kevin's code can be used to communicate with the compass. Any help is greatly appreciated! Thanks, RyanN |
|
#2
|
|||
|
|||
|
Re: HM55B Digital Compass - How do I program the controller to read it?
I'd be very careful using any kind of compass on your robot--the magnetic fields produced by your motors and even in the straight wiring connections of your robot will produce a large magnetic field simply because of the amperage they are using. The earths magnetic field is only .05 mT which will easily be overwhelmed by the magnetic fields created by your robot.
A brief calculation the magnetic field generated by a 80Amps flowing through a long straight wire (a situation which approximates the wiring on your robot under low load) from .5m (assuming optimal mounting of your compass) away is B=u*I/(2(pi)*r) B=1.256*10^-6*80/(2*(3.14)*.5) B=.03mT which is more than enough to throw off your compass. This calculation also does not take into account windings in your motors and other sources of a magnetic field which will make your compass essentially useless. To solve your problem it might be better to try using the gyro which measures change in angle and driving straight by measuring change in angle and correcting. |
|
#3
|
||||
|
||||
|
Re: HM55B Digital Compass - How do I program the controller to read it?
RyanN,
I would use the yaw-rate sensor before the compass. I saw a robot try to use a compass at a Seattle Robotics Society competition 8 years ago. It had a hard time getting though a maze (the Trinity Firefighting Building actually). All of us robot people stood around to try to figure out what was going on. The best we could come up with is that the compass was reacting to the rebar in the floor. We even went so far as turning the maze to be in line with the rebar that did work when the robot moved in the “x” direction but it still did weird things in the “y”. I then played around with a copy of his just to see how they work. Compasses sound like a good idea on a robot but in my playing around with them I could not get it working as well as I wanted. If you orientate your robot with a plain old compass around the four rose points and then read the electronic one you will find a great amount of deviation from 90 degrees. Of course over 360 they re-line up, but 90 degrees is not really 90 degrees to them. -Jim |
|
#4
|
||||
|
||||
|
Re: HM55B Digital Compass - How do I program the controller to read it?
Quote:
|
|
#5
|
||||
|
||||
|
Re: HM55B Digital Compass - How do I program the controller to read it?
I was able to get it to work on the robot using the "Board of Education (BOE)" I hooked up the PWM cables to 2 of the 3 pin headers, and it was able to work pretty good. I believe I'm going to put the compass near the back of the robot at the bottom of the battery, or way up high on our fork lift. I may consider the gyro later, but we haven't ever used it before as well...
Also when I tested it with the BOE, I had it right over our T-Shirt shooter's battery selector switch, which didn't cause any issue, but did hole the BOE-bot in place very well while I went on the crazy ride... Last edited by RyanN : 12-03-2008 at 07:19. |
|
#6
|
||||
|
||||
|
Re: HM55B Digital Compass - How do I program the controller to read it?
The problem of veering right happened with our robot too, and what happened was our chains were not the same length. Causing the robot to move slightly to the right when both controllers were forward.
|
|
#7
|
||||
|
||||
|
Re: HM55B Digital Compass - How do I program the controller to read it?
If you continue to have issues, consider doing this:
encoder_error = left_encoder_count - right_encoder_count; encoder_output = encoder_error * encoder_gain; if (encoder_output > 127) encoder_output = 127; else if (encoder_output < -127) encoder_output = -127; Left_Drive = 127 + <insert_your_left_drive_value> - encoder_output; Right_Drive = 127 + <insert_your_right_drive_value> + encoder_output; Adjust your gain until it drives roughly straight. It won't be perfect, but it might work well enough for you. |
|
#8
|
||||
|
||||
|
Re: HM55B Digital Compass - How do I program the controller to read it?
Quote:
|
|
#9
|
||||
|
||||
|
Re: HM55B Digital Compass - How do I program the controller to read it?
Quote:
Not sensitive enough and skipping counts doesn't sound like a sensor problem. It sounds more like an alignment issue. |
|
#10
|
||||
|
||||
|
Re: HM55B Digital Compass - How do I program the controller to read it?
We're using the Honeywell 1GT101DC Hall Effect Sensors that some thread recommended. Our gear depth is about .1" and the sensor says it should have .4", but they do work... sort of. It's only at higher speeds where the left side seems to skip, and we've tried to adjust it some, but with no avail. I'm really just looking for some help with the compass. I'm really tired of messing with gear tooth sensors.
|
|
#11
|
||||
|
||||
|
Re: HM55B Digital Compass - How do I program the controller to read it?
Quote:
May I suggest you re-position your sensor closer to the teeth. Ours id currently approximately .5 to 1mm from the teeth and works perfectly. Here is a picture. In fact, it is too far out in this picture. We ended up moving it in even closer. ![]() If you look closely, you can see two washers used as spacers. We removed the thicker one and our intermittents went away. |
|
#12
|
||||
|
||||
|
Re: HM55B Digital Compass - How do I program the controller to read it?
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Interfacing a digital compass with the RC | Kelly | Electrical | 14 | 27-09-2007 19:01 |
| Where can I get a digital compass sensor? | EHaskins | Technical Discussion | 6 | 26-09-2007 18:33 |
| How Can I Program The FRC Robot Controller To Display My Team Number | jesusescobar | Programming | 5 | 22-01-2007 10:29 |
| Problem with the program downloaded to the controller | itsme | Programming | 9 | 14-01-2007 12:12 |
| I2C Digital Compass Programming | CyberWolf_22 | Programming | 7 | 03-01-2005 00:20 |