Attention all BlueBoaters!
Have you wanted to operate your BlueBoat in heavy seas or breaking waves, but been concerned that it might flip over? Have you sent a (specialized) BlueBoat named the SolarTurtle on a mission to travel from Los Angeles to Hawaii only to have it get flipped and drift to San Diego before being recovered?
Maybe you’ve launched your BlueBoat at a beach, only to have it flip when you were trying to navigate out past the breakers…
Let’s learn how to unlock “honey badger” mode for your BlueBoat, enabling it to automatically flip upright if the vehicle detects it is upside down, in less than a few seconds, with the power of a LUA script. This creates a vehicle that just keeps going - it doesn’t care what the sea state is!
(see a GIF in this presentation - inherently larger than the 4mb image limit!)
We’ve done some (limited) testing with this and been impressed enough with the results that we just had to share this (still early) design! There is still experimentation to be done, such as determining just how short the mounting arm can be before the T500 doesn’t have sufficient leverage to right the BlueBoat…
CAD Model(s) (Onshape - copy and customize!)
3D Printed parts (Printables)
What you'll need
1X T500
1X Basic ESC 500 (standard variant)
1X piece 3/4"x3/4"x3’ aluminum square tubing (I got mine from Home Depot)
1X 3D printed Thruster Mount
1X 3D printed Crossbar Mount (Get both from Printables - PETG is a good filament choice for strength)
2X M8x40 316SS SHCS Bolts
1X M8 Nylon Locknut
4X M4x25 mm SHCS bolts for securing square tubing to mounts
2X M4x30 mm SHCS bolts to secure T500 to mount
2X servo extensions - ~1.5m length of 20-28 gauge wire, terminated with Servo-style 3 position 0.1mm header on both ends (Male on one end, female on the other - easy to make or buy)
Zip ties - what project doesn’t need a few of these?
Tools
3.5 mm Drill bit and Drill
Hack saw or sawz-all / reciprocating saw
Soldering iron (to attach bullet connectors)
5mm Alan key
3mm Alan key
Hot air gun (optional)
Sharpie / marker
Parts oriented for printing (2.5 hours on a Bambu P1P, 4 perimeters, 20% infill):
Instructions
Hardware setup:
Roll up your sleeves....
Internals
-
Solder bullet connectors onto the BasicESC 500 leads and T500 wire-ends.
-
Install the T500 WetLink Penetrator in the port stern penetrator hole.
-
Using the bullet connectors included with the T500 Basic ESC and thruster, connect the ESC to the flipper T500 wires inside the Port electronics tray.
-
Zip tie the ESC500 to the frame, and connect it to power where the existing ESC500 connects with lugs - you should probably do a better job than I did here, and use spade connectors!
-
Take your Servo PWM extension cable (20-28 gauge) and route it from the Port hull, through the cross tube, and connect the female header pin connector to the Navigator at PWM output #5. If you don’t have a coat-hanger to unfold and persuade the cable to go through, the BlueBoat flag pole can work as a tool to make this easier - just feed it through the cross tube (detached from both barbs) and tape the wires to the end so that you can then draw them through.
-
Connect the male header pin to the ESC500 you installed, making sure that you’ve correctly connected ground and signal wires to the Navigator, and not reversed them at either end.
Externals
-
Mount the Crossbar Mount to the center of the rear cross bar - first install a M8 nylock nut oriented to accept the M8 bolts coming through the crossbar. Push the nut into the pocket until it won’t go any farther, and the bolt coming through the crossbar can thread into it. Screw the second bolt through the crossbar at 90 degrees to this, tapping into the plastic of the part.
It may help when going to cut these threads if you heat the bolt with a hot-air gun for 5-10 seconds before screwing it in. Don’t overtighten! -
Slide the Aluminum square tubing into the mount, and with 22" protruding up and behind the boat from the mount, mark the remainder of the tube at the bottom of the mount. Remove and cut along this line with a hack-saw or sawz-all.
-
Attach the T500 to the mount, and secure it with 4x M4x30 bolts.
-
Slide the mount onto the square tubing, orienting as shown for maximum righting force!
-
Drill 2x 3.5mm holes through the mount, and tap the M4x25 bolts into the holes to lock the Thruster in place.
-
Drill 2X M3.5MM holes through the crossbar mount and through the Aluminum tube. Lock this to the crossbar mount with 2x M4x bolts.
You should now have the T500 securely fastened to your BlueBoat!
It is critical that you arrange your batteries or other payloads to offset this weight on the stern. Two batteries placed as far forward in the nose as possible is enough to let the boat sit level in the water!
Software Setup
Break out your computer
-
Open the BlueOS interface and navigate to the File Browser.
-
Go to ardupilot_logs/firmware/scripts, and copy the t500flipper.lua script to the folder. It should look something like this:
-
Edit the Autopilot Parameter for Servo5_Function to RCIN5
-
With the script in place, restart the autopilot (this can be done from the BlueOS power button in the lower left > Restart Autopilot)
t500flipper.lua (1.0 KB)
That’s it! The code is shared for review here as well.
information you want to fold down
Code
function is_upside_down()
-- Check if the vehicle iss upside down
local roll = math.deg(ahrs:get_roll())
return math.abs(roll) > 90
end
local previously_flipped = FALSE
local MODE_HOLD = 4
local RC5 = rc:get_channel(5)
local currentmode
function update()
if not ahrs:initialised() then
return update, 2000
end
if is_upside_down() then
if not previously_upside_down then
local mode_num = vehicle:get_mode()
currentmode = mode_num
gcs:send_text(0, "RC_override flip_over attempted!")
end
vehicle:set_mode(MODE_HOLD)
RC5:set_override(1100)
elseif not is_upside_down() and previously_upside_down then
gcs:send_text(0, "RC_override flip_over cleared!")
-- restore mode
vehicle:set_mode(currentmode)
else
RC5:set_override(1500)
end
previously_upside_down = is_upside_down()
return update, 1000
end
return update() -- run immediately before starting to reschedule
Note that rc:get_channel(5) defines the 5th ESC output to be connected to the T500 used for flipping - if using a different port, change this #.
Testing
Let's Goooo!!
-
If you lift the vehicle so that it goes past 90 degrees on any axis, the T500 on the arm should kick on!
-
Verify that the air moving from it is going in the direction that would push the nose of the BlueBoat downwards:
-
If the direction is not correct, you can either reverse any two of the motor wires going to the T500, change the 1100 to 1900 in the t500flipper.lua file (line 24) or change SERVO5_Reversed parameter to the opposite of its current state.
When the vehicle is again upright, it will revert to the mode it was in previously - so if loitering or doing an AUTO mission, everything would just keep going!
When the vehicle starts up, after you hear the main propulsion motors beep to say they are initialized, you may hear the T500 Flipper continue to beep for a few seconds longer. This is because the AHRS system is not yet reporting that the vehicle is upright, and is expected!
Rest easy, your problem should now be solved! This post is a bit long, but tries to cover all of the nitty-gritty details. Make sure to share your results if you give it a try, or if you get stuck somewhere along the way!
If we see a lot of traffic and excitement around this solution, we could definitely consider creating a standardized, non-3D printed part reliant “kit” for purchase.
I’d love to see some videos of the BlueBoat self-righting in crazy sea states… In the meantime keep those props spinning!