calibrating and reading the Hitechnic Compass Sensor values:
(the code has been developed by Hitechnic.com and was sent to me by email attachement). I simplfied it (see below), so it can be used easily as a driver.

In 1.38, sensorI2CCustomStd is not a valid sensor type. Try sensorI2CCustom and see if that works. There is also a sensorI2CHiTechnicCompass, that may be right up your ally as well.Hope This HelpsScott B-)

Code:

/* Test HiTechnic Compass Sensor

This program reads the HiTechnic compass and displays the heading on the screen.Two NXT buttons can also be used Left Arrow Button - send command to put the compass in Calibration Mode Right Arrow Button - send command to put the compass in Read Mode

I have a strange question due to my lack of understanding the hardware:

I am planning using the same compass for both robolab and robotc platform. I did the calibration when the robot was running in robotc platform. Then, I use the same robot and compass, but different firmware (i.e robolab), I suspect I will have to write a robolab program in robolab to calibrate the compass again? Correct?

What are pros and cons of the calibration? I understand it will mainly be the accuracy. However, will it remain consistent. Eg. it's heading is at north (magnetic north), but is off by 10degrees. Will it remain always 10 off, or it may fluctuate unless calibration is done.

Calibration is needed to offset the interference from motors and the actual NXT brick itself. If the robot remains the same then changing the hardware should not influence the readings. In other words, if you calibrate the compass in ROBOTC, it will be calibrated for all firmwares.The pros of calibration is that the effects of the brick and motors is minimized (not completely eliminated as the magnetic fields do fluctuate). There are no cons other than that you should do this for each robot model you make. If you change the positions of your motors, you should ideally recalibrate your robot.As for the consistency, I have no idea, I would suggest you use another compass (in your mobile phone for example) to verify

Also, if you want to get a good result multiplying PI, use 1.0*PI and not 1*PI, one is float multiplication, the other isn't.

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum