Skip to content
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

Corrections on DO_SET_SERVO mission item #4965

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ROMFS/px4fmu_common/init.d/rc.interface
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ then

if mixer load $OUTPUT_DEV $MIXER_FILE
then
echo "INFO [init] Mixer: $MIXER_FILE on $OUTPUT_DEV"
echo "INFO [init] Mixer: $MIXER_FILE on $OUTPUT_DEV" >> $LOG_FILE
else
echo "ERROR [init] Error loading mixer: $MIXER_FILE"
echo "ERROR:[init] Could not load mixer: $MIXER_FILE" >> $LOG_FILE
Expand Down Expand Up @@ -137,7 +137,7 @@ then
then
if mixer load $OUTPUT_AUX_DEV $MIXER_AUX_FILE
then
echo "INFO [init] Mixer: $MIXER_AUX_FILE on $OUTPUT_AUX_DEV"
echo "INFO [init] Mixer: $MIXER_AUX_FILE on $OUTPUT_AUX_DEV" >> $LOG_FILE
else
echo "ERROR [init] Error loading mixer: $MIXER_AUX_FILE"
echo "ERROR [init] Could not load mixer: $MIXER_AUX_FILE" >> $LOG_FILE
Expand Down
23 changes: 19 additions & 4 deletions ROMFS/px4fmu_common/mixers/pass.aux.mix
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
# Manual pass through mixer for servo outputs 1-4

# AUX1 channel (select RC channel with RC_MAP_AUX1 param)
M: 1
M: 2
O: 10000 10000 0 -10000 10000
S: 2 1 10000 10000 0 -10000 10000
S: 3 5 10000 10000 0 -10000 10000

# AUX2 channel (select RC channel with RC_MAP_AUX2 param)
M: 1
M: 2
O: 10000 10000 0 -10000 10000
S: 2 2 10000 10000 0 -10000 10000
S: 3 6 10000 10000 0 -10000 10000

# AUX3 channel (select RC channel with RC_MAP_AUX3 param)
M: 1
M: 2
O: 10000 10000 0 -10000 10000
S: 2 3 10000 10000 0 -10000 10000
S: 3 7 10000 10000 0 -10000 10000

# FLAPS channel (select RC channel with RC_MAP_FLAPS param)
M: 1
M: 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be removed without ruining your use case? Or should we create a different mixer file for non-manual payload control?

O: 10000 10000 0 -10000 10000
S: 2 4 10000 10000 0 -10000 10000
S: 3 4 10000 10000 0 -10000 10000

# AUX5 channel (select servo id 5 in mission item)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to check if this can conflict with camera triggering.

M: 1
O: 10000 10000 0 -10000 10000
S: 2 5 10000 10000 0 -10000 10000

# AUX6 channel (select servo id 6 in mission item)
M: 1
O: 10000 10000 0 -10000 10000
S: 2 6 10000 10000 0 -10000 10000

36 changes: 15 additions & 21 deletions src/modules/navigator/mission_feasibility_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ bool MissionFeasibilityChecker::checkMissionFeasible(orb_advert_t *mavlink_log_p
} else {
failed = failed || !checkMissionFeasibleFixedwing(dm_current, nMissionItems, geofence, home_alt, home_valid);
}

return !failed;
}

Expand Down Expand Up @@ -255,6 +254,19 @@ bool MissionFeasibilityChecker::checkMissionItemValidity(dm_item_t dm_current, s
mavlink_log_critical(_mavlink_log_pub, "Rejecting mission item %i: unsupported cmd: %d", (int)(i+1), (int)missionitem.nav_cmd);
return false;
}
/* Check non navigation item */
if (missionitem.nav_cmd == NAV_CMD_DO_SET_SERVO){
/* check actuator number */
if (missionitem.params[0] < 1 || missionitem.params[0] > 6) {
mavlink_log_critical(_mavlink_log_pub, "Actuator number %d is out of bounds 1..6", (int)missionitem.params[0]);
return false;
}
/* check actuator value */
if (missionitem.params[1] < -2000 || missionitem.params[1] > 2000) {
mavlink_log_critical(_mavlink_log_pub, "Actuator value %d is out of bounds -2000..2000", (int)missionitem.params[1]);
return false;
}
}

// check if the mission starts with a land command while the vehicle is landed
if (missionitem.nav_cmd == NAV_CMD_LAND &&
Expand Down Expand Up @@ -349,26 +361,8 @@ MissionFeasibilityChecker::check_dist_1wp(dm_item_t dm_current, size_t nMissionI
for (unsigned i = 0; i < nMissionItems; i++) {
if (dm_read(dm_current, i,
&mission_item, sizeof(mission_item_s)) == sizeof(mission_item_s)) {
/* Check non navigation item */
if (mission_item.nav_cmd == NAV_CMD_DO_SET_SERVO){

/* check actuator number */
if (mission_item.params[0] < 0 || mission_item.params[0] > 5) {
mavlink_log_critical(_mavlink_log_pub, "Actuator number %d is out of bounds 0..5", (int)mission_item.params[0]);
warning_issued = true;
return false;
}
/* check actuator value */
if (mission_item.params[1] < -2000 || mission_item.params[1] > 2000) {
mavlink_log_critical(_mavlink_log_pub, "Actuator value %d is out of bounds -2000..2000", (int)mission_item.params[1]);
warning_issued = true;
return false;
}
}
/* check only items with valid lat/lon */
else if (isPositionCommand(mission_item.nav_cmd)) {

/* check distance from current position to item */
if (isPositionCommand(mission_item.nav_cmd)) {
/* check distance from current position to item */
float dist_to_1wp = get_distance_to_next_waypoint(
mission_item.lat, mission_item.lon, curr_lat, curr_lon);

Expand Down