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

Contributing Weight-Shift Control Aircraft Model #116

Closed
wants to merge 0 commits into from

Conversation

NDevDrone
Copy link
Contributor

Weight-Shift Aircraft

Model for the Romaeris unmanned weight-shift control (uWSC) electric aircraft.

uWSC_motion

Usage

Gazebo and the plugins should be installed as per the ArduPilot Gazebo Plugin instructions.

Update the GZ_SIM_RESOURCE_PATH to include these models:

export GZ_SIM_RESOURCE_PATH=$GZ_SIM_RESOURCE_PATH:\
$HOME/SITL_Models/Gazebo/models:\
$HOME/SITL_Models/Gazebo/worlds

Run Gazebo

gz sim -v4 -r wsc_aircraft_runway.sdf

Run ArduPilot SITL

sim_vehicle.py -v ArduPlane --model JSON --add-param-file=$HOME/SITL_Models/Gazebo/config/wsc_aircraft.param --console --map

The provided parameter configuration modifies the default plane parameter set to provide automatic flight control mode for the weight-shift aircraft model, as follows:

SERVO1_FUNCTION = 4
SERVO1_REVERSED = 0
SERVO2_FUNCTION = 19
SERVO2_REVERSED = 0
SERVO4_FUNCTION = 21
SERVO4_REVERSED = 0
SERVO5_FUNCTION = 78
SERVO5_REVERSED = 1
SERVO6_FUNCTION = 77
SERVO6_REVERSED = 1
SERVO10_FUNCTION = 74
SERVO10_TRIM = 1100
SERVO11_FUNCTION = 73
SERVO11_TRIM = 1100
INS_ACCOFFS_X   0.001
INS_ACCOFFS_Y   0.001
INS_ACCOFFS_Z   0.001
INS_ACCSCAL_X   1.001
INS_ACCSCAL_Y   1.001
INS_ACCSCAL_Z   1.001
INS_ACC2OFFS_X   0.001
INS_ACC2OFFS_Y   0.001
INS_ACC2OFFS_Z   0.001
INS_ACC2SCAL_X   1.001
INS_ACC2SCAL_Y   1.001
INS_ACC2SCAL_Z   1.001
INS_GYR_CAL      0
ARSPD_TYPE 0
BATT_MONITOR    4
RUDD_DT_GAIN = 1
LIM_PITCH_MAX = 2700
LIM_PITCH_MIN = -1000
LIM_ROLL_CD 2000
MIS_TOTAL = 413
NAVL1_DAMPING = 0.85
NAVL1_PERIOD = 50
RLL_RATE_P = 0.5
SIM_SAFETY_STATE = 2
WP_RADIUS = 10

uWSC_gasplume

Included camera gimbal demo

The model includes a 3-axis camera gimbal implementation that makes use of the Ardupilot 3-axis gimbal controls.
GimbalDemo

Notes

  • The uWSC model flies by the principles of weight-shift flight control inherent to hang-gliders and ultralight/microlight air-trikes.
  • The uWSC model is composed of two bodies; the flying wing, and an attached mass that hangs beneath the wing including batteries and propulsion.
  • The flying wing is a rigid approximation of a typical flexible hang-glider wing, with four surfaces sections that mimic the aerodynamic characteristics of washout and wing twist.
  • The servo input of conventional control surfaces is replaced by the actuation of a two revolute axis (2R) joint called the 'hang-block', that shifts position of the weight beneath the wing.
  • The flying wing attitude is controlled by default plane PID controllers for pitch and roll, where control input induces weight-shift of the net center of gravity.

Modelling and comparison to real weight-shift flight

Information on the aircraft model's body dynamics, aerodynamics, and comparison of the model fidelity with real weight-shift flight data can be found in the forthcoming conference paper titled "uWSC Aircraft Simulator: A Gazebo-based model for uncrewed weight-shift control aircraft flight simulation" that may be cited as follows:

  • Mailhot, N., de Jesus Krings, T., Tuta Navajas, G., Zhou, B., & Spinello, D. (2023). uWSC Aircraft Simulator: A Gazebo-based model for uncrewed weight-shift control aircraft flight simulation. 2023 IEEE Symposium on Robotics and Sensors Environments (ROSE), Tokyo, Japan.
@INPROCEEDINGS{uWSCAircraftSimulator2023,
	title = {{uWSC} {Aircraft} {Simulator}: {A} {Gazebo}-based model for uncrewed weight-shift control aircraft flight simulation},
	booktitle = {2023 IEEE Symposium on Robotics and Sensors Environments (ROSE)},
	author = {Nathaniel, Mailhot and Teresa, de Jesus Krings and Gilmar, Tuta Navajas and Boyan, Zhou and Davide, Spinello},
	month = nov,
	year = {2023},
}

Credits

  • The model is based on the Romaeris Corporations' unmanned weight-shift aircraft prototype called the "Romaeris eUAV".
  • Contributors: Nathaniel Mailhot, Trevor Phair, Boyan Zhou, Teresa de Jesus Krings, and Gilmar Tuta Navajas.
  • Please feel free to e-mail nmailhot@uottawa.ca for any questions pertaining to this work.

@NDevDrone
Copy link
Contributor Author

Hello @srmainwaring, here is my attempt at the PR to contribute the weight-shift control aircraft model.

The primary contributions can be found in the models and world folders. I also drafted a doc file that I left at the top level of the repo instead of the doc directory like it probably should be.

If these were to merge, I think you would want to move the doc file to the correct directory and delete the readme file I have for my fork (which is a copy of the doc file).

@NDevDrone NDevDrone marked this pull request as ready for review January 18, 2024 14:25
@srmainwaring
Copy link
Collaborator

Hi @NDevDrone - great addition! I'm looking forward to running this. A couple of quick change requests:

  • Remove the .DS_Store files from the commit - you may want to add these to your global .gitignore.
  • The docs should go under the SITL_Models/Gazebo/docs folder.

@NDevDrone
Copy link
Contributor Author

Hi @srmainwaring, just did that!

Let me know if there is anything else to get it right.

Cheers.

@srmainwaring
Copy link
Collaborator

srmainwaring commented Jan 19, 2024

Let me know if there is anything else to get it right.

I've got the simulation running and it's working well - I really like the model.

I'll go through the model file in detail, but the major question I have is about the model orientation. It seems that the model axis is rotated 90 deg about z (so y is forward rather than x). There are offsets in the IMU sensor pose and ardupilot plugin poses to correct for this, but was there a reason for not aligning the model so that x-forward, y-left, z-up (this is the ROS REP 105 frame orientation convention)?

Unfortunately the zephr model in the ardupilot_gazebo repo is similarly aligned. This was inherited from the original model prior to modification to work with ArduPilot. I should change it as it is not a good example for setting up a ROS compliant vehicle.

If it's a major re-work to change the model to standard orientation we can do it in a follow up, but it would make integration with ROS 2 easier if the REP 105 conventions were applied from the outset (if that's something you have in mind for later).

I needed to set the pitch to an adjusted trim (rc 2 1552 IIRC) in order to arm the model - could you add a note in the model doc to advise on this and additional RC settings needed.

@NDevDrone
Copy link
Contributor Author

NDevDrone commented Jan 20, 2024

I've got the simulation running and it's working well - I really like the model.

You happen to be our first external collaborator to try it out, so that's a relief! Thank you! As far as I know this is the first weight-shift aircraft of its kind implemented within Gazebo.

rotated 90 deg about z (so y is forward rather than x).

You're correct. This is a leftover quirk from how we started with the zephyr model as the starting reference, otherwise not an intentional choice.

If it's a major re-work to change the model to standard orientation we can do it in a follow up, but it would make integration with ROS 2 easier if the REP 105.

I would like to get the model out there, and fix this issue in a follow-up PR. At this present moment on my team's end, there won't be time to spare for a little while to fix it, I am afraid. It is certainly something we intend to do when we can, as we will be looking to develop using the ArduPilot-ROS2 integration in the future.

All that to be said, I'll fix up the doc to add the note like you had asked for arming rc 2 1552. Was there anything else? Or after that do you belief its ready to be merged?

@NDevDrone
Copy link
Contributor Author

NDevDrone commented Jan 20, 2024

Hey @srmainwaring , I added two additional tweaks to the doc file to call out the orientation quirk, and the pitch midpoint arm issue you had mentioned.

Let me know if you identify any other problems. Otherwise, I'd be happy to merge this in its present state. When time allows it we'll try to fix the orientation issue with a revised model, but that might take a little bit of work.

Copy link
Collaborator

@srmainwaring srmainwaring left a comment

Choose a reason for hiding this comment

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

Very nice model, thanks for the PR. There's a few changes to schedule for follow-up but this will be a great addition to the models configured for ArduPilot.

<collision name="wing_root_left_collision">
<geometry>
<mesh>
<uri>model://wsc_aircraft/meshes/wing_root_left.dae</uri>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This and other review comments are 'would be nice to fix' for future PRs but aren't blockers for this one.

May get better physics performance using custom collision meshes. These can either be primitives, or mesh files created by applying a decimation modifier to the original collada mesh. STL format for collisions result in smaller file sizes as it does not carry texture details.

</axis>
</joint>

<joint name="hang_block_joint" type="fixed">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Depending on the physics solver, you may find instabilities with fixed joints. If this is the case replacing fixed joints with revolute joints with limits constrained to [0, 0] can yield better results. Was the case the Gazebo 11 ODE solver - DART may be better. This is why in the ardupilot_gazebo examples a revolute joint is used for the IMU link.

</axis>
</joint>

<!-- Gimbal camera links and joints -->
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is a gimbal_3d_small model available in ardupilot_gazebo that could be used here with an <include> block.


<!-- plugins -->

<plugin filename="libgz-sim-joint-state-publisher-system.so"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can use a short form for the filename: gz-sim-joint-state-publisher-system.

</plugin>

<plugin
filename="ignition-gazebo-forcetorque-system"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Prefer filename="gz-sim-forcetorque-system"

<link_name>fuselage</link_name>
</plugin>

<plugin filename="libgz-sim-apply-joint-force-system.so"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use short form for filename.

<connectionTimeoutMaxCount>5</connectionTimeoutMaxCount>
<lock_step>1</lock_step>

<!-- Frame conventions
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note vehicle orientation is not REP 105 standard.

</plugin>

</model>
</sdf>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add newline at end of files (VScode has a habit of stripping these...).

@srmainwaring
Copy link
Collaborator

srmainwaring commented Jan 20, 2024

@NDevDrone - would you mind squashing the commits into a single commit and force push the update. ArduPilot repos only permit Rebase and merge and squashing keeps master branch cleaner. Also can you make sure to DCO sign the final commit. This is a line containing your name and email at the end of the commit (preceded by an empty line).

Signed-off-by: FirstName LastName <your.email@yourmailserver.com>

Some details from the ArduPilot wiki here:

@srmainwaring
Copy link
Collaborator

srmainwaring commented Jan 21, 2024

@NDevDrone - problem with a force push from me to squash your changes. Don't panic all the changes are here:

I've been reminded the hard way why you never use master for PR's...

I'll submit the PR from the squashed copy above - and reference this issue for details. My apologies for the error.

Merged in #117.

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