Adjusting YAW values


#1

Got a question from the community about how to adjust the YAW rate. In version 2.5, the YAW is left full power all of the time. At low speeds this pivot can seem way too fast. Especially when using the keyboard where the command is either Hard to Port/Starboard or idle. There are a lot of things a fluids dynamic engineer could probably discuss in regards to how the YAW rate changes as the ROV is underway, but until then I wanted to leave instructions for how to tune the turn rate yourself:

https://github.com/OpenROV/openrov-software/blob/master/src/plugins/rovpilot/public/js/rovpilot.js is probably the place to start. It has access to the pilot’s target power settings and aggregates commands from keyboard, gamepad, etc in to the socket.io api commands that go to the ROV.

On this line (https://github.com/OpenROV/openrov-software/blob/c4e6966a1c081e6df565c2761e356ace782a37d9/src/plugins/rovpilot/public/js/rovpilot.js#L309) we have the code that actually sets the Yaw:

ROVpilot.prototype.sendPilotingData = function sendPilotingData(){
var positions = this.positions;
var updateRequired = false; //Only send if there is a change
var controls = {};

controls.throttle = positions.throttle * this.power;
controls.yaw = positions.yaw; // --> Sets Yaw -1…1
controls.lift = positions.lift * this.power;
for(var i in positions) {

if (controls[i] != this.priorControls[i])
{
updateRequired = true;
}
}

Notice how in the lines around it, we multiply by the power factor to ultimately reduce the rate of thrust or lift. You could to the same thing and make the YAW rate obey the same power factor settings:

controls.yaw = positions.yaw * this.power;

Feel free to experiment. Since this is javascript running on the browser, you can make the change and simply refresh the browser to try it out!

-B


#2

I thought of the same thing and essentially did what you speak about. Here is a snippit from rovpilot.js. Only thing I added was to limit the this.power to > than .2 for the yaw axis.

currentPowerLevel++;
if (currentPowerLevel>5) currentPowerLevel = 1;
this.powerLevel(currentPowerLevel);
}

ROVpilot.prototype.powerLevel = function powerLevel(value){
switch(value){
case 1:
this.power = .05
break;
case 2:
this.power = .1
break;
case 3:
this.power = .2
break;
case 4:
this.power = .5
break;
case 5:
this.power = 1
break;
}
$("#thrustfactor").text(value);
};

ROVpilot.prototype.allStop = function allStop(){
this.vtrim = 0;
this.ttrim = 0;
this.positions.throttle = 0;
this.positions.yaw = 0;
this.positions.lift = 0;
};

ROVpilot.prototype.sendPilotingData = function sendPilotingData(){
var positions = this.positions;
var updateRequired = false; //Only send if there is a change
var controls = {};

controls.throttle = positions.throttle * this.power;

//*************change by chris siegert to lower turning power
//also to keep the lift power from reducing below .2
if(this.power > .2 )
{
controls.yaw = positions.yaw * this.power;

}
else
{
controls.yaw = positions.yaw * .2;

}

//controls.yaw = positions.yaw * this.power;
controls.lift = positions.lift * this.power;
//****************************************************************

Have yet to really test it in the water.

I wrote a more detailed post on our blog.


#3

update:

I pool tested and the fix works great. No Trustfire dropouts and the turning control is acceptable. In fact, the lower limit of .2 probably could be .1 or even removed. This would allow fine control during station keeping maneuvers.

BTW: I have a comment in the above snippit

//also to keep the lift power from reducing below .2

which I forgot to delete.. I had done the same thing for the vertical axis but decided not to.