I have been up to more sensor testing, this time with the “CMPS-Nx” compass part from Mindsensors. The Accelerometer sensors I tested a few days ago involved having to upgrade the Lego NXT firmware to solve an I2C glitch issue. Using my new firmware, I set out to get a 'heading' value from the compass sensor over Bluetooth using Lego NXT Direct Commands, and then link that value to a fancy Compass Gauge on a PC Dashboard.
The Lego NXT Direct Commands required to poll the sensor were almost identical to the accelerometer. The Mindsensors datasheet identified which I2C command codes and memory addresses to use, and they just so happened to be the same as the accelerometer part. I did not need to calibrate the compass, and was able to get readings from it right away. I was impressed with how accurate it is, even when using an 8 bit value. ( default 10 bit values ) I was able to poll the compass every 40ms with no problems whatsoever.
Using the compass together with sonar and wheel encoder values should make it possible to have the NXT perform more advanced autonomous behaviours such as navigation and mapping. I would be interested to find out if any users have had success in getting the NXT to autonomously navigate itself around an real world environment, such as an office floor, without getting stuck?
Note: I have heard from a few users who have not checked out the Lego NXT Direct Commands yet, so I'll post some quick examples in a few days. The Commands are supported natively by the Lego firmware, and can be sent to the NXT over Bluetooth from external programs like my roboDNA Dashboards. It allows you to control the motor speeds, and obtain sensor values for telemetry. Details are in a PDF file found in the Lego Bluetooth Communication Guide: http://robodna.com/roboDNA/downloads/NXTDirectcommands.pdf
The Lego NXT Direct Commands required to poll the sensor were almost identical to the accelerometer. The Mindsensors datasheet identified which I2C command codes and memory addresses to use, and they just so happened to be the same as the accelerometer part. I did not need to calibrate the compass, and was able to get readings from it right away. I was impressed with how accurate it is, even when using an 8 bit value. ( default 10 bit values ) I was able to poll the compass every 40ms with no problems whatsoever.
Using the compass together with sonar and wheel encoder values should make it possible to have the NXT perform more advanced autonomous behaviours such as navigation and mapping. I would be interested to find out if any users have had success in getting the NXT to autonomously navigate itself around an real world environment, such as an office floor, without getting stuck?
Note: I have heard from a few users who have not checked out the Lego NXT Direct Commands yet, so I'll post some quick examples in a few days. The Commands are supported natively by the Lego firmware, and can be sent to the NXT over Bluetooth from external programs like my roboDNA Dashboards. It allows you to control the motor speeds, and obtain sensor values for telemetry. Details are in a PDF file found in the Lego Bluetooth Communication Guide: http://robodna.com/roboDNA/downloads/NXTDirectcommands.pdf