-
Notifications
You must be signed in to change notification settings - Fork 17.2k
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
Conversation
rebased and added tides |
LGTM, I'm not a SITL expert so I might as if @peterbarker or @tridge can give some feedback.. |
rebased |
@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. |
@rmackay9 I have rebased and added a new commit that should fix the run-time disable issue, although I have not tested it. |
@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. |
@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. |
@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 |
Looking good, thanks! |
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.