New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP - Live mixer tuning through mavlink including px4io #5726
Closed
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
fe3e12d
Update mavlink submodule
crashmatt a5603a4
Changed mavlink module to crashmatt/mixer_ap branch
crashmatt 4f4eac7
PX4Firmware module update.
crashmatt 7ebab78
Updated PX4Firmware module for mixer configuration
crashmatt 8aa7fc6
Update to PX4Firmware module for mixer configuration
crashmatt 4e2dcbe
Fix mavlink and PX4Firmware submodules to crashmatt forks
crashmatt 8897945
Added mixer configuration support to AP_HAL and AP_HAL_PX4
crashmatt 7e27a5a
Conditional compile for AP_HAL_PX4 mixer configuration
crashmatt 79320d9
Most of mavlink infrastructure constructed for mixer configuration
crashmatt d9d5a09
Second prototype of mixer configuration mavlink interface
crashmatt 3d20299
Yet another fix for submodules on crashmatt fork
crashmatt 929c2c7
Moved and modified MIXER_DATA message
crashmatt 3d4414d
Working mavlink mixer config for count and subcount
crashmatt 8d64ce1
Add support for mavlink mixer get type and get parameter
crashmatt 86d04e3
Fix mixer configuration for normal build
crashmatt 8440648
Mavilnk support for mixer parameter setting
crashmatt d92194d
PX4Firmware update for mixer config
crashmatt 662b292
Fix error reporting for set mixer parameter
crashmatt File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
#include <AP_HAL/AP_HAL.h> | ||
#include "AP_RCMixer.h" | ||
#include <GCS_MAVLink/GCS.h> | ||
|
||
extern AP_HAL::HAL& hal; | ||
|
||
// object constructor. | ||
AP_RCMixer::AP_RCMixer(void) | ||
{ | ||
_mixer_data.group = 0;; | ||
_mixer_data.mixer = 0; | ||
_mixer_data.submixer = 0; | ||
_mixer_data.parameter = 0; | ||
_mixer_data.type = 0; | ||
_mixer_data.int_value = -1; | ||
_mixer_data.param_value = 0.0; | ||
_mixer_data.param_type = 0.0; | ||
|
||
_status = AP_RCMIXER_STATUS_WAITING; | ||
} | ||
|
||
void AP_RCMixer::handle_msg(const mavlink_message_t *msg){ | ||
#if defined(MIXER_CONFIGURATION) | ||
switch (msg->msgid) { | ||
case MAVLINK_MSG_ID_MIXER_DATA_REQUEST: { | ||
mavlink_mixer_data_request_t packet; | ||
mavlink_msg_mixer_data_request_decode(msg, &packet); | ||
|
||
_mixer_data.group = packet.mixer_group; | ||
_mixer_data.mixer = packet.mixer_index; | ||
_mixer_data.submixer = packet.mixer_sub_index; | ||
_mixer_data.parameter = packet.parameter_index; | ||
_mixer_data.type = packet.data_type; | ||
|
||
// Make sure we are talking to px4io only | ||
if(packet.mixer_group != 1){ | ||
_mixer_data.int_value = -100; | ||
_mixer_data.param_value = 0.0; | ||
_status = AP_RCMIXER_STATUS_SEND_DATA; | ||
return; | ||
} | ||
|
||
switch(packet.data_type){ | ||
case MIXER_DATA_TYPE_MIXER_COUNT: | ||
_mixer_data.int_value = hal.rcout->get_mixer_count(); | ||
_mixer_data.param_value = 0.0; | ||
break; | ||
case MIXER_DATA_TYPE_SUBMIXER_COUNT: | ||
_mixer_data.int_value = hal.rcout->get_submixer_count(_mixer_data.mixer); | ||
_mixer_data.param_value = 0.0; | ||
break; | ||
case MIXER_DATA_TYPE_MIXTYPE: | ||
_mixer_data.int_value = hal.rcout->get_mixer_type(_mixer_data.mixer, _mixer_data.submixer); | ||
_mixer_data.param_value = 0.0; | ||
break; | ||
case MIXER_DATA_TYPE_PARAMETER: | ||
_mixer_data.int_value = 0; | ||
hal.rcout->get_mixer_parameter(_mixer_data.mixer, _mixer_data.submixer, _mixer_data.parameter, &_mixer_data.param_value); | ||
_mixer_data.param_type = MAVLINK_TYPE_FLOAT; | ||
break; | ||
default: | ||
break; | ||
} | ||
_status = AP_RCMIXER_STATUS_SEND_DATA; | ||
break; | ||
} | ||
case MAVLINK_MSG_ID_MIXER_PARAMETER_SET: { | ||
mavlink_mixer_parameter_set_t packet; | ||
mavlink_msg_mixer_parameter_set_decode(msg, &packet); | ||
|
||
if( packet.mixer_group != 1){ | ||
break; | ||
} | ||
|
||
_mixer_data.group = packet.mixer_group; | ||
_mixer_data.mixer = packet.mixer_index; | ||
_mixer_data.submixer = packet.mixer_sub_index; | ||
_mixer_data.parameter = packet.parameter_index; | ||
_mixer_data.type = MIXER_DATA_TYPE_PARAMETER; | ||
_mixer_data.param_value = packet.param_value; | ||
_mixer_data.param_type = MAVLINK_TYPE_FLOAT; | ||
|
||
if (hal.rcout->set_mixer_parameter(packet.mixer_index, packet.mixer_sub_index, _mixer_data.parameter, _mixer_data.param_value)) { | ||
_mixer_data.int_value = 0; | ||
} else { | ||
_mixer_data.int_value = -1; | ||
} | ||
_status = AP_RCMIXER_STATUS_SEND_DATA; | ||
break; | ||
} | ||
default: | ||
break; | ||
} | ||
#endif //MIXER_CONFIGURATION | ||
} | ||
|
||
//MAVLink mixer data send | ||
void AP_RCMixer::send_mixer_data(mavlink_channel_t chan){ | ||
// GCS_MAVLINK::send_statustext_chan(MAV_SEVERITY_INFO, chan, "send_mixer_data"); | ||
switch(int(_status)){ | ||
case AP_RCMIXER_STATUS_SEND_DATA: | ||
mavlink_msg_mixer_data_send(chan, | ||
(uint8_t) _mixer_data.group, | ||
(uint8_t) _mixer_data.mixer, | ||
(uint8_t) _mixer_data.submixer, | ||
(uint8_t) _mixer_data.parameter, | ||
(uint8_t) _mixer_data.type, | ||
_mixer_data.int_value, | ||
_mixer_data.param_value, | ||
_mixer_data.param_type | ||
); | ||
_status = AP_RCMIXER_STATUS_WAITING; | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is why Travis is failing. Changes like this are not allowed. You need to do separate PRs for submodules. Travis will only pull in branches from origin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PX4 project appears to pull submodules from fork/branch. I might have been fooling myself.
Next step is to get those mavlnk messages fixed.
Considering the volume of real world fixed wing users I am tending to think that ArduPlane is best bet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Travis will pull whatever is in the submodules file, Semaphore might not. In any case, this would always have to be removed before merging. The error was there because the commit didn't exist in GitHub at the time - apparently it's there now so I've restarted the build and it worked; there are still errors but not related to this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Francisco. Travis is giving an error I understand. Semaphore is stuck with the module change as you suggest.