I’m also working on a submarine. I thought I’d put my findings here instead of starting a separate thread, so that people searching for this topic can find the info in one place.
Basic Boat
I’m starting from an old Thunder Tiger Neptune kit. This boat looks goofy, but is improbably overengineered. She has a proper WTC and a static diving system with a flexible bladder inside the WTC. She comes stock with a microcontoller board that forces ballast flush in four emergencies: radio signal loss, leak detection, low battery and ballast overpressure. My example came with a 75 MHz, 6-channel radio.
The basic boat works very well. My only complaint is that the dive planes are too small. My solution is to print a set with double the area. Now the boat’s pitch response is excellent.
ArduPilot Installation
Like on a real submarine, there is little free space inside the pressure hull. I have a Matek H734-WLITE controller, a GPS and a Blue Robotics Bar30 water pressure sensor. I also have an 8-pin Cobalt waterproof connector from Blue Trails Engineering. This allows me to charge the battery without opening the pressure hull. The same connector also carries the USB connection to FC.
To feed R/C commands to ArduPilot, I identify the interface between the RF section and the digital domain on the stock 75 MHz receiver. This signal is PPM (a.k.a. “CPPM”, “PPM-sum”). This goes into ArduPilot’s RCIN and works without further modifications (as long as signal is strong–see open issues below).
Open Issues
I’m working on a couple of issues that relate to ArduPilot on this vehicle. From simple to conceptual they are:
Noise rejection in analog PPM
ArduPilot has excellent support for PPM input, but my use case is a little less common. I need longer wavelengths to penetrate underwater. Most users get cPPM from receivers that emulates PPM in software from its digital over-the-air protocol. These receivers generate crisp square waveforms. I’m using the output of an analog RF section on a system that uses PPM as its over-the-air signal. When signal quality degrades, I get noise on the RCIN line, which ArduPilot interprets as wild servo swings. It is a relatively simple software task to reject this noise in software. I have a separate thread on this topic: PPM garbage detection.
Water Pressure Sensor
I am so far unable to read the water pressure sensor. I understand that there is support for it in AP_Baro, and this support exists in ArduSub, but hasn’t made it into other vehicle types yet. There is a bigger question about integrating this sensor into the EKF. It is sort of an altimeter, but the EKF makes assumptions about altimeters being in the air. I need a way to tell the EKF that the sensor is in a denser fluid so it scales the altitude calculation appropriately.
Pitch and Depth Control
There is an open question about the best vehicle type to start from. ArduSub has support for relevant sensors and deals with water density for depth calculations. It is a derivative of ArduCopter, which uses completely different dynamics from a traditional sub. ArduRover has support for boats, including things like station keeping and accounting for currents. It has no support for pitch or depth control. ArduPlane has the closest dynamics model to a submerged traditional sub, including pitch and altitude controllers, but also has many features that are irrelevant. I’m curious how much tuning it would take to get ArduPlane to work in a denser fluid.