Commit 61052340 authored by Roque's avatar Roque

Improve script page parameters

See merge request nexedi/erp5!1737
parents b0013fa3 34dd6d36
Pipeline #26707 failed with stage
in 0 seconds
......@@ -41,8 +41,17 @@ var FixedWingDroneAPI = /** @class */ (function () {
*/
FixedWingDroneAPI.prototype.internal_start = function (drone) {
drone._maxDeceleration = this.getMaxDeceleration();
if (drone._maxDeceleration <= 0) {
throw new Error('max deceleration must be superior to 0');
}
drone._maxAcceleration = this.getMaxAcceleration();
if (drone._maxAcceleration <= 0) {
throw new Error('max acceleration must be superior to 0');
}
drone._minSpeed = this.getMinSpeed();
if (drone._minSpeed <= 0) {
throw new Error('min speed must be superior to 0');
}
drone._maxSpeed = this.getMaxSpeed();
if (drone._minSpeed > drone._maxSpeed) {
throw new Error('min speed cannot be superior to max speed');
......@@ -52,16 +61,31 @@ var FixedWingDroneAPI = /** @class */ (function () {
throw new Error('Drone speed must be between min speed and max speed');
}
drone._minPitchAngle = this.getMinPitchAngle();
if (drone._minPitchAngle >= 0) {
throw new Error('min pitch angle must be inferior to 0');
}
drone._maxPitchAngle = this.getMaxPitchAngle();
if (drone._maxPitchAngle <= 0) {
throw new Error('max pitch angle must be superior to 0');
}
if (drone._minPitchAngle > drone._maxPitchAngle) {
throw new Error('min pitch angle cannot be superior to max pitch angle');
}
drone._maxRollAngle = this.getMaxRollAngle();
if (drone._maxRollAngle <= 0) {
throw new Error('max roll angle must be superior to 0');
}
drone._maxSinkRate = this.getMaxSinkRate();
if (drone._maxSinkRate <= 0) {
throw new Error('max sink rate must be superior to 0');
}
if (drone._maxSinkRate > drone._maxSpeed) {
throw new Error('max sink rate cannot be superior to max speed');
}
drone._maxClimbRate = this.getMaxClimbRate();
if (drone._maxClimbRate <= 0) {
throw new Error('max climb rate must be superior to 0');
}
if (drone._maxClimbRate > drone._maxSpeed) {
throw new Error('max climb rate cannot be superior to max speed');
}
......@@ -417,34 +441,34 @@ var FixedWingDroneAPI = /** @class */ (function () {
return null;
};
FixedWingDroneAPI.prototype.getMinSpeed = function () {
return this._flight_parameters.drone.minSpeed || MIN_SPEED;
return this._flight_parameters.drone.minSpeed;
};
FixedWingDroneAPI.prototype.getMaxSpeed = function () {
return this._flight_parameters.drone.maxSpeed || MAX_SPEED;
return this._flight_parameters.drone.maxSpeed;
};
FixedWingDroneAPI.prototype.getInitialSpeed = function () {
return this._flight_parameters.drone.speed || DEFAULT_SPEED;
return this._flight_parameters.drone.speed;
};
FixedWingDroneAPI.prototype.getMaxDeceleration = function () {
return this._flight_parameters.drone.maxDeceleration || MAX_DECELERATION;
return this._flight_parameters.drone.maxDeceleration;
};
FixedWingDroneAPI.prototype.getMaxAcceleration = function () {
return this._flight_parameters.drone.maxAcceleration || MAX_ACCELERATION;
return this._flight_parameters.drone.maxAcceleration;
};
FixedWingDroneAPI.prototype.getMinPitchAngle = function () {
return this._flight_parameters.drone.minPitchAngle || MIN_PITCH;
return this._flight_parameters.drone.minPitchAngle;
};
FixedWingDroneAPI.prototype.getMaxPitchAngle = function () {
return this._flight_parameters.drone.maxPitchAngle || MAX_PITCH;
return this._flight_parameters.drone.maxPitchAngle;
};
FixedWingDroneAPI.prototype.getMaxRollAngle = function () {
return this._flight_parameters.drone.maxRoll || MAX_ROLL;
return this._flight_parameters.drone.maxRoll;
};
FixedWingDroneAPI.prototype.getMaxSinkRate = function () {
return this._flight_parameters.drone.maxSinkRate || MAX_SINK_RATE;
return this._flight_parameters.drone.maxSinkRate;
};
FixedWingDroneAPI.prototype.getMaxClimbRate = function () {
return this._flight_parameters.drone.maxClimbRate || MAX_CLIMB_RATE;
return this._flight_parameters.drone.maxClimbRate;
};
FixedWingDroneAPI.prototype.getMaxOrientation = function () {
//TODO should be a game parameter (but how to force value to PI quarters?)
......
......@@ -238,7 +238,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1006.17822.27350.61713</string> </value>
<value> <string>1006.23750.47435.55654</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -256,7 +256,7 @@
</tuple>
<state>
<tuple>
<float>1676035583.95</float>
<float>1676554628.54</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -194,7 +194,7 @@
"title": "Drone min speed",
"default": MIN_SPEED,
"css_class": "",
"required": 0,
"required": 1,
"editable": 1,
"key": "drone_min_speed",
"hidden": 0,
......@@ -205,7 +205,7 @@
"title": "Drone speed",
"default": DEFAULT_SPEED,
"css_class": "",
"required": 0,
"required": 1,
"editable": 1,
"key": "drone_speed",
"hidden": 0,
......@@ -216,7 +216,7 @@
"title": "Drone max speed",
"default": MAX_SPEED,
"css_class": "",
"required": 0,
"required": 1,
"editable": 1,
"key": "drone_max_speed",
"hidden": 0,
......@@ -227,7 +227,7 @@
"title": "Drone max Acceleration",
"default": MAX_ACCELERATION,
"css_class": "",
"required": 0,
"required": 1,
"editable": 1,
"key": "drone_max_acceleration",
"hidden": 0,
......@@ -238,7 +238,7 @@
"title": "Drone max Deceleration",
"default": MAX_DECELERATION,
"css_class": "",
"required": 0,
"required": 1,
"editable": 1,
"key": "drone_max_deceleration",
"hidden": 0,
......@@ -249,7 +249,7 @@
"title": "Drone max roll",
"default": MAX_ROLL,
"css_class": "",
"required": 0,
"required": 1,
"editable": 1,
"key": "drone_max_roll",
"hidden": 0,
......@@ -260,7 +260,7 @@
"title": "Drone min pitch",
"default": MIN_PITCH,
"css_class": "",
"required": 0,
"required": 1,
"editable": 1,
"key": "drone_min_pitch",
"hidden": 0,
......@@ -271,7 +271,7 @@
"title": "Drone max pitch",
"default": MAX_PITCH,
"css_class": "",
"required": 0,
"required": 1,
"editable": 1,
"key": "drone_max_pitch",
"hidden": 0,
......@@ -282,7 +282,7 @@
"title": "Drone max sink rate",
"default": MAX_SINK_RATE,
"css_class": "",
"required": 0,
"required": 1,
"editable": 1,
"key": "drone_max_sink_rate",
"hidden": 0,
......@@ -293,7 +293,7 @@
"title": "Drone max climb rate",
"default": MAX_CLIMB_RATE,
"css_class": "",
"required": 0,
"required": 1,
"editable": 1,
"key": "drone_max_climb_rate",
"hidden": 0,
......@@ -563,9 +563,15 @@
text: 'Download Simulation LOG ' + i,
download: 'simulation_log_' + i
+ '_speed_' + game_parameters_json.drone.speed
+ '_min-speed_' + game_parameters_json.drone.minSpeed
+ '_max-speed_' + game_parameters_json.drone.maxSpeed
+ '_max-accel_' + game_parameters_json.drone.maxAcceleration
+ '_max-decel_' + game_parameters_json.drone.maxDeceleration
+ '_max-roll_' + game_parameters_json.drone.maxRoll
+ '_min-pitch_' + game_parameters_json.drone.minPitchAngle
+ '_max-pitch_' + game_parameters_json.drone.maxPitchAngle
+ '_max-sink_' + game_parameters_json.drone.maxSinkRate
+ '_max-climb_' + game_parameters_json.drone.maxClimbRate
+ '.txt',
href: window.URL.createObjectURL(blob)
});
......
......@@ -244,7 +244,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1006.17791.59880.25668</string> </value>
<value> <string>1006.22396.42884.34816</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>1676033282.59</float>
<float>1676390684.63</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment