Page 1 of 1

What type of control systems are you using?

Posted: Sep 2nd, 2019, 9:07 pm
by perry
My ROV will have a pair of port/starboard thrusters and a single vertical thruster. I have a pair of Arduinos which command Pololu Trex motor controllers.

What I am pondering most now is what the control system should look like. As I see it, I can use a pair of joysticks to make a sort of skid-steer system where each thruster is operating independently, or I can use a single joystick and code a function to map the joystick position to thrust ratios (e.g. Forward/Left drives the right thruster faster).

I am also debating a 3-axis joystick where the rotation of the joystick would map to reversing a single thruster (e.g. port forward + starboard reverse) for tight turns.

What do you folks use for control?

Re: What type of control systems are you using?

Posted: Sep 4th, 2019, 3:35 pm
by Bennachie
Hi. Your proposals all make sense, at least the first two do, I'll come to the third later.

The tank-track approach is simplest and intuitive, but means you need to operate three sticks to control all three thrusters, which can be awkward.

A two-axis joystick is also intuitive and leaves your other hand free for the vertical control, but as you correctly point out requires mixing of the controls for the two axial thrusters. Fortunately, the mixing is quite simple. I'll try to post some sort of example code to illustrate when I get the chance.

Your third option, if I read it correctly, is really just the same as your second, unless you mean that full forward throttle does not give 100% power to the thrusters, and you only apply this when you rotate the stick. I think a little code will illustrate what I mean better.

Either way, a two axis joystick will suit you fine, if you are happy do so some reasonably simple coding to get the thrusters to mix correctly. You'll get your tight turns thing thrown in for free, trust me.

As an aside, some ROVs with your configuration use the X and Y axes on a two axis joystick. Others use only the forward-back axis (is that the X or Y?), and the twist (Z axis) as that seems more intuitive for some people.

As for my own design, I've gone for a vectored thrust design with six thrusters and a three axis joystick.

*Edit* PS, when you say you are using a pair of Arduinos, do you mean one for the joystick and one for the motors, or do you mean both for controlling the motors? You can control all three motors using a single Arduino.

Re: What type of control systems are you using?

Posted: Sep 5th, 2019, 8:43 am
by Bennachie
Ok, this is NOT complete working code, but it'll give you an idea of what you need to do. Obviously I haven't created variables, or mapped servos, or pretty much anything. I've just outlined the steps necessary to read in values from a joystick and mix them then send them to a couple of servos / motor controllers.

Code: Select all

//First we need to read our joystick axes and assign these values to variables.
//In this case, yinput is the forward/back joystick axis
//and xinput is either the left/right stick input, or the twist input.
  xinput = analogRead(A0);
  yinput = analogRead(A1);

//Next we need to mix the inputs correctly so that we can generate raw values for the axial thrusters.
//Remember that our input values range from 0 to 1023.
  portraw = ((yinput + xinput) - 511);
  stbdraw = ((yinput + (1023 - xinput)) - 511);

//Now we need to make sure our values don't go out of range.
  if (portraw >=1023){
    portraw = 1023;
}
  if (stbdraw >=1023){
    stbdraw = 1023;
}

//Now we need to scale the outputs to suit the PWM servo command which outputs in the range 0 to 179.
  port = (map(portraw, 0, 2047, 0, 179));
  stbd = (map(stbdraw, 0, 2047, 0, 179));

//Now we need to send our values to the servos (or motor controller board).
  portthruster.write(port);
  stbdthruster.write(stbd);
I hope I got my sums right there... :lol:

Re: What type of control systems are you using?

Posted: Sep 5th, 2019, 9:41 am
by perry
Thanks for the response.

I am not overly concerned about the coding, merely the techniques that make the most sense in the real world. As of right now, the vertical thruster would controlled by a DPDT switch: one way is up, other is down, with no chance of up and down being commanded simultaneously. The ROV should be pretty close to neutral buoyancy, so I don't think I will have to constantly adjust depth, but I do agree the two hands thing might be an issue, so I probably should go with either the 2 or 3 axis joystick leaving my other hand free.

Thanks!
Bennachie wrote:Ok, this is NOT complete working code, but it'll give you an idea of what you need to do. Obviously I haven't created variables, or mapped servos, or pretty much anything. I've just outlined the steps necessary to read in values from a joystick and mix them then send them to a couple of servos / motor controllers.

Code: Select all

//First we need to read our joystick axes and assign these values to variables.
//In this case, yinput is the forward/back joystick axis
//and xinput is either the left/right stick input, or the twist input.
  xinput = analogRead(A0);
  yinput = analogRead(A1);

//Next we need to mix the inputs correctly so that we can generate raw values for the axial thrusters.
//Remember that our input values range from 0 to 1023.
  portraw = ((yinput + xinput) - 511);
  stbdraw = ((yinput + (1023 - xinput)) - 511);

//Now we need to make sure our values don't go out of range.
  if (portraw >=1023){
    portraw = 1023;
}
  if (stbdraw >=1023){
    stbdraw = 1023;
}

//Now we need to scale the outputs to suit the PWM servo command which outputs in the range 0 to 179.
  port = (map(portraw, 0, 2047, 0, 179));
  stbd = (map(stbdraw, 0, 2047, 0, 179));

//Now we need to send our values to the servos (or motor controller board).
  portthruster.write(port);
  stbdthruster.write(stbd);
I hope I got my sums right there... :lol:

Re: What type of control systems are you using?

Posted: Sep 6th, 2019, 11:55 am
by Ian MacKenzie
I'm using a modified arcade joystick. I dremelled out the hand grip, drilled a hole through the shaft for the wires and installed a little thumbstick. It controls the vertical and lateral thrusters. It's not pretty, but it works. The arcade joystick controls the 2 main thrusters.