Skip to content

Add gazebo catapult plugin#51

Draft
41Mo wants to merge 5 commits intoArduPilot:mainfrom
41Mo:pr-catapult-plugin
Draft

Add gazebo catapult plugin#51
41Mo wants to merge 5 commits intoArduPilot:mainfrom
41Mo:pr-catapult-plugin

Conversation

@41Mo
Copy link
Copy Markdown
Contributor

@41Mo 41Mo commented Apr 3, 2023

Add support for a catapult via the catapult plugin.

This plugin will be useful for testing takeoff modes and will simplify usage of zephyr model e.g. #39

Details:

The catapult plugin implemented using a detachable joint system.

The plugin should be added directly to one of the models, either the Launchpad/catapult or the vehicle.

For example, in the case of the Zephyr Delta Wing model:

<plugin filename="libCatapultPlugin.so" name="CatapultPlugin">
  <direction>0.7 0 0.3</direction>
  <force_magnitude>100.0</force_magnitude>
  <launch_duration>0.5</launch_duration>
  <vehicle_link>zephyr::wing</vehicle_link>
  <catapult_link>launchpad::base_link</catapult_link>
</plugin>

In this example, the plugin is added to the zephyr_catapult.sdf, which includes zephyr.sdf. Therefore, we should use the fully qualified name zephyr::wing inside the vehicle_link parameter. The catapult_link parameter should be done similarly.

The direction parameter is a three-component vector that describes the direction of the force applied by the catapult.

The final force applied by the catapult is calculated as force_magnitude * direction, and it is applied to the vehicle during the launch_duration.

Testing

Gazebo

gz sim -r -v4 zephyr_catapult.sdf

SITL

./Tools/autotest/sim_vehicle.py -v ArduPlane -f gazebo-zephyr --model JSON --map --console

Se takeoff mode and arm

mode takeoff
arm throttle

Gazebo

publish message to topic

gz topic -t "/model/zephyr_with_catapult/catapult/cmd_release" -m gz.msgs.Empty -p "unused: true"

Launching with ardupilot plugin enabled:

2023-04-03_22-18-28.mp4

Launching without ardupilot plugin enabled.

2023-04-03_22-20-25.mp4

Current ISSUES/TODOS

  1. Allow user to launch vehicle using gui plugin or servo command. I don't know which is better solution.
  2. Document code.
  3. Add implemetnation for Reset() method.
  4. Add nice model to catapult.
  5. Find way how to simulate bungee.

@41Mo 41Mo force-pushed the pr-catapult-plugin branch from 0bdb1b9 to df7fbb1 Compare April 3, 2023 19:34
@srmainwaring srmainwaring self-requested a review April 11, 2023 20:41
@srmainwaring srmainwaring added the enhancement New feature or request label Apr 11, 2023
@srmainwaring srmainwaring self-assigned this Apr 11, 2023
@srmainwaring
Copy link
Copy Markdown
Collaborator

srmainwaring commented May 11, 2023

@41Mo, could you please rebase your PR on main. Apologies for the delay in the review.

@41Mo
Copy link
Copy Markdown
Contributor Author

41Mo commented May 11, 2023

@srmainwaring yeah, ofcourse.
This PR is still in draft state, I made some modifications locally to calculate force using desired acceleration. But it's incomplete.

@srmainwaring
Copy link
Copy Markdown
Collaborator

srmainwaring commented May 11, 2023

This PR is still in draft state

Ok - I'll mark as draft and wait for your request before reviewing.

My rebased branch is here: https://github.com/srmainwaring/ardupilot_gazebo-1/tree/review/pr-catapult-plugin. It's the CMakeLists.txt that is conflicted.

@srmainwaring srmainwaring marked this pull request as draft May 11, 2023 17:32
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 this pull request may close these issues.

2 participants