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

Improved HL commander - spiral & linear segment #1410

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

matejkarasek
Copy link
Contributor

@matejkarasek matejkarasek commented Sep 9, 2024

This PR extends the functionality of the HL commander by adding 1) a linear GOTO command and 2) a spiral segment.
To function correctly, it requires this cflib PR: bitcraze/crazyflie-lib-python#470

  1. GOTO command now has an extra 'linear' argument. When set to true, the crazyflie will go to the setpoint with constant velocity, instead of a smooth acceleration and deceleration.
    This change will require updates of cfclient, and other apps using the GOTO...
    Alternatively, we could introduce e.g. a GOTOLINEAR or GOTO2 commands. @whoenig Please share your thoughts on this as this would affect the crazyswarm also.

    Edit 2024-09-13:
    The new functionality is introduced in a GOTO2 command, former GOTO is kept for now but will be deprecated

  2. SPIRAL command, which allows to fly along an arc or spiral segment approximated by splines. For segments <90 degrees this is a very good approximation of an arc or a spiral. The maneuver has a constant angular velocity, the axis of the spiral is defined relative to the current x,y,z,yaw setpoint (such that all the parameters fit into a single packet). Internally, the piecewise_plan_7th_order_no_jerk planner is reused.

The parameters are described below:

  • phi: spiral angle (rad)
  • r0: initial radius (m)
  • rF: final radius (m)
  • ascent: altitude gain (m)
  • duration_s: time it should take to reach the end of the spiral (s)
  • sideways: true if crazyflie should spiral sideways instead of forward
  • clockwise: true if crazyflie should spiral clockwise instead of counter-clockwise
    HL_spiral

@matejkarasek
Copy link
Contributor Author

Here a comparison of the xy trajectories between ideal circular arcs and the HL commander segments from the current implementation:

90 degrees
90deg

180 degrees
180deg

360 degrees
360deg

@knmcguire
Copy link
Member

knmcguire commented Sep 11, 2024

@whoenig or @jpreiss. Do you have time to pitch in on this functionality? It goes with the cflib (see this PR bitcraze/crazyflie-lib-python#470) but this would also require a change in the cpp link in crazyswarm2 then as well

@knmcguire
Copy link
Member

The current build issues is because of the cflib not being up to date, but this is a bit of an API breaking change (or rather crtp). Wonder if it might be better to make this another type of message? Let's wait to see what the others say.

@whoenig
Copy link
Contributor

whoenig commented Sep 11, 2024

Generally, CRTP breaking changes are not allowed. We can add a new message and deprecate the old one (and eventually remove the old one). Any (CRTP) API change should also bump up the "protocol version", so that clients can easily know which functionality might be available.

Otherwise I do like these additional features, of course!

@matejkarasek
Copy link
Contributor Author

Thanks for the quick pre-review!
Ok, so I will introduce a GOTO2 instead

@matejkarasek
Copy link
Contributor Author

So I added a GOTO2 while keeping GOTO in the firmware.

Tested on a crazyflie 2.1

Also increased the CRTP protocol version by 1.

What is the policy with deprecation/removal, i.e. how long do we keep the deprecated message?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants