ROV control via gamepad

software

#1

Hi,

Im currently building my own ROV for obtaining my university diploma. I was heavily inspired by what openROV has developed - it is just amazing. Great work guys! Anyways Im currently at programming stage where I need to develop thruster control via gamepad. I`m building my interface on Raspberry pi using node.js and the same gamepad API.

I wan`t to control the ROV horizontal movement with a single joystick:

-joystick forward is both motors forward
-joystick left is left motor reverse and right motor forward to turn
-joystick back is reverse
-joystick right is left motor forward and right motor reverse to turn

So that is all good and simple.
But how can I control so that lets say if the joystick is on the y=x axis (45axis)
that the motors will be controlled proportionally because on y=x there would be turning and forward movement of the rov involved so let`s say that on the middle of the top part of y=x axis then the left motor would be off and the right would turn faster than normal turning so the rov makes a arc turn.

And if the joystick was at the tip of top y=x the left motor would then have to turn forward slowly and the right motor would have to turn at full throttle.

I know I could use tank style control but I would prefer this way (to have 1 joystick for horizontal movement and 1 for lateral and vertical movement).
I want Pi to calculate according values to send to motors, because I have decided to send motor commands to my controller board (my custom designed board featuring Xmega MCU) in the following way:
< M 1500 1500 1500 Checksum
That would be stop command for motor. First 1500 is data for port motor, second for starboard motor and third for vertical motor.

How have you solved this issue?
My interface won`t be anything near as advanced as openROV server setup, as I have very little experience with Javascript. That is also a reason why it is really hard for me to understand openROV code. it just seems so complex and confusing.

Thank You,
Margus


#2

You can find our code here:https://github.com/OpenROV/openrov-software-arduino/blob/master/OpenROV/Thrusters2X1.cpp

The way we currently have it implemented:
Basically we pick one axis with more control authority than the other. So if it is a decision between full forward translation and full yaw, the higher priority wins, and we calculate the remaining control range and then use that for the secondary axis. For example, if the thrust is the primary control, and it is at 100%, their is nothing left for Yaw even though the joystick might be at a X,Y=1,1.


#3

Thank You for quick reply!
It seems to me that you are sending data to thrusters in similar way.
Only difference is that most of your commands to Arduino only have data for one thruster at time (except for “go”)?
like: port (value between 1000 and 2000)
Is that correct?
Do you send commands to thrusters as new input comes in from gamepad or after some certain period of time?
Where could I see how you handle input coming from gamepad?


#4

Take a look at the Lift, Yaw, and Thrust commands. The go command is left over from earlier releases.

On the browser, we read the gamepad values and covert them to the lift, yaw, and thrust commands. Those are then fed through the system to the Arduino in the example code above.


#5

hye brian, according to your explanation… the ‘go’ command are not use for latest release? are the same apply to:
port,vertical,lateral and starboard?did they become thro,yaw,lift and strafe?


#6

That is correct. They are still used when calibrating the older models motors.