10DOF model sensors

Firmware/software/electronics/mechanics
ak1394
Beginner
Posts: 12
Joined: Fri May 03, 2013 9:53 pm

10DOF model sensors

Post 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
SuperDave42
Beginner
Posts: 23
Joined: Tue Feb 05, 2013 8:30 pm
Location: California, a
Contact:

Re: 10DOF model sensors

Post 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
Superluminal carbon fiber flying robots.
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: 10DOF model sensors

Post 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
ak1394
Beginner
Posts: 12
Joined: Fri May 03, 2013 9:53 pm

Re: 10DOF model sensors

Post 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
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: 10DOF model sensors

Post 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
ak1394
Beginner
Posts: 12
Joined: Fri May 03, 2013 9:53 pm

Re: 10DOF model sensors

Post 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
SuperRoach
Member
Posts: 96
Joined: Fri May 03, 2013 2:06 pm

Re: 10DOF model sensors

Post 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.
DesTinY
Member
Posts: 97
Joined: Sat Feb 09, 2013 5:18 pm
Location: Bünde, Germany

Re: 10DOF model sensors

Post 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
ak1394
Beginner
Posts: 12
Joined: Fri May 03, 2013 9:53 pm

Re: 10DOF model sensors

Post by ak1394 »

I'm trying to calibrate and tilt-compensate magnetometer at the moment, seems quite challenging considering magnetic field distortion present indoors.
DesTinY
Member
Posts: 97
Joined: Sat Feb 09, 2013 5:18 pm
Location: Bünde, Germany

Re: 10DOF model sensors

Post 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.
Post Reply