Hello everyone :), I had a question regarding the custom frame in ArduSub, does anyone know if it’s possible to connect two functions to the same motor (AP_MOTORS_MOT_1 and P_MOTORS_MOT_2)? So the idea is that we are building a buoyancy UUV and the idea is that using one motor we can control buoyancy module to let water in or out, but the custom frame only seems to allow the turning of motors in one direction, since we need put put either a static positive or negative float.
Would anyone have an Idea on how to fix this problem? The image might be misleading, since it looks like there are two motors, but in reality I just want to model the one motor into two, so that I can make the single motor turn in both directions.
ArduSub expects its motors to be bi-directional thrusters, with PWM-based control (1500µs = neutral/stopped, 1100µs = full reverse, 1900µs = full forwards). I’m not sure whether it would work well with a buoyancy module (given that changes a constant force, rather than applying a force temporarily), but if there’s an issue I wouldn’t expect it to be that the motor it shouldn’t be with not being able to use both directions unless your motor uses a different type of control.
What kind of motor are you using, and how is it controlled? If it’s similar to our thrusters you may find it simplest to assign controls similar to how we set up our gripper, as a servo motor with “momentary” min or max PWM output while a button is pressed and held. Alternatively if it’s an actual servo motor then you likely want to assign it as a servo motor and set corresponding button functionalities for incrementing and decrementing the output PWM, to change its position. Neither of those options requires a custom vehicle frame.
Thank you for your fast reply, we are using stepper motors so not servo motors. So we will rather be using the motors to get the buoyancy module in place then turn them off so that the brakes activate again. Regarding how its controlled, its still not sure. I made a post a few days ago asking how the controller was made and if it would be possible to edit (Altering/Creating my own PID controller for ArduSub), since im not quite sure myself yet how I want to do the controller. Would you recommend doing it like the gripper? The idea for the UUV is not to be controlled by a handheld controller but rather for it to be autonomous, so using a PID controller.
I also had a question regarding the PWM-based controls, you mentioned that the thrusters are bi-directional, I’m not quite sure I understand how the custom frame works then, where can we decide which of the three (500µs = neutral/stopped, 1100µs = full reverse, 1900µs = full forwards) we want to use? Is there any documentation regarding this?
ArduSub is set up for servo-style PWM-based control of bi-directional thrusters (which proportionally controls the thrust) and peripherals (to directly control servo angle, light level, etc). Stepper motors are generally controlled with individual pulses that command incremental ‘step’ motions, which is not compatible with servo-style control. I expect it would be quite unusual to have a stepper motor with servo control unless that’s something you’ve purchased intentionally or set up yourself.
Can you provide a clear description of the actuators in your system? If your vehicle is mostly controlled with thrusters, with a single stepper motor for buoyancy then you may be able to work around that by using an Arduino board or microcontroller in between the Pixhawk and that motor’s controller to allow controlling it via a servo signal, but if you have multiple stepper motors and/or are using control surfaces instead of thrusters then you’ll likely need to do considerable modifications of ArduSub to get it working for you, and there isn’t documentation or a guide on how to meaningfully do so - it may be easier to just create a controller from scratch on an Arduino.
You don’t - those are descriptions of the signals that are output, depending on the commands that are sent to the flight controller.
As an example, for a thruster that is configured with a 1.0 forward thrust factor and 0.0 for the other motion directions, a full forwards command would set the output for that thruster to a 1900µs pulse-duration PWM signal. A full reverse command would set the output for that thruster to 1100µs pulses. A neutral/stopped command would set the output to 1500µs. Commands in between stopped and full forwards would set the output thrust somewhere between 1500µs and 1900µs, and similarly for between stopped and full reverse.
It’s possible to use vehicle parameters to restrict the pulse-duration ranges (e.g. you could make full forwards 1700 and full reverse 1300), but the control is PWM-based - i.e. pulses that are sent at regular intervals (200Hz by default, so one pulse every 5 milliseconds). The only way to change that is to either configure the output as not a motor (and then not be able to use ArduSub’s attitude and position controllers), or rewrite ArduSub to use a different form of control (which on a Pixhawk may only be possible on AUX pins, since the MAIN pins are from a PWM controller).
In RC subs, a popular method of changing buoyancy was to inflate and and deflate blood-pressure cuffs inside a chamber - displacing water. Running the air pump forward filled the bladder and reversing it allowed the water back in. The air used came from the electronics chamber. I used this method in an RC converted Revell u-boat kit. I just don’t know the practical depth/pressure limits of this method.