Changeset 77 in flair-src


Ignore:
Timestamp:
Sep 21, 2016, 11:40:56 AM (4 years ago)
Author:
Thomas Fuhrmann
Message:

Change the GUI of MavPlanner? to match with mission planning (only GUI is working)

Location:
branches/mavlink/tools/Controller/Mavlink/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/mavlink/tools/Controller/Mavlink/src/GuiFlair.cpp

    r71 r77  
    3737}
    3838
    39 void GuiFlair::MissionInitialize() {
    40         cout << "MavPlanner GuiFlair MissionInitialize" << endl;
    41 }
    42 
    4339void GuiFlair::MissionStart() {
    4440        cout << "MavPlanner GuiFlair MissionStart" << endl;
     
    4945}
    5046
    51 void GuiFlair::MissionKill() {
    52         cout << "MavPlanner GuiFlair MissionKill" << endl;
     47void GuiFlair::MissionResume() {
     48        cout << "MavPlanner GuiFlair MissionResume" << endl;
    5349}
    5450
    55 void GuiFlair::WptSend() {
    56         cout << "MavPlanner GuiFlair WptSend" << endl;
     51void GuiFlair::MissionSend() {
     52        cout << "MavPlanner GuiFlair MissionSend" << endl;
    5753}
    58 
    59 void GuiFlair::WptClear() {
    60         cout << "MavPlanner GuiFlair WptClear" << endl;
    61 }
    62 
    63 void GuiFlair::WptLoopSend() {
    64         cout << "MavPlanner GuiFlair WptLoopSend" << endl;
    65 }
  • branches/mavlink/tools/Controller/Mavlink/src/GuiFlair.h

    r71 r77  
    3838protected:
    3939
    40   virtual void MissionInitialize();
    4140  virtual void MissionStart();
    4241  virtual void MissionStop();
    43   virtual void MissionKill();
    44   virtual void WptSend();
    45   virtual void WptClear();
    46   virtual void WptLoopSend();
     42  virtual void MissionResume();
     43  virtual void MissionSend();
    4744};
    4845
  • branches/mavlink/tools/Controller/Mavlink/src/GuiGcs.cpp

    r71 r77  
    4040}
    4141
    42 void GuiGcs::MissionInitialize() {
    43   cout << "MavPlanner GuiGcs MissionInitialize" << endl;
    44   outputSocket->SendMessage("MavPlanner GuiGcs MissionInitialize");
    45 }
    46 
    4742void GuiGcs::MissionStart() {
    4843  cout << "MavPlanner GuiGcs MissionStart" << endl;
     
    5550}
    5651
    57 void GuiGcs::MissionKill() {
    58   cout << "MavPlanner GuiGcs MissionKill" << endl;
    59   outputSocket->SendMessage("MavPlanner GuiGcs MissionKill");
     52void GuiGcs::MissionResume() {
     53  cout << "MavPlanner GuiGcs MissionResume" << endl;
     54  outputSocket->SendMessage("MavPlanner GuiGcs MissionResume");
    6055}
    6156
    62 void GuiGcs::WptSend() {
    63   cout << "MavPlanner GuiGcs WptSend" << endl;
     57void GuiGcs::MissionSend() {
     58  cout << "MavPlanner GuiGcs MissionSend" << endl;
    6459}
    65 
    66 void GuiGcs::WptClear() {
    67   cout << "MavPlanner GuiGcs WptClear" << endl;
    68 }
    69 
    70 void GuiGcs::WptLoopSend() {
    71   cout << "MavPlanner GuiGcs WptLoopSend" << endl;
    72 }
  • branches/mavlink/tools/Controller/Mavlink/src/GuiGcs.h

    r71 r77  
    3939protected:
    4040
    41   virtual void MissionInitialize();
    4241  virtual void MissionStart();
    4342  virtual void MissionStop();
    44   virtual void MissionKill();
    45   virtual void WptSend();
    46   virtual void WptClear();
    47   virtual void WptLoopSend();
     43  virtual void MissionResume();
     44  virtual void MissionSend();
    4845
    4946private:
  • branches/mavlink/tools/Controller/Mavlink/src/GuiInterface.cpp

    r71 r77  
    2929#include <GroupBox.h>
    3030#include <ListWidget.h>
     31#include <Label.h>
     32#include <ComboBox.h>
    3133
    3234#include <string>
     
    4850  // Controls group
    4951  controlsGroupBox = new GroupBox(settingsTab->NewRow(), "Controls");
    50   btnInitialize = new PushButton(controlsGroupBox->LastRowLastCol(), "Initialize");
    5152  btnStartMission = new PushButton(controlsGroupBox->LastRowLastCol(), "Start mission");
    5253  btnStopMission = new PushButton(controlsGroupBox->LastRowLastCol(), "Stop mission");
    53   btnKill = new PushButton(controlsGroupBox->LastRowLastCol(), "Kill");
     54  btnResumeMission = new PushButton(controlsGroupBox->LastRowLastCol(), "Resume mission");
    5455
    55   // Add wpt group
    56   addWptGroupBox = new GroupBox(settingsTab->NewRow(), "Add waypoint");
    57   latField = new DoubleSpinBox(addWptGroupBox->NewRow(), "Latitude",
    58                                 -90, 90, 0.001, 3, 3);
    59   lonField = new DoubleSpinBox(addWptGroupBox->LastRowLastCol(), "Longitude",
    60                                 -180, 180, 0.001, 3, 3);
    61   btnAddMissionWpt = new PushButton(addWptGroupBox->NewRow(), "Add mission wpt");
    62   btnAddEntranceWpt = new PushButton(addWptGroupBox->LastRowLastCol(), "Add entrance wpt");
    63   btnAddExitWpt = new PushButton(addWptGroupBox->LastRowLastCol(), "Add exit wpt");
     56  // Add cmd group
     57  addCmdGroupBox = new GroupBox(settingsTab->NewRow(), "Add mission command");
     58  // commandLabel = new Label(addCmdGroupBox->NewRow(), "Command label");
     59  // commandLabel->SetText("Command");
     60  // param1Label = new Label(addCmdGroupBox->LastRowLastCol(), "Param1 label");
     61  // commandLabel->SetText("Param1");
     62  // param2Label = new Label(addCmdGroupBox->LastRowLastCol(), "Param2 label");
     63  // commandLabel->SetText("Param2");
     64  // param3Label = new Label(addCmdGroupBox->LastRowLastCol(), "Param3 label");
     65  // commandLabel->SetText("Param3");
     66  comboCmd = new ComboBox(addCmdGroupBox->NewRow(), "Select command");
     67  // Fill the ComboBox
     68  for (auto &command : commandsAvailable) {
     69    comboCmd->AddItem(command);   
     70  }
     71  // comboCmd->AddItem("WAYPOINT");
     72  // comboCmd->AddItem("TAKEOFF");
     73  // comboCmd->AddItem("LAND");
     74  // comboCmd->AddItem("RETURN");
     75  // comboCmd->AddItem("JUMP");
     76  param1Field = new DoubleSpinBox(addCmdGroupBox->NewRow(), "Param1",
     77                                -90, 90, 0.5, 1, 3);
     78  param2Field = new DoubleSpinBox(addCmdGroupBox->NewRow(), "Param2",
     79                                -90, 90, 0.5, 1, 3);
     80  param3Field = new DoubleSpinBox(addCmdGroupBox->NewRow(), "Param3",
     81                                -90, 90, 0.5, 1, 3);
     82  btnAddMissionCmd = new PushButton(addCmdGroupBox->NewRow(), "Add mission cmd");
     83  btnDelMissionCmd = new PushButton(addCmdGroupBox->LastRowLastCol(), "Del mission cmd");
     84  btnSendMission = new PushButton(addCmdGroupBox->LastRowLastCol(), "Send mission");
    6485
    6586  // Show wpt group
    66   showWptGroupBox = new GroupBox(settingsTab->NewRow(), "Show waypoints");
    67   listMissionWpt = new ListWidget(showWptGroupBox->NewRow(), "Mission wpt");
    68   listEntranceWpt = new ListWidget(showWptGroupBox->LastRowLastCol(), "Entrance wpt");
    69   listExitWpt = new ListWidget(showWptGroupBox->LastRowLastCol(), "Exit wpt");
    70   btnRemoveMissionWpt = new PushButton(showWptGroupBox->NewRow(), "Remove mission wpt");
    71   btnRemoveEntranceWpt = new PushButton(showWptGroupBox->LastRowLastCol(), "Remove entrance wpt");
    72   btnRemoveExitWpt = new PushButton(showWptGroupBox->LastRowLastCol(), "Remove exit wpt");
     87  showItemsGroupBox = new GroupBox(settingsTab->NewRow(), "Show mission items");
     88  listMissionItems = new ListWidget(showItemsGroupBox->NewRow(), "Mission cmd list");
    7389
    74   // Action wpt group
    75   actionWptGroupBox = new GroupBox(settingsTab->NewRow(), "Action");
    76   btnSendWpt = new PushButton(actionWptGroupBox->NewRow(), "Send wpt");
    77   btnClearWpt = new PushButton(actionWptGroupBox->LastRowLastCol(), "Clear wpt");
    78   btnLoop = new PushButton(actionWptGroupBox->LastRowLastCol(), "Loop");
     90  // listEntranceWpt = new ListWidget(showWptGroupBox->LastRowLastCol(), "Entrance wpt");
     91  // listExitWpt = new ListWidget(showWptGroupBox->LastRowLastCol(), "Exit wpt");
     92  // btnRemoveMissionWpt = new PushButton(showWptGroupBox->NewRow(), "Remove mission wpt");
     93  // btnRemoveEntranceWpt = new PushButton(showWptGroupBox->LastRowLastCol(), "Remove entrance wpt");
     94  // btnRemoveExitWpt = new PushButton(showWptGroupBox->LastRowLastCol(), "Remove exit wpt");
     95
     96  // // Action wpt group
     97  // actionWptGroupBox = new GroupBox(settingsTab->NewRow(), "Action");
     98  // btnSendWpt = new PushButton(actionWptGroupBox->NewRow(), "Send wpt");
     99  // btnClearWpt = new PushButton(actionWptGroupBox->LastRowLastCol(), "Clear wpt");
     100  // btnLoop = new PushButton(actionWptGroupBox->LastRowLastCol(), "Loop");
    79101
    80102  //TODO IP & PORT from config.h file
     
    97119    Thread::SleepMS(500);
    98120    // Buttons to control GUI
    99         if (btnAddMissionWpt->Clicked()) {
    100                 listMissionWpt->AddItem(GetWptLatLon());
     121        if (btnAddMissionCmd->Clicked()) {
     122                //TODO
     123      listMissionItems->AddItem(MissionCmdGet());
    101124    }
    102         if (btnAddEntranceWpt->Clicked()) {
    103                 listEntranceWpt->AddItem(GetWptLatLon());
    104     }
    105         if (btnAddExitWpt->Clicked()) {
    106                 listExitWpt->AddItem(GetWptLatLon());
    107     }
    108     if (btnRemoveMissionWpt->Clicked()) {
    109       listMissionWpt->RemoveItem();
    110     }
    111     if (btnRemoveEntranceWpt->Clicked()) {
    112       listEntranceWpt->RemoveItem();
    113     }
    114     if (btnRemoveExitWpt->Clicked()) {
    115       listExitWpt->RemoveItem();
     125    if (btnDelMissionCmd->Clicked()) {
     126      listMissionItems->RemoveItem();
    116127    }
    117128    // Buttons to send commands
    118         if (btnInitialize->Clicked()) {
    119                 MissionInitialize();
    120     }
    121129        if (btnStartMission->Clicked()) {
    122130                MissionStart();
     
    125133                MissionStop();
    126134    }
    127         if (btnKill->Clicked()) {
    128                 MissionKill();
     135        if (btnResumeMission->Clicked()) {
     136                MissionResume();
    129137    }
    130     if (btnSendWpt->Clicked()) {
    131                 WptSend();
    132     }
    133         if (btnClearWpt->Clicked()) {
    134                 WptClear();
    135     }
    136         if (btnLoop->Clicked()) {
    137                 WptLoopSend();
     138    if (btnSendMission->Clicked()) {
     139                MissionSend();
    138140    }
    139141  }
    140142}
    141143
    142 std::string GuiInterface::GetWptLatLon() {
     144std::string GuiInterface::MissionCmdGet() {
    143145  std::ostringstream stringStream;
    144   stringStream.precision(3);
     146  stringStream.precision(1);
    145147  stringStream << fixed;
    146   stringStream << latField->Value() << " - " << lonField->Value();
     148  stringStream << commandsAvailable[comboCmd->CurrentIndex()] << "|" << param1Field->Value() << "|" << param2Field->Value() << "|" << param3Field->Value();
    147149  return stringStream.str();
    148150}
    149 
  • branches/mavlink/tools/Controller/Mavlink/src/GuiInterface.h

    r71 r77  
    3535  class GroupBox;
    3636  class ListWidget;
     37  class Label;
    3738}
    3839}
     
    4748  // reimplement the run of the Thread class
    4849  void Run();
    49 
    50   std::string GetWptLatLon();
    5150 
    5251  // First tab callbacks
    53   virtual void MissionInitialize() = 0;
    5452  virtual void MissionStart() = 0;
    5553  virtual void MissionStop() = 0;
    56   virtual void MissionKill() = 0;
    57   virtual void WptSend() = 0;
    58   virtual void WptClear() = 0;
    59   virtual void WptLoopSend() = 0;
     54  virtual void MissionResume() = 0;
     55  virtual void MissionSend() = 0;
     56
     57  std::string MissionCmdGet();
    6058
    6159  // Main GUI
     
    6664  // Controls groupbox
    6765  flair::gui::GroupBox* controlsGroupBox;
    68   flair::gui::PushButton* btnInitialize;
    6966  flair::gui::PushButton* btnStartMission;
    7067  flair::gui::PushButton* btnStopMission;
    71   flair::gui::PushButton* btnKill;
     68  flair::gui::PushButton* btnResumeMission;
    7269 
    73   // Add wpt groupbox
    74   flair::gui::GroupBox* addWptGroupBox;
    75   flair::gui::DoubleSpinBox* latField;
    76   flair::gui::DoubleSpinBox* lonField;
    77   flair::gui::PushButton* btnAddMissionWpt;
    78   flair::gui::PushButton* btnAddEntranceWpt;
    79   flair::gui::PushButton* btnAddExitWpt;
     70  // Add cmd groupbox
     71  flair::gui::GroupBox* addCmdGroupBox;
     72  // flair::gui::Label* commandLabel;
     73  // flair::gui::Label* param1Label;
     74  // flair::gui::Label* param2Label;
     75  // flair::gui::Label* param3Label;
     76  flair::gui::ComboBox* comboCmd;
     77  flair::gui::DoubleSpinBox* param1Field;
     78  flair::gui::DoubleSpinBox* param2Field;
     79  flair::gui::DoubleSpinBox* param3Field; 
     80  flair::gui::PushButton* btnAddMissionCmd;
     81  flair::gui::PushButton* btnDelMissionCmd;
     82  flair::gui::PushButton* btnSendMission;
    8083
    8184  // Show wpt groupbox
    82   flair::gui::GroupBox* showWptGroupBox;
    83   flair::gui::ListWidget* listMissionWpt;
    84   flair::gui::ListWidget* listEntranceWpt;
    85   flair::gui::ListWidget* listExitWpt;
    86   flair::gui::PushButton* btnRemoveMissionWpt;
    87   flair::gui::PushButton* btnRemoveEntranceWpt;
    88   flair::gui::PushButton* btnRemoveExitWpt; 
     85  flair::gui::GroupBox* showItemsGroupBox;
     86  flair::gui::ListWidget* listMissionItems;
     87  // flair::gui::ListWidget* listEntranceWpt;
     88  // flair::gui::ListWidget* listExitWpt;
     89  // flair::gui::PushButton* btnRemoveMissionWpt;
     90  // flair::gui::PushButton* btnRemoveEntranceWpt;
     91  // flair::gui::PushButton* btnRemoveExitWpt; 
    8992
    9093  // Action wpt groupbox
    91   flair::gui::GroupBox* actionWptGroupBox;
    92   flair::gui::PushButton* btnSendWpt;
    93   flair::gui::PushButton* btnClearWpt;
    94   flair::gui::PushButton* btnLoop;
     94  // flair::gui::GroupBox* actionWptGroupBox;
     95  // flair::gui::PushButton* btnSendWpt;
     96  // flair::gui::PushButton* btnClearWpt;
     97  // flair::gui::PushButton* btnLoop;
    9598
    9699  // Socket to send commands
     
    98101
    99102  //TODO : think if useful to have private members
     103 
     104private:
     105  const std::vector<std::string> commandsAvailable = {"WAYPOINT", "TAKEOFF", "LAND", "RETURN", "JUMP"};
    100106};
    101107
  • branches/mavlink/tools/Controller/Mavlink/src/main.cpp

    r71 r77  
    4949
    5050  FrameworkManager *manager;
    51   manager = new FrameworkManager("mavlink");
     51  manager = new FrameworkManager("MavPlanner");
    5252  manager->SetupConnection(flairAddress, flairPort);
    5353  manager->SetupUserInterface(xmlFile);
Note: See TracChangeset for help on using the changeset viewer.