Omni motor sailing boat

this is my test lua for motor control groups, essentially the idea is to enable and disable motors based on a switch position. it will eventually be expanded to include control rate settings and possibly automatic switching based on battery,speed or esc telemetry parameters.

local SCRIPT_NAME     = 'group motor control.lua'
local RUN_INTERVAL_MS	 = 200
local RC_OPTION   		= 300

local THROTTLE				=70
local THROTTLE_LEFT			=73
local THROTTLE_RIGHT		=74
local OFF					=135
local MOTOR_1				=33
local MOTOR_2				=34
local MOTOR_3				=35


local MAV_SEVERITY_INFO      = 6

-- wrapper for gcs:send_text()
local function gcs_msg(severity, txt)
    gcs:send_text(severity, string.format('%s: %s', SCRIPT_NAME, txt))
end

-- ! setup/initialization logic
local rc_chan = rc:find_channel_for_option(RC_OPTION)
local last_sw_pos = nil

function update()
    local sw_pos = rc_chan:get_aux_switch_pos()  -- returns 0, 1, or 2

    -- added this line to make things cleaner than YouTube demo script
    if sw_pos == last_sw_pos then return update, RUN_INTERVAL_MS end

    if sw_pos == 0 then
		param:set('SERVO1_FUNCTION', OFF)
		param:set('SERVO2_FUNCTION', OFF)
		param:set('SERVO3_FUNCTION', OFF)

		param:set('SERVO13_FUNCTION', THROTTLE)
		param:set('SERVO14_FUNCTION', THROTTLE)
	)
		gcs_msg(MAV_SEVERITY_INFO, 'Ackermann  ')
		
	if sw_pos == 1 then
		param:set('SERVO1_FUNCTION', OFF)
		param:set('SERVO2_FUNCTION', OFF)
		param:set('SERVO3_FUNCTION', OFF)
		
		param:set('SERVO13_FUNCTION', THROTTLE_LEFT)
		param:set('SERVO14_FUNCTION', THROTTLE_RIGHT)
		
		gcs_msg(MAV_SEVERITY_INFO, 'skid-steering')
		
		
    else
		
		param:set('SERVO1_FUNCTION', MOTOR_1)
		param:set('SERVO2_FUNCTION', MOTOR_2)
		param:set('SERVO3_FUNCTION', MOTOR_3)
		
		param:set('SERVO13_FUNCTION', OFF)
		param:set('SERVO14_FUNCTION', OFF)
		gcs_msg(MAV_SEVERITY_INFO, 'OMNI')
    end

    last_sw_pos = sw_pos

    return update, RUN_INTERVAL_MS
end

gcs_msg(MAV_SEVERITY_INFO, 'Initialized.')

return update()

The 4 sonars are finally all wired in along with one of Yuri_Rages sensor adapter boards, the bilge water sensor and the AIS receiver.



Power box is also done, it was supposed to have more sensors in it but i have moved some functionallity like the power monitoring of the solar panels to the can node on the deck.


I installed a super capacitor on the servo 5v rail to smooth out any surges and i added a hall current sensor to monitor the current from the thruster pumps.

2 Likes

I have started assembling the phased sonar array. I should hopefully have something working soon.

1 Like

That is super cool, please post updates when you get it working!

Making some progress on the phased array, its working kind of.

1 Like

I have shelved the phased sonar for now, its extremely complicated and its going to take time to figure out, so the next idea was a mechanically rotating scanning sonar, using count74s code as a start I replaced the stepper motor code with servo code and replaced the LIDAR code with serial sonar code. This gave me a waterproof rotating rangefinder that I can run in a number of ways. Because im using the feedback pin to set the rangefinder orientation rather than the servo input it means I can use other inputs to drive the rangefinder scan like camera following or direct rc control.



first attempt just got the 8 segments but after adding a heart beat I got the 72 segment

the plan now is to 3d print something more hydrodynamic so when I rotate the sonar transducer the boat doesn’t weave from side to side the plan is to mount the sonar transducer it on the end of a brass tube under the boat driven by a servo using a belt to increase the angle so i can use a regular servo.


my next design will have the transducer embedded into it rather than on the end, this “tube” should focus the sonar on a much smaller field of view giving much more accurate returns.

1 Like

Great job! It turns out one such bundle (servo and echo sounder) can cover a sector of 180 degrees.

1 Like

The only thing that such a sonar needs to be located at the ends of the vessel.

With it mounted on the front i should be able to get around 300 degrees of coverage before the keel gets in the way using a 1:2 ratio on the belt. I looked at some kind of telescopic system that would let me lower it down under the keel but i couldnt think of a simple way of doing it.

1 Like

I have a prototype made using a transducer from a AJ-SR04M waterproof sensor. Its very similar to the JSN-SR04 apart from the transducer has a flat face rather than being tilted up slightly making it better suited for this application.

The idea is that by embedding the transducer into the sonar it should form more of a beam giving more accurate ranging.


1 Like

wrote an arduino adapter to hopefully convert the HLD-LD303 Radar to maxbotix i2c similar to how i have done the sonar adapter, its a very short range radar, only 3m or so but it should be ideal for short range on water or as a landing radar or aircraft. i should have more results when it arrives

1 Like

I have been really busy for the last few months and the weather has been terrible so i havent made much progress, its currently got a coat of primer on it waiting for a proper paint job, unfortunately i dont have anywhere indoors I can spray paint so its been on the back burner for now till better weather arrives.

A major issue i was running into was with my radio (taranis x9d) lacking enough switches to operate all the functions that i was adding to it, It has enough channels but just not enough buttons etc to actually work them all. so i have been watching out for a few radio to be able to operate it and i finally got it.

The X9E :slight_smile: should give me more than enough switches and knobs to run all the accessories i want.

I have been modifying my x9e, it’s now got 4d gimbals, more switches, 3d printed 18650 holder, usb charger, type C usb port for charging and data.

I removed the centering spring on the throttle stick and added some heatshrink to the stick to add enough friction that it won’t flop around.

there is a 3 pole switch on the back of the radio, this is to install dual internal radio modules, specifically a 4 in 1 multimodule and a frsky R9M module running mLRS, the switch switches VCC, PPM and S.port pins between the 2 modules allowing both to be installed and switched between.

2 Likes

This project hit some roadblocks, so I have had to try and tackle the problems individually rather than all together on this boat.

The first issue is that the pixahawk it was built around is not really supported properly any more, It cant run lua scripts meaning I cant operate it like i wanted to. The scripts I have for disabling motors to sail and shallow water avoid wont run any more, so it will need to be upgraded to a H7 board, meaning essentially a complete rewire.

Power management on the vehicle was much harder than I expected. There are a lot of components using a lot of power, so I need to rebuild the power system to be able to switch them for finer control.

ardupilot can get weird if you leave it on for weeks at a time and I had no way of hard rebooting it remotely if I lost communication.

Canbus nodes were just on the market when I installed it and there were a lot of little issues that caused problems like rangefinders not working.

Asymmetric propeller compensation had not been added yet so it would always try and go forward instead of turning on the spot as i couldnt limit the range since I was using Dshot to get motor telemetry

the X9D radio i had been using just didnt have enough switches and the Openlrs modules I was using for RC and Telemetry were still having problems intermittently loosing settings.

Andruav I was using for 4G connection was having a lot of Issues, especially when trying to connect via USB, would intermittently loose connection and would not reconnect without physically replugging it. I also discovered that It has issues with the video encoder on samsung phones.

so to try and work out these problems I have build 4 other machines that integrate most of the ideas and tech from this boat but in a way thats easier to test.

The first was the big solar rover, this is designed to try and work out the power and communications issues that I was having but without having to go to water.

It has a h7 controller upgrade, an ESP32 for monitoring power, changed the phone to a Huawei mate m20, changed the openLRS running on the orange 433 modules to MLRS running on FRSKY R9 modules .

Then I let it sit in the garden. This is when I discovered issues with ardupilot getting strange, I checked it one day to see the artificial horizon on mission planner spinning and the flight controller needing rebooted to stop. There was other issues with the phone randomly loosing connection but I narrowed it down to a dodgey OTG adapter. I changed the phone from the sameung and then discovered another issue with the software I was using to control the phone randomly stopping, turns out Huawei phones kill apps to save power. I managed to disable the Huawei power saving but the usb is still intermittent so I have installed a backup bluetooth serial adapter that appears to be far more stable than the usb. I will probably change it for a wifi adapter so it just connects to the phone hotspot.

I am planning on adding a companion computer like a esp32 or arduino that i can use as a backup system to control and as a watchdog to switch components off and on if they get unresponsive essentially can act as the management and It can also switch everything off and go to sleep if the battery gets too low minimizing power consumption overnight.

Unfortunately the winter arrived and there just is not enough sun to keep this alive even without moving so its in storage until the spring when it will get a rewire to add fine power control and sent out for more testing.

The second vehicle is a RTR Southampton tug that has been extensively modified, its job is testing the propulsion systems, depth sounders, MLRS RC and telemetry, proximity, AI and general operating ardurover on water.

It has been converted to the same brushless motors, escs and waterjets of the omni boat, Mlrs RC and telemetry, the same sonar depth sounder, and a mavlink VL53l1x lidar proximity driven by a servo. Its only running an omnubus f4 controller but that might get upgraded at some point for running lua.

It had its first test in auto mode today, its very badly tuned but it was able to loiter and RTL.

Vehicle 3 is essentially a small version of the solar rover without the solar systems.
This is specifically for testing andruav and proximity systems, I needed something i could test on land that could fit on pavements and since there is no sun solar was pointless so it just has a very large 48v 20ah battery to keep it running, its done around 8 miles so far driving around town testing the phone signals to see how it handled switching phone networks. its also going to be the frst test bed for the AI camera system.


vehicle 4 is a large RC yacht the plan is for this to be used for testing the sailing parts of the system. I bought it used essentially ready to run so it just needs a flight controller installed and its good to go.

I have been working on an AI camera system for it, the system is still in early stages but i have an OSD and its sending data to the flight controller .


The long term goal is to eventually build a larger boat that i can set out to sea to go around the islands on the west coast of Scotland, most are inhabited and have mobile signal so I should have continuous coverage.

3 Likes

I have went ahead and started to upgrade the tugboat to the Matek H743-WLITE, The OmnibusF4pro V2 that I was using was just lacking ports, I just couldn’t connect everything with only 3 serial ports and 5 servo outputs.

It has been fitted with a bilge pump using the button input for the water sensor and relay function to operate the pump automatically.

With the H743 and its additional serial ports I have been able to connect the telemetry from the BLHELI32 ESCs and enable Dshot but the motors started behaving really strange, one would stop and make a loud whining noise, something that never happened in standard PWM mode. turns out the rover firmware runs dshot at a much lower rate, i needed to go into the parameters and change SERVO_DSHOT_RATE to 1 or you just get motor issues.

the proximity system has been upgraded from the VL53l1x mounted on a servo to a 64 beam 8x8 L53L5CX lidar array, I am currently just using a single row of lasers but the plan is to eventually select what lasers are used based on the orientation of the vehicle so that its always using a flat line , so if it pitches forward it will use higher up lasers, if it pitches back it will use lower lasters, if it rolls then it will raise one side and lower the other side so that it never picks up the water as it moves around.

I have fitted a pixhawk aircraft i2c pitot air speed sensor to the bottom of the boat for testing to see if it can be used as a water speed sensor. in theory its should work as long as there is a pressure difference my only worry is it getting blocked.


I have added a lot of effects and other devices like, navigation lights , smoke, engine sounds, multiple horns ,anchor winch, towing winch, panning forward camera, reverse camera, underwater camera, underwater lights,crane but i was running out of channels to be able to operate them, 16 channels just wasnt enough so i have designed a mavlink channel expander. Basically it can encode multiple low resolution channels onto a single rc channel using either a lua script or logical switches letting you control potentially dozens of devices with just a single RC channel. I got the idea from the old futaba f14 tray radios, you could get a channel expander that plugged into one of the servo channels and let you run lots of switches, so after some thinking about how they could do something like that with old analogue systems i realized that they must be pulsing values. so essentially we break up the 1000-2000us servo range into discrete values then we assign the value to an action. the limitation is that the more devices you have the longer it will take to switch as it has to cycle through all the channels but for inconsequential devices like lights and effects its fine.


 if (FUNCTION <= 1000) {
    fwinch.writeMicroseconds(PWMMid);
    twinch.writeMicroseconds(PWMMid);
  }
  if (FUNCTION > 1001 && FUNCTION < 1049) {

    Serial.println("SMOKE OFF");
    smoke.writeMicroseconds(PWMLow);
    THRM = 0;
  }
  if (FUNCTION > 1051 && FUNCTION < 1100) {
    THRM = 1;
    Serial.println("SMOKE FULL");
    smoke.writeMicroseconds(PWMHigh);

  }
  if (FUNCTION > 1101 && FUNCTION < 1149) {
    THRM = 2;
    Serial.println("SMOKE THRM");
    smoke.writeMicroseconds(PWMHigh);

for sounds the expander is just triggering this mp3 player in IO mode so pulls pin 1 down for horn 1. I used this module so that i can connect other modules in the boat to it. so I can control 3 horns with RC but I also want it to make it play a sound when the Ai camera detects something.

next steps are

fitting the optical flow sensor, I am going to fit a window to the bottom of the hull for the optical flow camera, I want to see if it can hold position by being able to see the bottom of the pond. I have a px4 flow and a cheerson OF sensors to test.

I have a modern devices hot wire wind speed sensor to test on it .

i want to do somekind of lane keeping system that can follow a wall, so it can go around the edge of a pond without waypoints.

3 Likes

I have been working on a better way of logging and communicating with the boat, my plan is to get it sending and receiving data from a domoticz home automation controller so it can check the state of switches, receive data and commands and upload sensor data like gps and battery.

I can also make a virtual control panel that should allow me to control almost all functions.

I have wrote a mavlink to json adapter to take mavlink data and upload it to the controller over the internet via wifi. my thoughts are that it would be very easy to adapt to other connections with low bandwidth like satellite or 2g.

This also gets around the need for routing since the rover is requesting the data rather then having to open a port.

1 Like

Had the tugboat out for its first test with ardurover since I installed the h743. cameras worked great but I didnt get to do much testing as my phone battery ran out and the proximity wasnt set up correctly so it would just go full reverse whenever I enabled any mode other than manual. There was also a small leak from the rear thruster intake.

Next time out it’s going to have the water speed sensor and depth sounder working on the osd along with the proximity configured so it can actually move forward.

one thing i did notice is how murky the water is, im not sure if optical flow is going to be any use unless its really shallow.

1 Like

I forgot to set the throttle limits due to enabling Dshot in order to get motor telemetry. it was a little faster than it should have been…

1 Like

Ha, ha. I have been on a very large Tug Boat at full throttle for powertrain testing and you don’t have scale power there :slight_smile: Very nice though!

1 Like

Had the tug out again, this time with the pitot water speed enabled. It needs calibrated when i put it into the water to zero it, but it looks like it’s changing with the speed ok.

My new phone for testing Andruav arrived and its tiny, it reminds me of the tiny nokias from the 90s.

Its a soyes xs16s and its the smallest phone i could find that would run andruav, it works but its not fantastic.

Good points:

Its tiny, about half the width and length of my s10e.
dual sim cards.
Dual band 2.4/5ghz wifi.
Bluetooth.
Runs android 10 and comes with play store

Bad points

2 of the rear cameras are fake
The front and rear cameras are blurry when you move it too fast.
they don’t work in low light at all.
They have a narrow field of view so I have ordered a wide angle smart phone lens that should hopefully make it more usable.
No OTG, so I will need to connect to it via wifi or bluetooth.



I also recently got a new computer for mission planner, i wanted something fast with joysticks so i got a GPD winmax, its basically a 10 inch laptop with a i5 and a built in Xbox controller.


2 Likes