Forum Replies Created
-
AuthorPosts
-
November 19, 2014 at 21:21 in reply to: Mindsensors' GlideWheel sensor (and possibly other sensors from MS) doesn't work #4988
Andreas BoerzelParticipantHi,
I have implemented the sensor class AbsoluteIMU_ACGSensor.cs, that works with the Mindensors AbsoluteIMU-ACG sensor and created a pull request at Github. I also added a the test sample AbsoluteIMU_ACGSensorExample.cs.Andreas
November 11, 2014 at 13:31 in reply to: Mindsensors' GlideWheel sensor (and possibly other sensors from MS) doesn't work #4975
Andreas BoerzelParticipantHi!
Yes of course, I will add the code! But I still need few days to refactor the code before I publish it.November 10, 2014 at 11:28 in reply to: Mindsensors' GlideWheel sensor (and possibly other sensors from MS) doesn't work #4967
Andreas BoerzelParticipantHi,
I have good news!
At the weekend I updated my sd-card to the latest image and got the latest version from the master-branch, and now the AbsoluteIMU-ACG sensor works with the implementation I added in the tread How to use AbsoluteIMU-ACG sensor?.Maybe the problem was only that I used an old sd.card image?!
November 7, 2014 at 11:24 in reply to: Mindsensors' GlideWheel sensor (and possibly other sensors from MS) doesn't work #4960
Andreas BoerzelParticipantUnfortunately it does not work yet! The WriteAndRead-method of the I2CSensor class doesn’t work with the AbsoluteIMU sensor. It seems for me that the AbsoluteIMU sensor has a different command-structure. I also tried to port the LeJOS-implementation of the AbsoluteImuAgcMindSensor.java class to MonoBrick, but unfortunately the Libc lowlevel methods are not compatible with them of LeJOS. So I contacted the mindsensors support, but at the moment I’m helpless!
Andreas BoerzelParticipantHi Max,
I’ve tried both, but without success…November 2, 2014 at 17:23 in reply to: Mindsensors' GlideWheel sensor (and possibly other sensors from MS) doesn't work #4952
Andreas BoerzelParticipantHi Anders,
thank you for your tip and I would like to try this, but I can’t find a corresponding method forif (!writeI2C(link, MSANG_I2CRequest, MSANG_I2CReply, 4)) return -1;
in the UnixDevice class. I don’t have much unix knowledge, is there a corresponding method for ‘writeI2C’ in the Libc library available?
Thanks,
Andreas- This reply was modified 10 years, 1 month ago by Andreas Boerzel.
Andreas BoerzelParticipantHi,
I tried the sample code from Max, but it’s the same resultbyte[] ReadRegister(byte register, byte rxLength)
returns only the first byte and all other bytes are zero, exactly as described by Filip. I really want to use this sensor with MonoBrick and I am willing to provide a sensor implementation, but my knowledge regarding I2C devices are not sufficient for this purpose. Can someone help me?Thanks!
Andreas BoerzelParticipantI also tried sensor mode LowSpeed9V, but with the same result.
Andreas BoerzelParticipantThank you very much for your answer, I think it’s the right way. I tried to implement my own sensor-class, see code below. But my test program reads only invalid and constant values.
Does anyone know what’s wrong with my sensor implementation?
Thanks,
Andreaspublic class AbsoluteIMU_ACGSensor : I2CSensor { private const byte ADDRESS = 0x22; private enum I2CRegisters : byte { Command = 0x41, XGyroDataLSB = 0x53, XGyroDataMSB = 0x54, YGyroDataLSB = 0x55, YGyroDataMSB = 0x56, ZGyroDataLSB = 0x57, ZGyroDataMSB = 0x58 }; private static int MLBToInteger(byte lsb, byte msb) { return (int)lsb + ((int)msb << 8); } public AbsoluteIMU_ACGSensor(SensorPort port) : base(port, ADDRESS, I2CMode.LowSpeed) { base.Initialise(); } public GyroData ReadGyro() { LcdConsole.WriteLine("ReadGyro..."); byte[] result = ReadRegister((byte)I2CRegisters.XGyroDataLSB, 6); LcdConsole.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}", result[0], result[1], result[2], result[3], result[4], result[5]); return new GyroData(result); } public class GyroData { public GyroData(byte[] rawData) { X = MLBToInteger(rawData[0], rawData[1]); Y = MLBToInteger(rawData[2], rawData[3]); Z = MLBToInteger(rawData[4], rawData[5]); } public int X { get; private set; } public int Y { get; private set; } public int Z { get; private set; } };
Testprogram:
class Program { static void Main(string[] args) { var buts = new ButtonEvents(); LcdConsole.WriteLine("Starting..."); var gyroSensor = new AbsoluteIMU_ACGSensor(SensorPort.In2); gyroSensor.SendCommand((byte)AbsoluteIMUCommands.ChangeAccelerometerSensitivityTo2G); bool end = false; buts.EscapePressed += () => { end = true; LcdConsole.WriteLine("Stopping..."); }; while (!end) { // LcdConsole.Clear(); var result = gyroSensor.ReadGyro(); LcdConsole.WriteLine("GX: {0}", result.X); LcdConsole.WriteLine("GY: {0}", result.Y); LcdConsole.WriteLine("GZ: {0}", result.Z); Thread.Sleep(250); } }
The AbsoluteIMU-User-Guide describes the I2C-registers.
-
AuthorPosts
Follow