diff --git a/ground/gcs/src/plugins/opmap/opmap_edit_waypoint_dialog.cpp b/ground/gcs/src/plugins/opmap/opmap_edit_waypoint_dialog.cpp index 0b41bc21f..9e9af7aeb 100644 --- a/ground/gcs/src/plugins/opmap/opmap_edit_waypoint_dialog.cpp +++ b/ground/gcs/src/plugins/opmap/opmap_edit_waypoint_dialog.cpp @@ -38,6 +38,8 @@ opmap_edit_waypoint_dialog::opmap_edit_waypoint_dialog(QWidget *parent, QAbstrac ui(new Ui::opmap_edit_waypoint_dialog) { ui->setupUi(this); + ui->pushButtonPrevious->setEnabled(false); + ui->pushButtonNext->setEnabled(false); connect(ui->checkBoxLocked, SIGNAL(toggled(bool)), this, SLOT(enableEditWidgets(bool))); connect(ui->cbMode, SIGNAL(currentIndexChanged(int)), this, SLOT(setupModeWidgets())); connect(ui->cbCondition, SIGNAL(currentIndexChanged(int)), this, SLOT(setupConditionWidgets())); @@ -77,10 +79,27 @@ opmap_edit_waypoint_dialog::opmap_edit_waypoint_dialog(QWidget *parent, QAbstrac mapper->addMapping(ui->sbJump, flightDataModel::JUMPDESTINATION); mapper->addMapping(ui->sbError, flightDataModel::ERRORDESTINATION); connect(itemSelection, SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), this, SLOT(currentRowChanged(QModelIndex, QModelIndex))); + + ui->descriptionCommandLabel->setText(tr("
The Command specifies the transition to the next state (aka waypoint), as well as when it " + "is to be executed. This command will always switch to another waypoint instantly, but which waypoint depends on the Condition.
" + "The JumpDestination is the waypoint to jump to in unconditional or conditional jumps.
")); + + ui->descriptionErrorDestinationLabel->setText(tr("The ErrorDestination is special; it allows exception handling based on the PathFollower. " + "If the PathFollower indicates that it is unable to execute Mode, it indicates this error in the PathStatus UAVObject. " + "If that happens, then the sequence of waypoints is interrupted and the waypoint in ErrorDestination becomes the Active Waypoint. " + "A thinkable use case for this functionality would be to steer towards a safe emergency landing site if the engine fails.
")); } + void opmap_edit_waypoint_dialog::currentIndexChanged(int index) { ui->lbNumber->setText(QString::number(index + 1)); + ui->wpNumberSpinBox->setValue(index + 1); + + bool isMin = (index == 0); + bool isMax = ((index + 1) == mapper->model()->rowCount()); + ui->pushButtonPrevious->setEnabled(!isMin); + ui->pushButtonNext->setEnabled(!isMax); + QModelIndex idx = mapper->model()->index(index, 0); if (index == itemSelection->currentIndex().row()) { return; @@ -98,162 +117,205 @@ void opmap_edit_waypoint_dialog::setupModeWidgets() { MapDataDelegate::ModeOptions mode = (MapDataDelegate::ModeOptions)ui->cbMode->itemData(ui->cbMode->currentIndex()).toInt(); + ui->modeParam1->setText(""); + ui->modeParam2->setText(""); + ui->modeParam3->setText(""); + ui->modeParam4->setText(""); + ui->modeParam1->setEnabled(false); + ui->modeParam2->setEnabled(false); + ui->modeParam3->setEnabled(false); + ui->modeParam4->setEnabled(false); + ui->dsb_modeParam1->setEnabled(false); + ui->dsb_modeParam2->setEnabled(false); + ui->dsb_modeParam3->setEnabled(false); + ui->dsb_modeParam4->setEnabled(false); + switch (mode) { case MapDataDelegate::MODE_GOTOENDPOINT: + ui->descriptionModeLabel->setText(tr("The Autopilot will try to hold position at a fixed end-coordinate. " + "If elsewhere, the craft will steer towards the coordinate but not " + "necessarily in a straight line as drift will not be compensated.
")); + break; case MapDataDelegate::MODE_FOLLOWVECTOR: + ui->descriptionModeLabel->setText(tr("The Autopilot will attempt to stay on a defined trajectory from the previous waypoint " + "to the current one. Any deviation from this path, for example by wind, will be corrected. " + "This is the best and obvious choice for direct straight-line (rhumb line) navigation in any vehicle.
")); + break; case MapDataDelegate::MODE_CIRCLERIGHT: + ui->descriptionModeLabel->setText(tr("The Autopilot will attempt to fly a circular trajectory around a waypoint. " + "The curve radius is defined by the distance from the previous waypoint, therefore setting the coordinate " + "of the waypoint perpendicular to the previous flight path leg (and on the side the vehicle is supposed to turn toward!) " + "will lead to the smoothest possible transition.
Staying in FlyCircle for a prolonged time will lead to a circular " + "loiter trajectory around a waypoint, but this mode can be used in combination with the PointingTowardsNext-EndCondition " + "to stay on the curved trajectory until the vehicle is moving towards the next waypoint, which allows for very controlled " + "turns in flight paths.
")); + break; case MapDataDelegate::MODE_CIRCLELEFT: + ui->descriptionModeLabel->setText(tr("The Autopilot will attempt to fly a circular trajectory around a waypoint. " + "The curve radius is defined by the distance from the previous waypoint, therefore setting the coordinate " + "of the waypoint perpendicular to the previous flight path leg (and on the side the vehicle is supposed to turn toward!) " + "will lead to the smoothest possible transition.
Staying in FlyCircle for a prolonged time will lead to a circular " + "loiter trajectory around a waypoint, but this mode can be used in combination with the PointingTowardsNext-EndCondition " + "to stay on the curved trajectory until the vehicle is moving towards the next waypoint, which allows for very controlled " + "turns in flight paths.
")); + break; case MapDataDelegate::MODE_DISARMALARM: - case MapDataDelegate::MODE_LAND: - case MapDataDelegate::MODE_BRAKE: - ui->modeParam1->setVisible(false); - ui->modeParam2->setVisible(false); - ui->modeParam3->setVisible(false); - ui->modeParam4->setVisible(false); - ui->dsb_modeParam1->setVisible(false); - ui->dsb_modeParam2->setVisible(false); - ui->dsb_modeParam3->setVisible(false); - ui->dsb_modeParam4->setVisible(false); - break; - case MapDataDelegate::MODE_VELOCITY: - ui->modeParam1->setVisible(true); - ui->modeParam2->setVisible(true); - ui->modeParam3->setVisible(true); - ui->modeParam4->setVisible(false); - ui->dsb_modeParam1->setVisible(true); - ui->dsb_modeParam2->setVisible(true); - ui->dsb_modeParam3->setVisible(true); - ui->dsb_modeParam4->setVisible(false); - break; - case MapDataDelegate::MODE_FIXEDATTITUDE: - ui->modeParam1->setText("pitch"); - ui->modeParam2->setText("roll"); - ui->modeParam3->setText("yaw"); - ui->modeParam4->setText("thrust"); - ui->modeParam1->setVisible(true); - ui->modeParam2->setVisible(true); - ui->modeParam3->setVisible(true); - ui->modeParam4->setVisible(true); - ui->dsb_modeParam1->setVisible(true); - ui->dsb_modeParam2->setVisible(true); - ui->dsb_modeParam3->setVisible(true); - ui->dsb_modeParam4->setVisible(true); - break; - case MapDataDelegate::MODE_SETACCESSORY: - ui->modeParam1->setText("Acc.channel"); - ui->modeParam2->setText("Value"); - ui->modeParam1->setVisible(true); - ui->modeParam2->setVisible(true); - ui->modeParam3->setVisible(false); - ui->modeParam4->setVisible(false); - ui->dsb_modeParam1->setVisible(true); - ui->dsb_modeParam2->setVisible(true); - ui->dsb_modeParam3->setVisible(false); - ui->dsb_modeParam4->setVisible(false); + ui->descriptionModeLabel->setText(tr("The Autopilot is instructed to force a CRITICAL PathFollower alarm. A PathFollower alarm of type CRITICAL " + "is supposed to automatically set the vehicle to DISARMED and thus disable the engines, cut fuel supply, ...
" + "The PathFollower can do this during any mode in case of emergency, but through this mode the PathPlanner " + "can force this behavior, for example after a landing.
")); break; case MapDataDelegate::MODE_AUTOTAKEOFF: - // FIXME: Do nothing? + // FixedWing do not use parameters, vertical velocity can be set for multirotors as param0 + ui->modeParam1->setText("Speed (m/s):"); + ui->modeParam1->setEnabled(true); + ui->dsb_modeParam1->setEnabled(true); + ui->descriptionModeLabel->setText(tr("The Autopilot will engage a hardcoded, fully automated takeoff sequence. " + "Using a fixed attitude, heading towards the destination waypoint for a fixed wing or " + "a vertical climb for a multirotor.
" + "Vertical speed in meters/second, for multirotors. (Will be around 0.6m/s)
")); + break; + case MapDataDelegate::MODE_LAND: + // FixedWing do not use parameters, vertical velocity can be set for multirotors as param0 (0.1/0.6m/s range) + ui->modeParam1->setText("Speed (m/s):"); + ui->modeParam1->setEnabled(true); + ui->dsb_modeParam1->setEnabled(true); + ui->descriptionModeLabel->setText(tr("The Autopilot will engage a hardcoded, fully automated landing sequence. " + "Using a fixed attitude, heading towards the destination waypoint for a fixed wing or " + "a vertical descent for a multirotor.
" + "Vertical speed in meters/second, for multirotors. (Will be around 0.6m/s)
")); + break; + case MapDataDelegate::MODE_BRAKE: + ui->descriptionModeLabel->setText(tr("This mode is used internally by assisted flight modes with multirotors to slow down the velocity.
")); + break; + case MapDataDelegate::MODE_VELOCITY: + ui->descriptionModeLabel->setText(tr("This mode is used internally by assisted flight modes with multirotors to maintain a velocity in 3D space.
")); + break; + case MapDataDelegate::MODE_FIXEDATTITUDE: + ui->modeParam1->setText("Roll:"); + ui->modeParam2->setText("Pitch:"); + ui->modeParam3->setText("Yaw:"); + ui->modeParam4->setText("Thrust:"); + ui->modeParam1->setEnabled(true); + ui->modeParam2->setEnabled(true); + ui->modeParam3->setEnabled(true); + ui->modeParam4->setEnabled(true); + ui->dsb_modeParam1->setEnabled(true); + ui->dsb_modeParam2->setEnabled(true); + ui->dsb_modeParam3->setEnabled(true); + ui->dsb_modeParam4->setEnabled(true); + ui->descriptionModeLabel->setText(tr("The Autopilot will play dumb and simply instruct the Stabilization Module to assume a certain Roll, Pitch angle " + "and optionally a Yaw rotation rate and Thrust setting. This allows for very simple auto-takeoff and " + "auto-landing maneuvers.
" + "Roll(+-180°) and Pitch (+-90°) angles in degrees
" + "Yaw rate in deg/s
" + "Thrust from 0 to 1
")); + break; + case MapDataDelegate::MODE_SETACCESSORY: + ui->modeParam1->setText("Acc.channel:"); + ui->modeParam2->setText("Value:"); + ui->modeParam1->setEnabled(true); + ui->modeParam2->setEnabled(true); + ui->dsb_modeParam1->setEnabled(true); + ui->dsb_modeParam2->setEnabled(true); + ui->descriptionModeLabel->setText(tr("Not yet implemented.
")); + // ui->descriptionModeLabel->setText(tr("In this mode, the PathFollower is supposed to inject a specific value (-1|0|+1 range) into an AccessoryDesired channel. " + // "This would allow one to control arbitrary auxilliary components from the PathPlanner like flaps and landing gear.
")); + break; + default: + ui->descriptionModeLabel->setText(tr("")); break; } } + void opmap_edit_waypoint_dialog::setupConditionWidgets() { MapDataDelegate::EndConditionOptions mode = (MapDataDelegate::EndConditionOptions)ui->cbCondition->itemData(ui->cbCondition->currentIndex()).toInt(); + ui->condParam1->setText(""); + ui->condParam2->setText(""); + ui->condParam3->setText(""); + ui->condParam4->setText(""); + ui->condParam1->setEnabled(false); + ui->condParam2->setEnabled(false); + ui->condParam3->setEnabled(false); + ui->condParam4->setEnabled(false); + ui->dsb_condParam1->setEnabled(false); + ui->dsb_condParam2->setEnabled(false); + ui->dsb_condParam3->setEnabled(false); + ui->dsb_condParam4->setEnabled(false); + switch (mode) { case MapDataDelegate::ENDCONDITION_NONE: + ui->descriptionConditionLabel->setText(tr("This condition is always false. A WaypointAction with EndCondition to None will stay in " + "its mode until forever, or until an Error in the PathFollower triggers the ErrorJump. (For example out of fuel!)
")); + break; case MapDataDelegate::ENDCONDITION_IMMEDIATE: + ui->descriptionConditionLabel->setText(tr("Opposite to the None condition, the immediate condition is always true.
")); + break; case MapDataDelegate::ENDCONDITION_PYTHONSCRIPT: - ui->condParam1->setVisible(false); - ui->condParam2->setVisible(false); - ui->condParam3->setVisible(false); - ui->condParam4->setVisible(false); - ui->dsb_condParam1->setVisible(false); - ui->dsb_condParam2->setVisible(false); - ui->dsb_condParam3->setVisible(false); - ui->dsb_condParam4->setVisible(false); + ui->descriptionConditionLabel->setText(tr("Not yet implemented.
")); break; case MapDataDelegate::ENDCONDITION_TIMEOUT: - ui->condParam1->setVisible(true); - ui->condParam2->setVisible(false); - ui->condParam3->setVisible(false); - ui->condParam4->setVisible(false); - ui->dsb_condParam1->setVisible(true); - ui->dsb_condParam2->setVisible(false); - ui->dsb_condParam3->setVisible(false); - ui->dsb_condParam4->setVisible(false); - ui->condParam1->setText("Timeout(s)"); + ui->condParam1->setEnabled(true); + ui->dsb_condParam1->setEnabled(true); + ui->condParam1->setText("Timeout (s)"); + ui->descriptionConditionLabel->setText(tr("The Timeout condition measures time this waypoint is active (in seconds).
")); break; case MapDataDelegate::ENDCONDITION_DISTANCETOTARGET: - ui->condParam1->setVisible(true); - ui->condParam2->setVisible(true); - ui->condParam3->setVisible(false); - ui->condParam4->setVisible(false); - ui->dsb_condParam1->setVisible(true); - ui->dsb_condParam2->setVisible(true); - ui->dsb_condParam3->setVisible(false); - ui->dsb_condParam4->setVisible(false); - ui->condParam1->setText("Distance(m)"); - ui->condParam2->setText("Flag(0=2D,1=3D)"); // FIXME + ui->condParam1->setEnabled(true); + ui->condParam2->setEnabled(true); + ui->dsb_condParam1->setEnabled(true); + ui->dsb_condParam2->setEnabled(true); + ui->condParam1->setText("Distance (m):"); + ui->condParam2->setText("Flag:"); + ui->descriptionConditionLabel->setText(tr("The DistanceToTarget condition measures the distance to a waypoint, returns true if closer.
" + "Flag: 0= 2D distance, 1= 3D distance
")); break; case MapDataDelegate::ENDCONDITION_LEGREMAINING: - ui->condParam1->setVisible(true); - ui->condParam2->setVisible(false); - ui->condParam3->setVisible(false); - ui->condParam4->setVisible(false); - ui->dsb_condParam1->setVisible(true); - ui->dsb_condParam2->setVisible(false); - ui->dsb_condParam3->setVisible(false); - ui->dsb_condParam4->setVisible(false); - ui->condParam1->setText("Relative Distance(0=complete,1=just starting)"); + ui->condParam1->setEnabled(true); + ui->dsb_condParam1->setEnabled(true); + ui->condParam1->setText("Relative Distance:"); + ui->descriptionConditionLabel->setText(tr("The LegRemaining condition measures how far the pathfollower got on a linear path segment, returns true " + "if closer to destination(path more complete).
" + "0=complete, 1=just starting
")); break; case MapDataDelegate::ENDCONDITION_BELOWERROR: - ui->condParam1->setVisible(true); - ui->condParam2->setVisible(false); - ui->condParam3->setVisible(false); - ui->condParam4->setVisible(false); - ui->dsb_condParam1->setVisible(true); - ui->dsb_condParam2->setVisible(false); - ui->dsb_condParam3->setVisible(false); - ui->dsb_condParam4->setVisible(false); - ui->condParam1->setText("error margin (in m)"); + ui->condParam1->setEnabled(true); + ui->dsb_condParam1->setEnabled(true); + ui->condParam1->setText("Error margin (m):"); + ui->descriptionConditionLabel->setText(tr("The BelowError condition measures the error on a path segment, returns true if error is below margin in meters.
")); break; case MapDataDelegate::ENDCONDITION_ABOVEALTITUDE: - ui->condParam1->setVisible(true); - ui->condParam2->setVisible(false); - ui->condParam3->setVisible(false); - ui->condParam4->setVisible(false); - ui->dsb_condParam1->setVisible(true); - ui->dsb_condParam2->setVisible(false); - ui->dsb_condParam3->setVisible(false); - ui->dsb_condParam4->setVisible(false); - ui->condParam1->setText("Altitude in meters (negative)"); + ui->condParam1->setEnabled(true); + ui->dsb_condParam1->setEnabled(true); + ui->condParam1->setText("Altitude (m):"); + ui->descriptionConditionLabel->setText(tr("The AboveAltitude condition measures the flight altitude relative to home position, returns true if " + "above critical altitude.
WARNING! altitudes set here are always negative if above Home. (down coordinate)
")); break; case MapDataDelegate::ENDCONDITION_ABOVESPEED: - ui->condParam1->setVisible(true); - ui->condParam2->setVisible(true); - ui->condParam3->setVisible(false); - ui->condParam4->setVisible(false); - ui->dsb_condParam1->setVisible(true); - ui->dsb_condParam2->setVisible(true); - ui->dsb_condParam3->setVisible(false); - ui->dsb_condParam4->setVisible(false); - ui->condParam1->setText("Speed in meters/second"); - ui->condParam2->setText("flag: 0=groundspeed 1=airspeed"); + ui->condParam1->setEnabled(true); + ui->condParam2->setEnabled(true); + ui->dsb_condParam1->setEnabled(true); + ui->dsb_condParam2->setEnabled(true); + ui->condParam1->setText("Speed (m/s):"); + ui->condParam2->setText("Flag:"); + ui->descriptionConditionLabel->setText(tr("The AboveSpeed measures the movement speed(3D), returns true if above critical speed
" + "Speed in meters / second
" + "Flag: 0= groundspeed 1= airspeed
")); break; case MapDataDelegate::ENDCONDITION_POINTINGTOWARDSNEXT: - ui->condParam1->setVisible(true); - ui->condParam2->setVisible(false); - ui->condParam3->setVisible(false); - ui->condParam4->setVisible(false); - ui->dsb_condParam1->setVisible(true); - ui->dsb_condParam2->setVisible(false); - ui->dsb_condParam3->setVisible(false); - ui->dsb_condParam4->setVisible(false); - ui->condParam1->setText("Degrees variation allowed"); + ui->condParam1->setEnabled(true); + ui->dsb_condParam1->setEnabled(true); + ui->condParam1->setText("Degrees:"); + ui->descriptionConditionLabel->setText(tr("The PointingTowardsNext condition measures the horizontal movement vector direction relative " + "to the next waypoint regardless whether this waypoint will ever be active " + "(Command could jump to a different waypoint on true).
This is useful for curve segments where " + "the craft should stop circling when facing a certain way(usually the next waypoint), " + "returns true if within a certain angular margin in degrees.
")); break; default: - + ui->descriptionConditionLabel->setText(tr("")); break; } } @@ -304,7 +366,6 @@ void opmap_edit_waypoint_dialog::on_pushButtonApply_clicked() mapper->submit(); } - void opmap_edit_waypoint_dialog::enableEditWidgets(bool value) { QWidget *w; diff --git a/ground/gcs/src/plugins/opmap/opmap_edit_waypoint_dialog.ui b/ground/gcs/src/plugins/opmap/opmap_edit_waypoint_dialog.ui index 597c3e6ac..4dfb28d2b 100644 --- a/ground/gcs/src/plugins/opmap/opmap_edit_waypoint_dialog.ui +++ b/ground/gcs/src/plugins/opmap/opmap_edit_waypoint_dialog.ui @@ -83,7 +83,7 @@ -