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

Add feature / plugin for parachute testing #33

Closed
41Mo opened this issue Dec 15, 2022 · 9 comments · Fixed by #36
Closed

Add feature / plugin for parachute testing #33

41Mo opened this issue Dec 15, 2022 · 9 comments · Fixed by #36
Assignees
Labels
enhancement New feature or request

Comments

@41Mo
Copy link
Contributor

41Mo commented Dec 15, 2022

Feature request

It would be nice to be able to test parachute release with gazebo.

We could make something similar
px4 gazebo plugins already have this feature, but for gazebo-classic

I have made my own implementation, but its poorly written
ParachutePlugin.cc

Platform
[ ] All
[ ] AntennaTracker
[ ✓ ] Copter
[ ✓ ] Plane
[ ] Rover
[ ] Submarine

@srmainwaring srmainwaring added the enhancement New feature or request label Dec 16, 2022
@srmainwaring
Copy link
Collaborator

srmainwaring commented Dec 16, 2022

@41Mo, if you rebase your topic branch https://github.com/41Mo/ardupilot_gazebo/tree/parachute on main I'd be happy to work on this with you. It would be great to expand the range of ArduPilot features available in Gazebo.

Not a hard requirement, but if you could name your topic branches:

<username>/topic (eg. 41Mo/parachute)

that helps keep things organised on my side when I pull your branch in for review.

Edit

Rebased version here - https://github.com/srmainwaring/ardupilot_gazebo-1/tree/41Mo/parachute

@srmainwaring srmainwaring mentioned this issue Dec 16, 2022
6 tasks
@srmainwaring srmainwaring changed the title Add fetature/plugin for parachute testing Add feature / plugin for parachute testing Dec 16, 2022
@srmainwaring
Copy link
Collaborator

Initial thoughts:

  1. ArduPilotPlugin.cc

We can reuse the existing COMMAND control type for the parachute deployment. This was added to forward PWM levels onto the thruster plugin for a ROV, but I think we can use the same approach here rather than add a new command type and additional fields to the <control> element. The parachute plugin would then decide how to interpret the forwarded PWM level (i.e. high for deploy or whatever).

The following would send the output of SERVO5 onto zephyr/parachute/deploy:

<plugin name="ArduPilotPlugin" filename="libArduPilotPlugin">
  ...   
  <control channel="4">
    ...
    <type>COMMAND</type>
    <cmd_topic>zephyr/parachute/deploy</cmd_topic>
    ...
  </control>
</plugin>
  1. ParachutePlugin.cc

It may not scale well having this plugin attached to the world. The parachute is attached to a model, so the plugin should be too. Still working through the implementation details so will update this section in due course...

@41Mo
Copy link
Contributor Author

41Mo commented Dec 16, 2022

I completely agree.
I originally created this as a POC, and my knowledge with gazebo plugins is not good enough.
When you will be ready with your thoughts i can create a draft pr.
Or if the whole implementation will be drastically changed you can create a PR and I will try to be helpful

@srmainwaring
Copy link
Collaborator

It looks like a good start - I don't think the COMMAND type was there when you developed the plugin.

I'll experiment with what you've done to see if I can get the plugin localised to a model. Would you mind jotting down some instructions how to run an example - I'm not familiar with the parachute deployment function in ArduPilot. A list of terminal and mavproxy commands would be a great help.

@srmainwaring
Copy link
Collaborator

srmainwaring commented Dec 17, 2022

@41Mo, I have a slightly modified version of your plugin running - it's very nice! Great work with the detachable joints.

I've made a few cosmetic changes - mainly moving implementation details into a private class in the C++ file and some formatting details to keep cpplint happy.

Next steps:

  • Make the changes to use the COMMAND keyword so are no changes are required to ArduPilotPlugin.cc and all state logic is managed in ParachutePlugin.cc.
  • Make ParachutePlugin a model plugin attached to the Zephyr rather than the world.
  • SDF param name changes - we can probably refer to the vehicle link and parachute link concretely rather than in the abstract as parent and child.
  • Try using a universal joint (or equiv) rather than fixed. This should let the vehicle pivot under the parachute more naturally.
  • General review of the state transitions and document some tests to verify it's all working.

Figure: Initial version of parachute plugin. Parachute pose is not correct, but model is being created on manual trigger and parachute drag is apparent.

parachute_test_1-2_480p.mov

@41Mo
Copy link
Contributor Author

41Mo commented Dec 17, 2022

Glad to hear it.
Good job!

@srmainwaring
Copy link
Collaborator

@41Mo - posted a PR building on your initial version. Would appreciate your feedback and testing if you get a chance. It's stripped down to minimal functionality. Can add the detach commands back in if required (but I don't think ArduPilot supports that - so I left it out of this version).

@41Mo
Copy link
Contributor Author

41Mo commented Dec 19, 2022

@srmainwaring
Perfect.
I will try to give feedback this week.

Detach is not required.
I have implemented this function to test decouple feature of my aircraft.

@srmainwaring
Copy link
Collaborator

Thanks. The main issue I found was that for certain choices of the release pose the collision engine would crash (hard assert and exit signal). I think this was because the original inertial for the parachute resulted in an instability arising from the impulse generated if the chute and vehicle collided before the joint was created - setting a pose directly rather than indirectly through applied forces can sometimes cause these instabilities. I reworked the collision (it is now a sphere with diameter of the canopy) and recalculated the inertial and set the CoM at the collision origin. This seems to have fixed the issue, but would be interested to know if it breaks for some inputs choices.

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

Successfully merging a pull request may close this issue.

2 participants