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

SITL: sailboat: add waves, tides and throttle #11408

Merged
merged 2 commits into from
Aug 14, 2019

Conversation

IamPete1
Copy link
Member

@IamPete1 IamPete1 commented May 25, 2019

This adds a basic wave simulation to the sailboat SITL.
There is a enable parameter:
0 = no waves
1 = roll and pitch from waves, this works reasonably well
2 = roll, pitch + heave, this works ok sometimes, but can start to do some funny stuff in larger waves.

There are also parameters for wave length, height, direction and speed.

I think the roll and pitch is the main thing, the purpose for adding waves is to try and classify the sea state in the main code, I think the accuracy of altitude measurement would make it very hard to use to calculate the wave height on a real vehicle.

I have also given the sailboat SITL model a throttle and a parameter to turn it on and off. This will be used for testing the motor sailing functionality that will be added in the future.

@IamPete1 IamPete1 added Rover GSoC Google Summer of Code labels May 25, 2019
@IamPete1 IamPete1 requested review from tridge and rmackay9 May 25, 2019 14:54
@IamPete1 IamPete1 changed the title SITL: sailboat: add waves and throttle SITL: sailboat: add waves, tides and throttle May 27, 2019
@IamPete1
Copy link
Member Author

rebased and added tides

@rmackay9
Copy link
Contributor

rmackay9 commented Jun 3, 2019

LGTM, I'm not a SITL expert so I might as if @peterbarker or @tridge can give some feedback..

@IamPete1
Copy link
Member Author

rebased

@rmackay9
Copy link
Contributor

rmackay9 commented Aug 6, 2019

@IamPete1, I tested this today and it generally worked but I found one problem. If I set the SIM_WAVE_ENABLE = 1, wait for the vehicle to roll or pitch, then set SIM_WAVE_ENABLE = 0 the vehicle doesn't return to it's upright position. It seems to keep the attitude from the moment the waves were disabled.

I had a quick look at the code and I couldn't figure out what was going wrong but if you give me a hint as to how to fix it I could try to resolve it be merging.

@IamPete1
Copy link
Member Author

IamPete1 commented Aug 6, 2019

@rmackay9 I have rebased and added a new commit that should fix the run-time disable issue, although I have not tested it.

@rmackay9
Copy link
Contributor

rmackay9 commented Aug 7, 2019

@IamPete1, great, thanks for that. I've squashed some commits and moved to this new PR. #11986

I've done this because I'd like to get in the non-controversial parts quickly.

Re the motor support, how about if the sailboat simulator always supports a motor so that we can remove the new SAIL_OPTS parameter?

Normally we don't require setting a simulator parameter to configure the vehicle. So for example we have skid-steering and ackerman rovers.. but the user decides which they are using by providing a parameter to sim_vehicle.py. They don't decide by setting a SIM_xx parameter.

If we get rid of the SAIL_OPTS parameter we would need to be a little careful that this doesn't cause the motor to spin in reverse in SITL in cases where we have a sailboat with no motor attached (i.e. SERVOx_FUNCTION = 0). If we are lucky the servo output will be zero instead of a low PWM value and this will allow us to detect that no motor is connected.

@IamPete1
Copy link
Member Author

@rmackay9 I have rebased this so it is only the throttle changes left. We could do a check for throttle > 1000 and remove the throttle output form the sailboat defaults. In either case i guess I should add a new default param file for a motor sailboat. The thought behind SAIL_OPTS was that I can add more bits for enabling wing sails and other things in the future.

@IamPete1
Copy link
Member Author

@rmackay9 This now range checks the throttle rather than uses a parameter, I have updated the sailboat defaults to match and added a sailboat-motor frame that has the motor enabled

@rmackay9 rmackay9 merged commit ac237ee into ArduPilot:master Aug 14, 2019
@rmackay9
Copy link
Contributor

Looking good, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GSoC Google Summer of Code Rover
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants