-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix some errors, added two modules and improved OSD files #2614
Conversation
This airframe file uses an auto load module located in paparazzi/conf/modules/board_matek_wing.xml to load all hardware specific drivers for a cleaner airframe file.
This airframe file supports flaps.
The current sensor's adc channel definitions were the old style, everything works fine now.
Added a definition about the OSD home bearing indication style.
I added baro messaging without using the bandwidth hungry SENSOR_SYNC_SEND.
Removed unneeded code for SITL because the module is not used in simulation anyway...
I just rearranged the equation for the calculation of battery capacity used in order to be more readable to others.
I just rearranged the calculation of used battery capacity in order to be more readable from other people try #2
<property name="field" value="AIRBORNE_ANTENNA:mag_heading_deg"/> | ||
<property name="format" value="%.0f Mag"/> | ||
<property name="size" value="25."/> | ||
<property name="color" value="#00ff00"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With color would always add a RED and BLUE component, since on some Monochrome pure green not too visible, so something like #33ff33, as soon as PR is honored will test and enhance and make and improve PR otherwise it will never land up in master :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok!
<sectors/> | ||
<variables/> | ||
<exceptions> | ||
<exception cond="(RcChannel(YAW) > MAX_PPRZ/2)&&(autopilot.mode == AP_MODE_AUTO2) && (GetPosAlt() > GetAltRef()+20)" deroute="Target"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are lt
and gt
options as well as and
keywords, but since it is your flightplan anyhow all fine. Interesting way to get what you want to do, nice example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was like this in 2012 when i first started with paparazzi and i guess i got used to it due to its resemblance with C.
I will try the new way tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are lt and gt options as well
Any link to read about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, not documented yet 😞
You can replace some operators with @AND
@OR
@LT
(less than) @GT
(greater than) ...
The complete list is here: https://github.com/paparazzi/paparazzi/blob/master/sw/lib/ocaml/expr_lexer.mll#L27
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know!
Thank you again and of course OpenUAS.
#if defined(COMMAND_FLAPS) | ||
#define Flaps(x) ({ (*ap_state).commands[COMMAND_FLAPS] = (int16_t)((float)MAX_PPRZ * (float)x); 0; }) | ||
#else | ||
#define Flaps(x) {0;} | ||
#endif | ||
#define RcChannel(x) ((*fbw_state).channels[RADIO_ ## x]) | ||
</header> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is safer to use the helper functions from inter_mcu.h
, in this case imcu_set_command
and imcu_get_radio
. If someone is using your flight plan with a board based on ChibiOS, this is currently not thread-safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIXED by removing the FLAPS setting.
When i use the function "imcu_set_command(COMMAND_FLAPS, 0)" inside the flight plan like this
I get this error
/home/hendrix/paparazzi/var/aircrafts/Easyglider_matek/ap/generated/flight_plan.h:202:13: error: invalid use of void expression if (! (imcu_set_command(COMMAND_FLAPS, 0))) {
It compiles fine if i modify the imcu_set_command function inside inter_mcu.h like this
static inline uint8_t imcu_set_command(uint8_t cmd_idx, pprz_t cmd)
{
PPRZ_MUTEX_LOCK(ap_state_mtx);
ap_state->commands[cmd_idx] = cmd;
PPRZ_MUTEX_UNLOCK(ap_state_mtx);
return(false);
}
The imcu_get_radio(RADIO_X) on the other hand works fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should not change this function, but use call_once
instead of call
in the flight plan (http://wiki.paparazziuav.org/wiki/Flight_Plans#Call)
Actually, you should use call_once
for every calls that don't require a "loop" (returning false immediately).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK i will fix everything i hope....
After much testing i decided to remove some excess code so do you want me to delete this pull request
and create a fresh one with the final files?
I don't know but because of my perfectionism i tend to mess things up...
Chris
|
||
|
||
// Periodic function called with a frequency defined in the module .xml file | ||
void mag_compass(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this function ? the heading angle should be taken from state interface stateGetNedToBodyEulers_f()->psi
, not by direct reading of the imu structure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function takes the raw magnetometer data and calculates the magnetic compass heading, is this already done somewhere else?
I need this function in order to have an OSD magnetic compass heading independent from the GPS for safety reasons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That shoud be directly stateGetNedToBodyEulers_f()->psi
as I said. It is always true for rotorcraft, and for fixedwing it depends if you are using an AHRS with magnetometers or not (then, it is actually the ground course, I don't know if it is still applicable in your case)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried with stateGetNedToBodyEulers_f()->psi and
MODULE_HMC58XX_UPDATE_AHRS in the airframe file but it does not work as i get a constant output of -1
What i did is to implement the stateGetNedToBodyEulers_f()->psi to rotorcrafts only.
If you want i can remove the function all together and use only the gps course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what i came up with
struct Int32Vect3 mag;
struct Int32Vect3 mag_neutrals;
VECT3_COPY(mag, imu.mag_unscaled);
VECT3_COPY(mag_neutrals, imu.mag_neutral);
In order to buffer the imu structure as much as possible, the next step is to remove the mag_compass() function completely for fixed wings.
Inside void ahrs_dcm_update_mag(struct FloatVect3 *mag) the same code exists but it is not active.
Let me know what you want me to do!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will accept the PR like this for now, you can't really expect a valid mag heading without mag, and if the DCM ahrs is fixed later to provide a reasonable output, this can be changed.
I added the ability for the home bearing to remain constant when the gps is lost. This way together with the magnetometer compass bearing you have a way to get back home.
I added the ability for the home bearing to remain constant when the gps is lost. This way together with the magnetometer compass bearing you have a way to get back home. I also moved one configuration message for aesthetic reasons.
I added the ability for the home bearing to remain constant when the gps is lost. This way together with the magnetometer compass bearing you have a way to get back home. I also moved one configuration message for aesthetic reasons and added a line just to be safe with the return home bearing calculation.
I added the ability for the home bearing to remain constant when the gps is lost. This way together with the magnetometer compass bearing you have a way to get back home. A variable for the baro altitude correction based on the GPS was made static otherwise the correction would be lost if the gps was lost. I also moved one configuration message for aesthetic reasons and added a line just to be safe with the return home bearing calculation.
I added the ability for the home bearing to remain constant when the gps is lost. This way together with the magnetometer compass bearing you have a way to get back home. A variable for the baro altitude correction based on the GPS was made static otherwise the correction would be lost if the gps was lost. All Capital letter true or false were replaced with small letter words. The barometer sync with the gps got a little stricter. I also moved one configuration message for aesthetic reasons and added a line just to be safe with the return home bearing calculation.
I added the ability for the home bearing to remain constant when the gps is lost. This way together with the magnetometer compass bearing you have a way to get back home. A variable for the baro altitude correction based on the GPS was made static otherwise the correction would be lost if the gps was lost. All Capital letter true or false were replaced with small letter words. The gps accuracy needs to be higher in order to start calculating or change to auxiliary sensors. The barometer sync with the gps got a little stricter. I also moved one configuration message for aesthetic reasons and added a line just to be safe with the return home bearing calculation. ats History
I added the ability for the home bearing to remain constant when the gps is lost. This way together with the magnetometer compass bearing you have a way to get back home. A variable for the baro altitude correction based on the GPS was made static otherwise the correction would be lost if the gps was lost. All Capital letter true or false were replaced with small letter words. The gps accuracy needs to be higher in order to start calculating or change to auxiliary sensors. The barometer sync with the gps got a little stricter. I also moved one configuration message for aesthetic reasons and added a line just to be safe with the return home bearing calculation. ats
I added the ability for the home bearing to remain constant when the gps is lost. This way together with the magnetometer compass bearing you have a way to get back home. A variable for the baro altitude correction based on the GPS was made static otherwise the correction would be lost if the gps was lost. All Capital letter true or false were replaced with small letter words. The gps accuracy needs to be higher in order to start calculating or change to auxiliary sensors. The barometer sync with the gps got a little stricter. I also moved one configuration message for aesthetic reasons and added a line just to be safe with the return home bearing calculation. ats
I added the ability for the home bearing to remain constant when the gps is lost. This way together with the magnetometer compass bearing you have a way to get back home. A variable for the baro altitude correction based on the GPS was made static otherwise the correction would be lost if the gps was lost. All Capital letter true or false were replaced with small letter words. The gps accuracy needs to be higher in order to start calculating or change to auxiliary sensors. The barometer sync with the gps got a little stricter. I also moved one configuration message for aesthetic reasons and added a line just to be safe with the return home bearing calculation.
Except all the typo errors i added an one time synchronization with the GPS altitude when conditions are right. I don't know if the barometer altitude is already synchronized to the GPS, if yes then the relevant code must be deleted.
It is now the same as the file on the master branch, there is no need for change.
Too much excess code, return back to basics.
I now use stateGetNedToBodyEulers_f()->psi for rotorcrafts but for fixed wings everything remains the same as far as the mag_compass() function is concerned.
Final versions.
Final version
This is what i came up with, i hope it is enough...
This is what i came up with, i hope it is enough...
Made the code more readable and clean.
Final version i hope.
Final version i hope...
Final version i hope...
I moved some code to a better position in order to use less CPU time.
Fixed as many mistakes and problems as possible, the next step is to remove the mag_compass() function
Added the ability to start the take off in auto2 with the trottle channel of the RC transmitter. I found it very useful.
Replaced all 0 or 1 boolean choices with true or false in small letters.
All Boolean choices are now using true or false in small letters instead of 0 or 1
No description provided.