Skip to content

Commit

Permalink
Merge pull request #8 from ethz-asl/fix/switch_values
Browse files Browse the repository at this point in the history
Fix/switch values
  • Loading branch information
ZacharyTaylor authored Feb 20, 2018
2 parents ce3c192 + af7aca5 commit 953a5a5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion mavros/src/plugins/rc_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ class RCIOPlugin : public MavRosPlugin {
inputs.back() = std::min(std::max(inputs.back(),-1.0),1.0);
}

//force switches to be in extreme positions
for(size_t i = 4; i < 7; ++i){
//1 is active so we are a bit conservative here
if(inputs[i] < 0.5){
inputs[i] = -1.0;
}else{
inputs[i] = 1.0;
}
}

//weird ordering and inversions to match asctec interface
rcin_msg.axes.push_back(inputs[2]);
rcin_msg.axes.push_back(-inputs[1]);
Expand Down Expand Up @@ -133,7 +143,7 @@ class RCIOPlugin : public MavRosPlugin {
#undef SET_RC_IN

send_rc_data(uas->synchronise_stamp(port.time_boot_ms), port.rssi);

}

void handle_rc_channels(const mavlink_message_t *msg, uint8_t sysid, uint8_t compid) {
Expand Down

0 comments on commit 953a5a5

Please sign in to comment.