Page 1 of 3

10DOF model sensors

Posted: Sat May 11, 2013 11:28 pm
by ak1394
Guys,

I'm poking in firmware source looking to add support for magnetometer and barometer reading on 10DOF model. It looks like there are drivers in there, for both HMC5883L and MS5611. Next, I'm going to try to figure out how to read the sensor data and send it through the radio link over to the pc client.

So, if anyone is interested doing something similar please comment on the thread.

Regards,
Anton

Re: 10DOF model sensors

Posted: Sat May 11, 2013 11:43 pm
by SuperDave42
that sounds great !.

I'm a mechanical designer and have no idea how to do it but I know thats where the client and the CF firmware need to start heading. I have the VM installed now and it works great. I want to figure out how to add PID adjustment boxes to the CF client. Most likely what I'll be reading up on all next week.

I'm open to help test your code though. I'm a decent Multicopter pilot ;)

Dave

10dof cf

Re: 10DOF model sensors

Posted: Sun May 12, 2013 4:31 pm
by marcus
Hi,

phiamo has done some work with the pressure sensor, you can have a look at this post for more info and code.

For changing the PID settings you can use the parameter tab. Just change parameters and press the Send values button. Just be careful and make small changes. New values can drastically change the flight dynamics.

/Marcus

Re: 10DOF model sensors

Posted: Sun May 12, 2013 5:15 pm
by ak1394
Thanks to phiamo's example I managed to add mag/barometer data reading. So far reporting it to the console of pc client only:

Code: Select all

Magnetometer data: {'mag.z': -314, 'mag.x': 1262, 'mag.y': -503}
Altimeter data: {'altimeter.temperature': 27.998437881469727, 'altimeter.pressure': 1007.7496948242188}
Magnetometer data: {'mag.z': -313, 'mag.x': 1262, 'mag.y': -503}
Altimeter data: {'altimeter.temperature': 28.006250381469727, 'altimeter.pressure': 1007.7346801757812}
Magnetometer data: {'mag.z': -314, 'mag.x': 1263, 'mag.y': -503}
Altimeter data: {'altimeter.temperature': 28.006250381469727, 'altimeter.pressure': 1007.7346801757812}
Magnetometer data: {'mag.z': -314, 'mag.x': 1262, 'mag.y': -504}
Altimeter data: {'altimeter.temperature': 28.019062042236328, 'altimeter.pressure': 1007.7862548828125}
Altimeter data: {'altimeter.temperature': 28.019062042236328, 'altimeter.pressure': 1007.7862548828125}
Magnetometer data: {'mag.z': -313, 'mag.x': 1263, 'mag.y': -503}
Altimeter data: {'altimeter.temperature': 28.0284366607666, 'altimeter.pressure': 1007.7937622070312}
Changes available in https://bitbucket.org/ak1394/crazyflie-firmware and https://bitbucket.org/ak1394/crazyflie-pc-client

Now I'm going to try to figure out what to do with it :)

Anton

Re: 10DOF model sensors

Posted: Sun May 12, 2013 7:40 pm
by marcus
ak1394 wrote:Now I'm going to try to figure out what to do with it :)
One idea is to limit the thrust lowering to avoid the Crazyflie dropping like a stone when you release the thrust. Something like this is done in the PC client now, but without any feedback. It would be cool to have the Crazyflie be able to limit this by itself by using the pressure sensor data as it descends.

/Marcus

Re: 10DOF model sensors

Posted: Sun May 12, 2013 8:17 pm
by ak1394
marcus wrote: One idea is to limit the thrust lowering to avoid the Crazyflie dropping like a stone when you release the thrust ...
This is a good idea! However before I can try something like this, I want to make sure I'm getting solid sensor readings. It looks like (by simply observing values on the console) both barometer and magnetometer readings jump quite a bit. Also raw magnetometer readings are hard to interpret.

I did some googling, mostly focusing on magnetometer, and found that there are quite a few opensource projects with hmc5883L support:

https://github.com/AeroQuad/AeroQuad/tr ... AQ_Compass
https://github.com/diydrones/ardupilot/ ... AP_Compass
https://github.com/rob42/FreeIMU-201211 ... es/HMC58X3

I'm going to dig around in there and try to port something to Crazyflie.

Anton

Re: 10DOF model sensors

Posted: Mon May 13, 2013 3:17 pm
by SuperRoach
The magnetometer would be excellent for the yaw sensor, being able to calibrate your "zero" point to return to on a button press. Helpful for a new user where their "forward" direction gets changed.

Re: 10DOF model sensors

Posted: Tue May 21, 2013 3:50 pm
by DesTinY
SuperRoach wrote:The magnetometer would be excellent for the yaw sensor, being able to calibrate your "zero" point to return to on a button press. Helpful for a new user where their "forward" direction gets changed.
Or even a step further: "Absolute control" known from the AR.Drone2.0. http://www.youtube.com/watch?v=uVNtE6LMD2o

Re: 10DOF model sensors

Posted: Wed May 22, 2013 4:21 pm
by ak1394
I'm trying to calibrate and tilt-compensate magnetometer at the moment, seems quite challenging considering magnetic field distortion present indoors.

Re: 10DOF model sensors

Posted: Wed May 22, 2013 6:58 pm
by DesTinY
ak1394 wrote:I'm trying to calibrate and tilt-compensate magnetometer at the moment, seems quite challenging considering magnetic field distortion present indoors.
I know from the AR.Drone and other Quatcopters that they all need to calibrate the magnetometer with a 360ยบ yaw. Every flight!
But I think the biggest challenge would be to compensate the magnetic fields of the nearby motors.