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
Contributor

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 requested review from tridge and rmackay9 May 25, 2019

@IamPete1 IamPete1 force-pushed the IamPete1:sitl_waves branch from 84a2fb3 to 147e122 May 25, 2019

@IamPete1 IamPete1 force-pushed the IamPete1:sitl_waves branch from 147e122 to c1f96ea May 27, 2019

@IamPete1 IamPete1 changed the title SITL: sailboat: add waves and throttle SITL: sailboat: add waves, tides and throttle May 27, 2019

@IamPete1

This comment has been minimized.

Copy link
Contributor Author

commented May 27, 2019

rebased and added tides

@rmackay9

This comment has been minimized.

Copy link
Contributor

commented Jun 3, 2019

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

@IamPete1 IamPete1 force-pushed the IamPete1:sitl_waves branch from c1f96ea to f7cad92 Jul 31, 2019

@IamPete1

This comment has been minimized.

Copy link
Contributor Author

commented Jul 31, 2019

rebased

@rmackay9

This comment has been minimized.

Copy link
Contributor

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 IamPete1 force-pushed the IamPete1:sitl_waves branch from f7cad92 to 4a470c7 Aug 6, 2019

@IamPete1

This comment has been minimized.

Copy link
Contributor Author

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

This comment has been minimized.

Copy link
Contributor

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 IamPete1 force-pushed the IamPete1:sitl_waves branch from 4a470c7 to ae1f9a6 Aug 10, 2019

@IamPete1

This comment has been minimized.

Copy link
Contributor Author

commented Aug 10, 2019

@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 IamPete1 force-pushed the IamPete1:sitl_waves branch from 26a8fe9 to 01fd94b Aug 13, 2019

@IamPete1

This comment has been minimized.

Copy link
Contributor Author

commented Aug 13, 2019

@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

4 checks passed

ArduPilot.ardupilot Build #20190813.21 succeeded
Details
ArduPilot.ardupilot (Cygwin SITL build) Cygwin SITL build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
semaphoreci The build passed on Semaphore.
Details
@rmackay9

This comment has been minimized.

Copy link
Contributor

commented Aug 14, 2019

Looking good, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.