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 Gazebo model for Swan-K1-HWing #77

Merged
merged 1 commit into from Jan 3, 2023

Conversation

srmainwaring
Copy link
Collaborator

@srmainwaring srmainwaring commented May 30, 2022

This draft PR adds a Gazebo model for the Swan-K1-HWing

Figure: Swan-K1 in forward flight. Updated so user content available to reference in model documentation.

swan-k1-hwing-flying

Usage

Ignition and the plugins should be installed as per the ardupilot_gazebo wiki instructions.

Run Gazebo

$ gz sim -v4 -r swan_k1_hwing_runway.sdf

@srmainwaring srmainwaring self-assigned this May 30, 2022
@srmainwaring srmainwaring marked this pull request as draft May 30, 2022 09:56
@tridge
Copy link
Contributor

tridge commented Nov 9, 2022

@srmainwaring ready to merge? maybe squash the commits?

@srmainwaring
Copy link
Collaborator Author

@tridge let me take a look - it's been a while. I marked this as draft for some reason and will need to recall why?

@srmainwaring
Copy link
Collaborator Author

srmainwaring commented Jan 1, 2023

Still an issue with the stability - it appears similar to the problem with the Gazebo model for the Omnicopter. It may be due to the prop modelling - where thrust is generated by treating the rotors as lifting surfaces and applying the lift and drag forces directly to the rotor links. This does cause noise in the joints and that may be more of an issue for certain frame configurations - it is hard to pin down.

An alternative approach is to calculate the prop thrust and torque directly and apply this to the motor links. The rotor spinning is then for visualisation only, not for physics. There is a plugin available in the upstream gz-sim7 package that is similar to the original RotorS plugin - will investigate whether applying this results in a flyable model.

Tasks

  • Investigate alternative prop model / resolve issue with existing model.
  • Add aerodynamics for v-stabs (motor mounts).
  • Tune VTOL.
  • Tune forward flight.
  • Tune VTOL to Fwd transition.
  • Tune Fwd to VTOL transition.
  • Add user document.

Figure: fully configured model as X-frame with motors canted in towards fuselage and out to wingtips. CoM ahead of main wing centre of pressure and markers for centres of pressure for wingtips and vertical stabiliser lift-drag contributions.

swan-k1-hwing-markers

1. add initial model for base / fuselage

2. add mesh for engine and spinner

3. reorient and recentre fuselage mesh
- Orientation should be for normal flight mode (ROS convention x-forward, y-left, z-up)

4. update texture name in motor mesh

5. add ENU axis to runway for orientation

6. add IMU sensor and link

7. fix scaling error in exported fuselage mesh

8. enable IMU link and reorient plane vertically in world

9. add system plugins JointStatePublisher and ApplyJointForce for motors

10. add ardupilot plugin and reassign motor positions to match wiki
- Assign servos according to docs for NYT QUAD X Motor Tailsitter
- Correct plugin comments

11. add sphere collision for legs
- Add sphere collisions for legs to improve performance - mesh collisions need to be replaced.

12. add prop visuals and materials
- Add prop materials and visuals
- Add PBS material for the fuselage

13. add param file from RF model

14. update prop visuals
- Use CCW and CW props visuals as required

15. update param file
- Set SERVOX_FUNCTION as for x-frame, quad
- Set Q_TAILSIT_MOTMX  4

16. update motor and prop collisions and prop orientation
- Temp set prop colours to assist identifying

17. add initial draft of prop lift-drag plugins

18. update motor link and joint poses
- Set motor link relative to joint
- Position joints and rotate into place
- Align motor axis to local +z (simplifies lift-drag plugin config)

19. update inertials
- Reduce mass of fuselage and motors

20. update example world name and increase motor joint damping

21. convert motors to NYT QUAD X Motor Tailsitter config
- Change lift directions on props for altered config
- Add box collision to allow arming in horizontal orientation
- Update params (AHRS_ORIENTATION, Q_FRAME_TYPE, Q_TAILSIT_MOTMX)

22. cant motors from vertical by 10 deg
- cant motors towards wingtips

23. add lift drag and visual markers for wings and winglets

24. revert frame type back to X-Quad
- Motor angle directions are suitable for X-Quad config
- Revert to Q_FRAME_TYPE = 1
- Update RC input limits

25. conservative tune VTOL mode
- Tune Q_A_RAT_RLL_*, Q_A_RAT_PIT_*, Q_A_RAT_YAW_*
- Set I = P = 0.05, D = 0, SMAX = 50
- Disable rudder arm / disarm
- Set ARSPD_TYPE = 0 (no airspeed sensor)
- Set RC2_REVERSED = 0 (was reversed)

26. update for ignition to gz migration.

27. update the Swan-K1 model

- Add vertical stabilisers.
- Update the prop PID controller settings - NB: the command limits.
- Add RTF control to the world file.

28. update the Swan-K1 params

- Auto-tuned VTOL params.
- Match settings from AP defaults.

29. Gazebo: Add model for Swan-K1-HWing

- Update Swan-K1 params, modify forward flight to VT transition params.
- Update Swan-K1 document.
- Update Swan-K1 model visuals.
- Update Swan-K1 documentation.

Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
@srmainwaring srmainwaring marked this pull request as ready for review January 3, 2023 20:06
@srmainwaring
Copy link
Collaborator Author

@tridge - I'll merge this as I've resolved the main issue with the prop model. It's flying with a large AoA in forward flight - which could be resolved by increasing the cruise speed, but I think the real issue is more likely to be short comings in the aerodynamics model. It's operational though, tuned with the Lua VTOL script and running the onboard FFT notch filter - so a nice test ground for a few newer features.

@srmainwaring srmainwaring merged commit d97e2e9 into ArduPilot:master Jan 3, 2023
@srmainwaring srmainwaring deleted the ignition/swan-k1-hwing branch January 3, 2023 20:12
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

2 participants