Skip to content

Commit fab9f76

Browse files
add support for extended MANUAL_CONTROL
1 parent 77275b2 commit fab9f76

File tree

1 file changed

+52
-18
lines changed

1 file changed

+52
-18
lines changed

src/libs/mavlink.js

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3999,6 +3999,16 @@ mavlink20.messageFields = {
39993999
'z',
40004000
'r',
40014001
'buttons',
4002+
'buttons2',
4003+
'enabled_extensions',
4004+
's',
4005+
't',
4006+
'aux1',
4007+
'aux2',
4008+
'aux3',
4009+
'aux4',
4010+
'aux5',
4011+
'aux6',
40024012
],
40034013
'RC_CHANNELS_OVERRIDE': [
40044014
'target_system',
@@ -5330,6 +5340,7 @@ mavlink20.messageFields = {
53305340
'custom_mode',
53315341
'system_status',
53325342
'mavlink_version',
5343+
53335344
],
53345345
}
53355346
mavlink20.messages = {};
@@ -9961,32 +9972,55 @@ as boolean values of their
99619972
buttons : A bitfield corresponding to the joystick buttons' current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1. (uint16_t)
99629973

99639974
*/
9964-
mavlink20.messages.manual_control = function(target, x, y, z, r, buttons) {
9965-
9966-
this._format = '<hhhhHB';
9967-
this._id = mavlink20.MAVLINK_MSG_ID_MANUAL_CONTROL;
9968-
this.order_map = [5, 0, 1, 2, 3, 4];
9969-
this.len_map = [1, 1, 1, 1, 1, 1];
9970-
this.array_len_map = [0, 0, 0, 0, 0, 0];
9971-
this.crc_extra = 243;
9972-
this._name = 'MANUAL_CONTROL';
9975+
/*
9976+
This message provides an API for manually controlling the vehicle
9977+
using standard joystick axes nomenclature, along with a joystick-like
9978+
input device. Unused axes can be disabled an buttons are also transmit
9979+
as boolean values of their
99739980

9974-
this._instance_field = undefined;
9975-
this._instance_offset = -1;
9981+
target : The system to be controlled. (uint8_t)
9982+
x : X-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to forward(1000)-backward(-1000) movement on a joystick and the pitch of a vehicle. (int16_t)
9983+
y : Y-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to left(-1000)-right(1000) movement on a joystick and the roll of a vehicle. (int16_t)
9984+
z : Z-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a separate slider movement with maximum being 1000 and minimum being -1000 on a joystick and the thrust of a vehicle. Positive values are positive thrust, negative values are negative thrust. (int16_t)
9985+
r : R-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a twisting of the joystick, with counter-clockwise being 1000 and clockwise being -1000, and the yaw of a vehicle. (int16_t)
9986+
buttons : A bitfield corresponding to the joystick buttons' current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1. (uint16_t)
9987+
buttons2 : A bitfield corresponding to the joystick buttons' 16-31 current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 16. (uint16_t)
9988+
enabled_extensions : Set bits to 1 to indicate which of the following extension fields contain valid data: bit 0: pitch, bit 1: roll, bit 2: aux1, bit 3: aux2, bit 4: aux3, bit 5: aux4, bit 6: aux5, bit 7: aux6 (uint8_t)
9989+
s : Pitch-only-axis, normalized to the range [-1000,1000]. Generally corresponds to pitch on vehicles with additional degrees of freedom. Valid if bit 0 of enabled_extensions field is set. Set to 0 if invalid. (int16_t)
9990+
t : Roll-only-axis, normalized to the range [-1000,1000]. Generally corresponds to roll on vehicles with additional degrees of freedom. Valid if bit 1 of enabled_extensions field is set. Set to 0 if invalid. (int16_t)
9991+
aux1 : Aux continuous input field 1. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 2 of enabled_extensions field is set. 0 if bit 2 is unset. (int16_t)
9992+
aux2 : Aux continuous input field 2. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 3 of enabled_extensions field is set. 0 if bit 3 is unset. (int16_t)
9993+
aux3 : Aux continuous input field 3. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 4 of enabled_extensions field is set. 0 if bit 4 is unset. (int16_t)
9994+
aux4 : Aux continuous input field 4. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 5 of enabled_extensions field is set. 0 if bit 5 is unset. (int16_t)
9995+
aux5 : Aux continuous input field 5. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 6 of enabled_extensions field is set. 0 if bit 6 is unset. (int16_t)
9996+
aux6 : Aux continuous input field 6. Normalized in the range [-1000,1000]. Purpose defined by recipient. Valid data if bit 7 of enabled_extensions field is set. 0 if bit 7 is unset. (int16_t)
99769997

9977-
this.fieldnames = ['target', 'x', 'y', 'z', 'r', 'buttons'];
9998+
*/
9999+
mavlink20.messages.manual_control = function( ...moreargs ) {
10000+
[ this.target , this.x , this.y , this.z , this.r , this.buttons , this.buttons2 , this.enabled_extensions , this.s , this.t , this.aux1 , this.aux2 , this.aux3 , this.aux4 , this.aux5 , this.aux6 ] = moreargs;
997810001

10002+
this._format = '<hhhhHBHBhhhhhhhh';
10003+
this._id = mavlink20.MAVLINK_MSG_ID_MANUAL_CONTROL;
10004+
this.order_map = [5, 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
10005+
this.len_map = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
10006+
this.array_len_map = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
10007+
this.crc_extra = 243;
10008+
this._name = 'MANUAL_CONTROL';
997910009

9980-
this.set(arguments,true);
10010+
this._instance_field = undefined;
10011+
this._instance_offset = -1;
10012+
this.fieldnames = ['target', 'x', 'y', 'z', 'r', 'buttons', 'buttons2', 'enabled_extensions', 's', 't', 'aux1', 'aux2', 'aux3', 'aux4', 'aux5', 'aux6'];
10013+
this.field_enums = [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null];
10014+
this.field_bitmasks = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];
998110015

998210016
}
998310017

998410018
mavlink20.messages.manual_control.prototype = new mavlink20.message;
998510019
mavlink20.messages.manual_control.prototype.pack = function(mav) {
9986-
var orderedfields = [ this.x, this.y, this.z, this.r, this.buttons, this.target];
9987-
var j = jspack.Pack(this._format, orderedfields);
9988-
if (j === false ) throw new Error("jspack unable to handle this packet");
9989-
return mavlink20.message.prototype.pack.call(this, mav, this.crc_extra, j );
10020+
var orderedfields = [ this.x, this.y, this.z, this.r, this.buttons, this.target, this.buttons2, this.enabled_extensions, this.s, this.t, this.aux1, this.aux2, this.aux3, this.aux4, this.aux5, this.aux6];
10021+
var j = jspack.Pack(this._format, orderedfields);
10022+
if (j === false ) throw new Error("jspack unable to handle this packet");
10023+
return mavlink20.message.prototype.pack.call(this, mav, this.crc_extra, j );
999010024
}
999110025

999210026

@@ -15595,7 +15629,7 @@ mavlink20.map = {
1559515629
65: { format: '<IHHHHHHHHHHHHHHHHHHBB', type: mavlink20.messages.rc_channels, order_map: [0, 19, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20], crc_extra: 118 },
1559615630
66: { format: '<HBBBB', type: mavlink20.messages.request_data_stream, order_map: [1, 2, 3, 0, 4], crc_extra: 148 },
1559715631
67: { format: '<HBB', type: mavlink20.messages.data_stream, order_map: [1, 0, 2], crc_extra: 21 },
15598-
69: { format: '<hhhhHB', type: mavlink20.messages.manual_control, order_map: [5, 0, 1, 2, 3, 4], crc_extra: 243 },
15632+
69: { format: '<hhhhHBHBhhhhhhhh', type: mavlink20.messages.manual_control, order_map: [5, 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], crc_extra: 243 },
1559915633
70: { format: '<HHHHHHHHBBHHHHHHHHHH', type: mavlink20.messages.rc_channels_override, order_map: [8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], crc_extra: 124 },
1560015634
73: { format: '<ffffiifHHBBBBBB', type: mavlink20.messages.mission_item_int, order_map: [9, 10, 7, 11, 8, 12, 13, 0, 1, 2, 3, 4, 5, 6, 14], crc_extra: 38 },
1560115635
74: { format: '<ffffhH', type: mavlink20.messages.vfr_hud, order_map: [0, 1, 4, 5, 2, 3], crc_extra: 20 },

0 commit comments

Comments
 (0)