Skip to content
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

[guidance] Expansion of the guided protocol #1694

Merged
merged 3 commits into from
Jun 10, 2016

Conversation

kirkscheper
Copy link
Member

@kirkscheper kirkscheper commented May 30, 2016

We expanded the message flag definition to facilitate updating the horizontal and vertical setpoints in different reference frames as well as separate definitions of whether the setpoints are position or velocity commands. Also added a heading rate setpoint.

This is a draft pull request, I still need to test it (especially the new rate setpoint) before it can be approved. Feedback is welcome @rmeertens.

continues/replaces #1686

}
guidance_h_set_guided_vel(x, y);
} else { // position setpoint
if ((flags & 3) == 0) { // set absolute position setpoint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use bit_is_set

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:( I wanted to check the two bits at the same time... ok, wilco

Kirk

On 01/06/16 13:32, Roland Meertens wrote:

In sw/airborne/firmwares/rotorcraft/autopilot.c
#1694 (comment):

+{

  • /* only update setpoints when in guided mode */
  • if (autopilot_mode != AP_MODE_GUIDED) {
  • return;
  • }
  • // handle x,y
  • if (bit_is_set(flags, 5)) { // velocity setpoint
  • if (bit_is_set(flags, 1)) { // set velocity in body frame
  •  float psi = stateGetNedToBodyEulers_f()->psi;
    
  •  x =  cosf(-psi) \* x + sinf(-psi) \* y;
    
  •  y = -sinf(-psi) \* x + cosf(-psi) \* y;
    
  • }
  • guidance_h_set_guided_vel(x, y);
  • } else { // position setpoint
  • if ((flags & 3) == 0) { // set absolute position setpoint

use bit_is_set


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/paparazzi/paparazzi/pull/1694/files/c64e3d95546f612c5d16ce11f85c54caea57da84#r65343865,
or mute the thread
https://github.com/notifications/unsubscribe/ACtEQ1EHhyipyiInPJf_FvBC94nl6C9aks5qHW26gaJpZM4IqAR-.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know ;)
Kudo's for knowing this trick 👍

@kirkscheper
Copy link
Member Author

@rmeertens thanks for the comment, think its cleaner this way. Do you have time to test this this tomorrow with me as I don't know how the python scripts work?

@rmeertens
Copy link
Contributor

line 606: bit is set needs to have the flags ;)

@kirkscheper
Copy link
Member Author

Ok, this seems to be good now. Tested and working as we would expect. @flixr how does it look to you?

@@ -576,6 +575,77 @@ bool autopilot_guided_move_ned(float vx, float vy, float vz, float heading)
return false;
}

/* Set guided mode setpoint
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use doxygen style comments so it actually ends up in the generated documentation....

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, ok, doxygen comment in the header file...

@flixr
Copy link
Member

flixr commented Jun 9, 2016

Looks good to me :-)
Haven't really checked the flags values in the python implementation though... so if it's tested and the pprzlink submodule included here as well, we can merge it.

Also we should probably add heading_rate to the HOVER_LOOP message...?

@kirkscheper
Copy link
Member Author

I just updated the python script slightly and tested it as is on a parrot ardrone and it works pretty well!

@kirkscheper
Copy link
Member Author

oh, oops you already merged it, haha. I will make a new request to update the script.

@flixr
Copy link
Member

flixr commented Jun 10, 2016

no, this is not merged yet... only the changes in pprzlink are merged...
Can you please also update the pprzlink submodule to the latest version with the updated message?

@flixr flixr merged commit 6686c9a into paparazzi:master Jun 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants