Compass Sensor

News, rumors, and other broad discussion topics.
andrea-povo-uni
Posts: 9
Joined: 08 Nov 2010, 11:11

Compass Sensor

Post by andrea-povo-uni »

Hi, everybody.
I have a question about the compass sensor of nxt.
How can I calibrate it with Bricxcc? I've found only the function SensorHTCompass that read the current value of the sensor.
I've read on the web that I've to calibrate the sensor before using but I don't find a way to do it for nxc.

Thank you for the attention.
hassenplug
Posts: 346
Joined: 27 Sep 2010, 03:05
Contact:

Re: Compass Sensor

Post by hassenplug »

I'm not sure the process, but yes, I'm pretty sure it's possible with NXC.

Steve
---> Link to lots of MINDSTORMS stuff under my picture --->
andrea-povo-uni
Posts: 9
Joined: 08 Nov 2010, 11:11

Re: Compass Sensor

Post by andrea-povo-uni »

I want to use the sensor to check the orientation of my nxt.
I need this information to identify the position of an object revealed by the sensor Ultrasounds. Then I can also use it to better checking the rotations of my Nxt.
I've tried to use the SensorHTCompass function but there isn't a complete correspondence between the value measured and the orientation of my nxt...
hassenplug
Posts: 346
Joined: 27 Sep 2010, 03:05
Contact:

Re: Compass Sensor

Post by hassenplug »

Make sure the sensor is not too close to the NXT, or the motors.

Steve
---> Link to lots of MINDSTORMS stuff under my picture --->
andrea-povo-uni
Posts: 9
Joined: 08 Nov 2010, 11:11

Re: Compass Sensor

Post by andrea-povo-uni »

I've already tried to keep my compass sensor away from the brick with similar results.
gloomyandy
Posts: 323
Joined: 29 Sep 2010, 05:03

Re: Compass Sensor

Post by gloomyandy »

Hi,
To calibrate the sensor you put it into calibration mode (no idea how to do this with NXC), and then rotate the sensor at a moderate speed for two full rotations, then exit calibration mode. The compass sensor can be hard to use. You tend to get disturbances from the robot motors (mount it as high as possible, often on a mast above the robot), but you can also get things like steel in your building causing problems.... Try it in different locations etc. to se if you are having problems with this...

Andy
andrea-povo-uni
Posts: 9
Joined: 08 Nov 2010, 11:11

Re: Compass Sensor

Post by andrea-povo-uni »

Hi again,
I installed the Lego Mindstorm NXT v.1.1.
I imported the compass block (I found it at http://www.hitechnic.com/cgi-bin/commer ... ey=NMC1034). But I cannot use the "calibrate" actions, it is simply in gray and I cannot select it! Does anyone know how to active the calibration actions?

Thanks a lot for the answer!
loopymech
Posts: 35
Joined: 30 Sep 2010, 15:35

Re: Compass Sensor

Post by loopymech »

I tried the NXT-G block from HT and I see the same grayed-out selection from the Action drop-down; looks like you might have to use the data hub...

This is from the help that came with the NXT-G block (Help_Compass Sensor.htm):

"To calibrate the compass under program control, select calibration mode (value 2 wired to the Action plug input) and then program your robot to rotate (turn in a tight circle) between 1 ½ and 2 times (more than 360 degrees) so it completes a full turn in about 20 seconds. Once the turns have been completed, set the Action to a Read function (Absolute or Relative) and the compass will be calibrated. The compass will retain the calibration settings until another calibration is performed, even if it is unplugged."

Hope that helps!

-Loopymech
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Compass Sensor

Post by mattallen37 »

Open a new program and drag the block into it. Go to the block settings panel, and in the "port" line, all the way to the right, there is a triangle. Click on that. Then on the left, there is a check box "MUX -> sensor" Check that, then uncheck it. Again, click on the triangle on the right, and you should have the calibrate option.

Don't ask me why you need to do that for it to work, or how I somehow figured it out, I have no idea.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Compass Sensor

Post by mattallen37 »

Oh, and you CAN calibrate it in NXC. On the product page, it says this.
Locn 0x41 is the mode control. Defaults to 0, which is measurement mode. Change to 0x43 to set calibration mode. Must be changed back to 0 when calibration is completed. (If cal. fails, locn. 0x41 will be set to 2 after the host has set it to 0 at the end of the failed calibrate attempt.)
I would have replaced the term "Locn" with "register", but whatever.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest