Gamepad control

user-interface

#1

I have the cockpit working fine under keyboard control and almost fine with a gamepad. With the gamepad the camera tilt acts unpredictably. Sometimes I get what I expect (camera tilt works just as it does with the keyboard), other times I get wild, jerky servo movements, and sometimes I get nothing.

I tried assigning different buttons to the tilt servo control (by modifying gamepad.js) but with the same results.

Any one experienced this, and if you have, solved it? Any suggestions otherwise?


#2

Yes, the gamepad control is still a work in progress. What game controller are you using? What browser?


#3

I am using a Logitech dual action gamepad. I am running cockpit in Chrome on Linux. While I have verified that my controller is fully functional in Linux I know that the Xbox 360 controller was used in development so I suspect there is some subtle difference between what I am using and that controller.


#4

xbox 360 works best so far. Gamepad control is all in development, though, so expect a few bugs.


#5

Hi David

I wanted to now look at getting the Controller and wanted to know what the best one is to get. I see you use the Xbox 360 and wanted to know if this is the go forward controller of choice or is there another model that I should order.

Regards

Dave


#6

David,

the OpenROV cockpit software relies on the Chrome or Firefox Gamepad APIs, which require a XInput compatible controller (i.e. a controller compatible with xBox). As far as I know, apart from Microsoft, Logitech provides some models. Many controllers on the market use the xBox button layout, but do not support XInput. They will work with most PC games, but not with the browser's gamepad API.

However, I mangaged to get my 10 Euros Thrustmaster Dual analog 4 gamepad to work flawlessly with additional software: http://openrov.com/forum/topics/make-non-xbox-360-gamepads-work-with-openrov-cockpit

Probably this would work with other non-Xbox controllers as well...

-Stefan


#7

I have an OpenROV v2.4 (pre-built) S/N 137 and I'm having trouble getting the XBox controller to work correctly. When I first open OpenROV Cockpit, the controller isn't recognized. Reading forums, etc. I know to press a button to get it to recognize the controller. That works. The problem is that as soon as it recognizes the controller, all three of the motors start up and the only thing that I seem to be able to do with the controller is reverse them, but they never stop.

I'm using a standard XBox 360 controller:


I am using Chrome on Mac OS v10.8.4 (Mountain Lion). The "XBox 360 Controllers" driver shows the joysticks centered:


There are some settings in the OpenROV Cockpit that are not documented in the Software Manual. The first is in Settings:


It is labeled "Motor Response Aggressiveness". I tried various settings and none seemed to have any affect. The other two settings are in the Diagnostic section:


Those settings are Labeled: Runtime Settings: Dead Zone. Changing these settings also didn't seem to have any affect. Unfortunately, I don't know what version of Cockpit I'm running, so I'm hoping that a screenshot will help:


I would appreciate any suggestions on where to go from here to get my controller to work. It would also be helpful if anyone knows what the settings that I have listed above should be.


#8

Hey Dennis,

Sorry to hear about your troubles! Pressing one of the right trigger keys often re-zeros the joysticks, but also by the looks of things, your values for "DeadZone" settings may be to far from zero. This function is meant to compensate for the automatic dead zone programmed into the ESCs so that you can move fluidly from one direction to the other without the motors stopping. If these values are too far from zero, then the ESCs act just like you're describing.

To test this broadly, you should try moving the sliders on both sides inward to something like 0.01. If that makes a difference, then you can tune the values more precisely by sliding one of the throttle sliders forward until the propeller starts to spin, and then setting the deadzone slider to the same value (then do this for the other direction).

Okay... I'm not sure if any of that will help, but we'll keep trying other things if it doesn't!

Eric


#9

Thanks. Adjusting the DeadZone Min/Max sliders in Diagnostics helped. Basically like described above by you. I had one joystick direction that still didn't stop one motor when centered. Adjusting the sliders in the "XBox 360 Controllers" driver took care of that problem. I hope this helps anyone else that may have these problems.

Thanks Eric! My XBox controller is working and it's great to have speed control over the motors.


#10

Woooo! Congrats! I'm glad that worked!

If you have any other troubles don't hesitate to post them on the forums-- there are a lot of very savvy people here who can solve just about any problem.

We can't wait to see what adventures you have with # 137!

Eric


#11

Hi Denis

I had bought an Xbox360 last week and did not have much luck with controlling the motors smoothly so I took it back. The issue I had was having: if I touched the button to go forward just even a hair it would start the motors full tilt then after adjusting the dead ban down to .01 I would have better control but it was still unpredictable and the motors would not always stop if I released the joystick so it was way to sensitive to the touch so that is why I took it back. Now that you have yours working I was wondering how smooth the motor control was working for you. Can you easily make them go slow forward and turn from right to left etc? Can you adjust how much you can move the button before the motor starts? I might give it another try if I could make it less sensitive.


#12

I'm sorry that it took me so long to respond.

My controller still is not quite perfect. I need to find more time to tweak it. The odd thing is that while adjusting the Deadzone sliders in Diagnostics helped, that wasn't my only problem. (My current settings are very low-see below.)


The other problem that I had was that one or more of the motors would run even when the joysticks were centered. Eric's suggestion about using one of the trigger keys to center the joysticks didn't work. What did work was to adjust a couple of sliders in the 360 XBox Controller driver (required because I'm using a Macintosh). The driver's sliders seem to create a larger dead zone (the size of the center square in the red cross (see picture below). That is the opposite of the function of the Diagnostics dead zone sliders (to minimize the dead zone).


What this did for me was to stop the motors when the joysticks are centered. The down side is that the motors don't start for the first part of the joystick's travel. That would limit the range of speed for the motors.

It isn't perfect, but it give me a place to start. I'm hoping to tweak the settings to make it work better.


#13

Update:

I was able to spend more time testing the variables.

1. The Diagnostics Dead Zone settings of -.006 for both min and max seem to work well.

2. In the XBox 360 Controller driver, while working with the joystick sliders that create a Dead Zone, I found that part of my problem was that my left-hand joystick wasn't always returning to center.

Note: By making the crosses as narrow as possible (see above), it became obvious that the joystick wasn't returning to the center box in the center of the cross.

With that information, I now adjust the driver joystick sliders fairly narrow and I then have good control over speed.


#14

Excellent!


#15

Hi
I just got a x box360 gamecontroller and it works in general, but as mentioned above, my motors will not stop reliably in the neutral position.
I use windows 8 and have not found a possibilty to change the neutral zone there. I tried to set the ESC to a wider (normal) dead zone, but that did not help as well. Any suggestions?
Hub


#16

I did this another way. I am using Windows 7, Chrome, real X'box 360 controller and had the same problem. ROV 241 works fine with keyboard and motors run when using the joystick.

When you plug in the joystick if you scroll and look on the right side of OpenCockpit for the lines "motor", "mtarg", "cmd go". The "cmd go" line is showing you what the joystick is sending out when at rest. Mine was showing 1560 1420 1560 (fwd-backward are 1560 and 1420 for up/down). I added a couple lines of code to the "Thrusters2X1.cpp code which open up the "at rest or dead area". The file lives in the "arduino\OpenROV" folder Remember the center for the joystick is 1500, so adding and subtracting 100 fixes my problem.

Find the section that starts out with the below and add a couple of lines of code:

void Thrusters::device_loop(Command command){
if (command.cmp("go")) {
//ignore corrupt data
if (command.args[1]>999 && command.args[2] >999 && command.args[3] > 999 && command.args[1]<2001 && command.args[2]<2001 && command.args[3] < 2001) {
p = command.args[1];
v = command.args[2];
s = command.args[3];
if (command.args[4] == 1) bypasssmoothing=true;
}

//I want a dead zone for the joystick added by john stager
// middle is 1500 lets try a range of 100 up/down
if (command.args[1]>1400 && command.args[1]<1600) {
p = 1500;
}
if (command.args[2]>1400 && command.args[2]<1600) {
v = 1500;
}
if (command.args[3]>1400 && command.args[3]<1600) {
s = 1500;
}
}

The above just makes say "p"=1500 when above 1400 and less than 1600. You need to reload the arduino code in OpenCockpit when you have finished making the changes. This sounds like a lot but is pretty simple to do.

John


#17

Thanks a lot John!
I will try that, once I have put back together my ROV. Right now I am in the process of repotting my wires in my newly made aluminum endcaps. I will post some pictures of those, when everything is finished.
Hub


#18

David, please, how resolve my problem about xbox 360 wirelless controller doesn´t work


#19

Hi all
I bring this up again, because so far I was not able to solve the problems with my x-box controller. Talking with Dominik brought the solution: he mentioned that he never had these issues with the neutral position of the sticks. He then said that he uses a Logitec F310 instead of the xbox controller. So I went on and googled a bit to find out what was the difference between the two and found discussions among gamers, that recommended not using the Logitec, because for gaming it has a to wide neutral-zone! So after reading that I went immediately out and bought a F310. Already when you take it in your hand you feel the difference in the sticks: the Logitec is much stiffer around the neutral position. I hooked it up on my Rov and immediately saw, that all my problems are solved! Therefore I would strongly recommend to use the Logitec f310 for our purposes and not the xbox-controller.
I have not tried the wireless version of the Logitec, but that would be tempting as well.
Hub