ALT Hold from MSP

This forum is dedicated to all issues and questions related to your individual setups and configurations
Post Reply
atomer
Posts: 11
Joined: Fri Apr 15, 2016 8:58 pm

ALT Hold from MSP

Post by atomer »

I have 10-DOF sensor installed on my Flip 1.5 MWC. There is an ALT reading on GUI. I set AUX1 Hi for Alt Hold.
My question is how do you set the Alt hold from MSP? Do I send the MSP_SET_RAW_RC with aux1 value at 2000 ?
Also, When I read est Altitude with MSP_ALTITUDE, I get different values for each request.

I'm trying to program such that user inputs a target altitude and I check current altitude and increase throttle until target altitude is achieved and hold the position. Right now MSP_ALTITUDE gives me different values for each request.

Please help and thanks in advance.

http://i.imgur.com/GRTxD8o.jpg
Attachments
cap_jpeg.jpg

gregd72002
Posts: 103
Joined: Fri Dec 12, 2014 5:16 pm

Re: ALT Hold from MSP

Post by gregd72002 »

atomer wrote:I have 10-DOF sensor installed on my Flip 1.5 MWC. There is an ALT reading on GUI. I set AUX1 Hi for Alt Hold.
My question is how do you set the Alt hold from MSP? Do I send the MSP_SET_RAW_RC with aux1 value at 2000 ?
Also, When I read est Altitude with MSP_ALTITUDE, I get different values for each request.


To activate ALT_HOLD you can use SET_BOX or indeed using the aux channel should work (not sure about the mapping of channels)

atomer wrote:I'm trying to program such that user inputs a target altitude and I check current altitude and increase throttle until target altitude is achieved and hold the position. Right now MSP_ALTITUDE gives me different values for each request.

Why not to set the target altitude and let the MW do the work? MW controls the throttle in altitude hold mode (baro mode) and will do exactly what you are wanting to do - increase/decrease throttle automatically.

atomer
Posts: 11
Joined: Fri Apr 15, 2016 8:58 pm

Re: ALT Hold from MSP

Post by atomer »

gregd72002 wrote:
atomer wrote:I have 10-DOF sensor installed on my Flip 1.5 MWC. There is an ALT reading on GUI. I set AUX1 Hi for Alt Hold.
My question is how do you set the Alt hold from MSP? Do I send the MSP_SET_RAW_RC with aux1 value at 2000 ?
Also, When I read est Altitude with MSP_ALTITUDE, I get different values for each request.


To activate ALT_HOLD you can use SET_BOX or indeed using the aux channel should work (not sure about the mapping of channels)

atomer wrote:I'm trying to program such that user inputs a target altitude and I check current altitude and increase throttle until target altitude is achieved and hold the position. Right now MSP_ALTITUDE gives me different values for each request.

Why not to set the target altitude and let the MW do the work? MW controls the throttle in altitude hold mode (baro mode) and will do exactly what you are wanting to do - increase/decrease throttle automatically.


How do I go about knowing if I provide the throttle, the drones goes to target altitude and then ALT HOLD mode?
I'm not using any RC, I'm automating it from my code. For example when I run my code, I want to ALT HOLD at 6ft, I increase the throttle but no way of knowing it goes 6ft.

gregd72002
Posts: 103
Joined: Fri Dec 12, 2014 5:16 pm

Re: ALT Hold from MSP

Post by gregd72002 »

without RC the drone will not arm neither will fly nor will do alt hold.

You need RC. If you want to increase altitude while in alt hold use your RC to increase it.

atomer
Posts: 11
Joined: Fri Apr 15, 2016 8:58 pm

Re: ALT Hold from MSP

Post by atomer »

gregd72002 wrote:without RC the drone will not arm neither will fly nor will do alt hold.

You need RC. If you want to increase altitude while in alt hold use your RC to increase it.


Thanks for the help and replies

I don't want to use RC. Everything is done from my code. My end goal is automation of drone.

I have all that working. I can arm and disarm the drone. I can set RC values. I can also increase and decrease the throttle value.
I want my drone to fly target height. this target height parameter is given by user before the arming of the drone.

So, set target height --> arm --> increase throttle --> check if target height ?? --> ALT HOLD if target height

gregd72002
Posts: 103
Joined: Fri Dec 12, 2014 5:16 pm

Re: ALT Hold from MSP

Post by gregd72002 »

oh, ok so you are already sending MSP_SET_RAW_RC ?

There does not seem to be a MSP for setting target altitude other than MSP_SET_WP. But this one requires GPS too.

Other option would be to implement a new MSP into MW that sets target alt, just not sure if this would work out of box.

atomer
Posts: 11
Joined: Fri Apr 15, 2016 8:58 pm

Re: ALT Hold from MSP

Post by atomer »

gregd72002 wrote:oh, ok so you are already sending MSP_SET_RAW_RC ?

There does not seem to be a MSP for setting target altitude other than MSP_SET_WP. But this one requires GPS too.

Other option would be to implement a new MSP into MW that sets target alt, just not sure if this would work out of box.


Yea. I'm sending MSP_SET_RAW_RC successfully.

I have barometer BMP180 on board on my flight controller. I thought I could just request the altitude with MSP_ALTITUDE.
But, I get different values every time I make a request even though the flight controller and barometer is stand still.

I'm guessing, negative meaning I'm below sea level? Do I need altitude correction?

Again much thanks for help and replies.

here is the output:

Code: Select all

est altitude: -188 cm   Vario: 0 cm/s

est altitude: -186 cm   Vario: 0 cm/s

est altitude: -175 cm   Vario: 0 cm/s

est altitude: -177 cm   Vario: 0 cm/s

est altitude: -152 cm   Vario: 6 cm/s

est altitude: -154 cm   Vario: 0 cm/s

gregd72002
Posts: 103
Joined: Fri Dec 12, 2014 5:16 pm

Re: ALT Hold from MSP

Post by gregd72002 »

Barometer is calibrated to the initial altitude as such your reading will converge to 0. Also most people get much better results with MS5611 than BMP085 (see http://wiki.paparazziuav.org/wiki/Baro_comparsion). In any case baro is very sensitive device and will register any movement of air. As such it will always jump around a little bit. Use Sonar if you need more accuracy.

AFAIK MW does not allow you setting target altitude through any MSP message other than through MW_WP.

However a simple change might be enough to implement a setter for altitude (i.e. MSP_SET_ALTITUDE). Something like this in Protocol.cpp should do:

Code: Select all

case MSP_SET_ALTITUDE:
      mspAck();
      s_struct_w((uint8_t*)&AltHold,4);
      break;


where AltHold is int32

atomer
Posts: 11
Joined: Fri Apr 15, 2016 8:58 pm

Re: ALT Hold from MSP

Post by atomer »

gregd72002 wrote:Barometer is calibrated to the initial altitude as such your reading will converge to 0. Also most people get much better results with MS5611 than BMP085 (see http://wiki.paparazziuav.org/wiki/Baro_comparsion). In any case baro is very sensitive device and will register any movement of air. As such it will always jump around a little bit. Use Sonar if you need more accuracy.

AFAIK MW does not allow you setting target altitude through any MSP message other than through MW_WP.

However a simple change might be enough to implement a setter for altitude (i.e. MSP_SET_ALTITUDE). Something like this in Protocol.cpp should do:

Code: Select all

case MSP_SET_ALTITUDE:
      mspAck();
      s_struct_w((uint8_t*)&AltHold,4);
      break;


where AltHold is int32


Thanks for the suggestion. Alt Hold is set in GPS.cpp right? I don't have GPS currently on board. Will this work without GPS? Thanks for help again.

gregd72002
Posts: 103
Joined: Fri Dec 12, 2014 5:16 pm

Re: ALT Hold from MSP

Post by gregd72002 »

baro PIDs are computed in imu.cpp, there is no need for GPS

atomer
Posts: 11
Joined: Fri Apr 15, 2016 8:58 pm

Re: ALT Hold from MSP

Post by atomer »

gregd72002 wrote:baro PIDs are computed in imu.cpp, there is no need for GPS


Thanks.

Does this new command MSP_SET_ALTITUDE only sets altitude when the drone is already in the air?
OR after I arm, when I send MSP_SET_ALTITUDE , it hovers to that altitude?

Thanks for the help again and answering the question. Very much appreciate it.

gregd72002
Posts: 103
Joined: Fri Dec 12, 2014 5:16 pm

Re: ALT Hold from MSP

Post by gregd72002 »

It will only work once you are in the air and when alt hold is active.

Use it with care as this has not been tested.

Post Reply