Go to Post Recently my wife and I met some mentors from Michigan with their wives at Disney World. It seems that I'm not the only mentor who needs to bribe their wives with vacations before they sign up to mentor FRC for another year... - Mark Holschuh [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 11-03-2008, 22:33
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
no team
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Austin, TX
Posts: 1,127
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
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
__________________
Taking a break from mentoring for a few years. (Is that allowed?!?)

Controls Mentor
@rnazaretian

Previous teams:
Team Fusion, FRC 364
Garnet Squadron, FRC 4901
  #2   Spotlight this post!  
Unread 12-03-2008, 01:21
Matt H. Matt H. is offline
Long Distance Mentor
FRC #1726 (N.E.R.D.S.)
Team Role: Alumni
 
Join Date: May 2006
Rookie Year: 2007
Location: Sierra Vista, AZ
Posts: 238
Matt H. has a reputation beyond reputeMatt H. has a reputation beyond reputeMatt H. has a reputation beyond reputeMatt H. has a reputation beyond reputeMatt H. has a reputation beyond reputeMatt H. has a reputation beyond reputeMatt H. has a reputation beyond reputeMatt H. has a reputation beyond reputeMatt H. has a reputation beyond reputeMatt H. has a reputation beyond reputeMatt H. has a reputation beyond repute
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   Spotlight this post!  
Unread 12-03-2008, 01:34
JimWright949's Avatar
JimWright949 JimWright949 is offline
The Owen Day of Seattle
AKA: Jim Wright
FRC #4542 (Titanium Talons)
Team Role: Mentor
 
Join Date: Sep 2003
Rookie Year: 2003
Location: Redmond, WA
Posts: 94
JimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to behold
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   Spotlight this post!  
Unread 12-03-2008, 01:37
jgannon's Avatar
jgannon jgannon is offline
I ᐸ3 Robots
AKA: Joey Gannon
no team
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Pittsburgh, PA
Posts: 1,467
jgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond repute
Re: HM55B Digital Compass - How do I program the controller to read it?

Quote:
Originally Posted by Matt H. View Post
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.
As a counterpoint, I've used the Devantech CMPS03 digital compass on a non-FIRST robot to do outdoor navigation. The compass is mounted about 18 inches away from my drive motors (a pair of Taigenes), on top of a piece of PVC. I expected that I would encounter magnetic field issues, but the output values don't seem to vary by more than a degree or two when I turn the motors on and off. To be fair, Taigenes don't draw quite as much current as CIMs, but I would venture that using a digital compass in this application is quite feasible, so long as you make some effort to keep the sensor reasonably isolated from your motors and power leads.
__________________
Team 1743 - The Short Circuits
2010 Pittsburgh Excellence in Design & Team Spirit Awards
2009 Pittsburgh Regional Champions (thanks to 222 and 1218)
2007 Pittsburgh Website Award
2006 Pittsburgh Regional Champions (thanks to 395 and 1038)
2006 Pittsburgh Rookie Inspiration & Highest Rookie Seed

Team 1388 - Eagle Robotics
2005 Sacramento Engineering Inspiration
2004 Curie Division Champions (thanks to 1038 and 175)
2004 Sacramento Rookie All-Star

_
  #5   Spotlight this post!  
Unread 12-03-2008, 07:11
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
no team
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Austin, TX
Posts: 1,127
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
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...
__________________
Taking a break from mentoring for a few years. (Is that allowed?!?)

Controls Mentor
@rnazaretian

Previous teams:
Team Fusion, FRC 364
Garnet Squadron, FRC 4901

Last edited by RyanN : 12-03-2008 at 07:19.
  #6   Spotlight this post!  
Unread 12-03-2008, 08:55
jamie_1930's Avatar
jamie_1930 jamie_1930 is offline
Registered User
FRC #2228 (Cougartech)
Team Role: Student
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Rush-Henrietta
Posts: 371
jamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to behold
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   Spotlight this post!  
Unread 12-03-2008, 13:22
Tom Line's Avatar
Tom Line Tom Line is online now
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,554
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
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   Spotlight this post!  
Unread 12-03-2008, 16:28
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
no team
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Austin, TX
Posts: 1,127
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: HM55B Digital Compass - How do I program the controller to read it?

Quote:
Originally Posted by Tom Line View Post
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.
We already have code that does this, and it will increase the change if it does not see a fix, but our gear tooth sensors aren't as sensitive as I would wish, and they skip values when going fast. By the way, I'm using MPLAB.
__________________
Taking a break from mentoring for a few years. (Is that allowed?!?)

Controls Mentor
@rnazaretian

Previous teams:
Team Fusion, FRC 364
Garnet Squadron, FRC 4901
  #9   Spotlight this post!  
Unread 12-03-2008, 19:54
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,384
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: HM55B Digital Compass - How do I program the controller to read it?

Quote:
Originally Posted by RyanN View Post
... but our gear tooth sensors aren't as sensitive as I would wish, and they skip values when going fast...
OK, now you have me curious. What GTS' are you using?
Not sensitive enough and skipping counts doesn't sound like a sensor problem. It sounds more like an alignment issue.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
  #10   Spotlight this post!  
Unread 12-03-2008, 21:01
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
no team
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Austin, TX
Posts: 1,127
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: HM55B Digital Compass - How do I program the controller to read it?

Quote:
Originally Posted by billbo911 View Post
OK, now you have me curious. What GTS' are you using?
Not sensitive enough and skipping counts doesn't sound like a sensor problem. It sounds more like an alignment issue.
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.
__________________
Taking a break from mentoring for a few years. (Is that allowed?!?)

Controls Mentor
@rnazaretian

Previous teams:
Team Fusion, FRC 364
Garnet Squadron, FRC 4901
  #11   Spotlight this post!  
Unread 12-03-2008, 21:36
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,384
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: HM55B Digital Compass - How do I program the controller to read it?

Quote:
Originally Posted by RyanN View Post
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.
OK, that's the same sensor we used this year.
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.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
  #12   Spotlight this post!  
Unread 12-03-2008, 21:54
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
no team
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Austin, TX
Posts: 1,127
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: HM55B Digital Compass - How do I program the controller to read it?

Quote:
Originally Posted by billbo911 View Post
OK, that's the same sensor we used this year.
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.
We will try it when we get to the Bayou Regional, but 2 days before shipping, we measured it with a feeler, and it was pretty much right on what it called for, and one of our engineers doesn't want to get it "too close."
__________________
Taking a break from mentoring for a few years. (Is that allowed?!?)

Controls Mentor
@rnazaretian

Previous teams:
Team Fusion, FRC 364
Garnet Squadron, FRC 4901
  #13   Spotlight this post!  
Unread 13-03-2008, 00:14
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,384
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: HM55B Digital Compass - How do I program the controller to read it?

Quote:
Originally Posted by RyanN View Post
We will try it when we get to the Bayou Regional, but 2 days before shipping, we measured it with a feeler, and it was pretty much right on what it called for, and one of our engineers doesn't want to get it "too close."

I absolutely understand your engineers concerned about getting it too close. We too tried to have the encoder positioned exactly according to the spec. sheet. The result was we were having intermittent tooth counts. So I pulled out my old, ancient, barely working oscilloscope. When I looked at the signal I can see that he was not a consistent waveform. I've been unmounted the sensor from the transmission and manually positioned it by hand while the motor was running at about 50%. I move I moved the sensor in until it made contact with the gear. At that point I immediately backed it out to prevent damage, then at least I had a reference as to how far we could put it in. I've been carefully moved the sensor in and out and suddenly I got a perfect square wave, with the duty cycle of 50%. I was able to determine exactly how much shim was needed to reproduce that position. I then repositioned the encoder, solidly mounting it to the transmission with the correct amount of shim in place. I was then able to run the motor at full speed forward and full speed reverse without missing a single count.

For us, trial and error turned out to be the best way to go. If you have access to an oscilloscope, use it to determine the correct position to get a consistent results.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 01:46.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi