Changeset 77 in flair-src for branches/mavlink/tools/Controller/Mavlink
- Timestamp:
- Sep 21, 2016, 11:40:56 AM (8 years ago)
- Location:
- branches/mavlink/tools/Controller/Mavlink/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/mavlink/tools/Controller/Mavlink/src/GuiFlair.cpp
r71 r77 37 37 } 38 38 39 void GuiFlair::MissionInitialize() {40 cout << "MavPlanner GuiFlair MissionInitialize" << endl;41 }42 43 39 void GuiFlair::MissionStart() { 44 40 cout << "MavPlanner GuiFlair MissionStart" << endl; … … 49 45 } 50 46 51 void GuiFlair::Mission Kill() {52 cout << "MavPlanner GuiFlair Mission Kill" << endl;47 void GuiFlair::MissionResume() { 48 cout << "MavPlanner GuiFlair MissionResume" << endl; 53 49 } 54 50 55 void GuiFlair:: WptSend() {56 cout << "MavPlanner GuiFlair WptSend" << endl;51 void GuiFlair::MissionSend() { 52 cout << "MavPlanner GuiFlair MissionSend" << endl; 57 53 } 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 38 38 protected: 39 39 40 virtual void MissionInitialize();41 40 virtual void MissionStart(); 42 41 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(); 47 44 }; 48 45 -
branches/mavlink/tools/Controller/Mavlink/src/GuiGcs.cpp
r71 r77 40 40 } 41 41 42 void GuiGcs::MissionInitialize() {43 cout << "MavPlanner GuiGcs MissionInitialize" << endl;44 outputSocket->SendMessage("MavPlanner GuiGcs MissionInitialize");45 }46 47 42 void GuiGcs::MissionStart() { 48 43 cout << "MavPlanner GuiGcs MissionStart" << endl; … … 55 50 } 56 51 57 void GuiGcs::Mission Kill() {58 cout << "MavPlanner GuiGcs Mission Kill" << endl;59 outputSocket->SendMessage("MavPlanner GuiGcs Mission Kill");52 void GuiGcs::MissionResume() { 53 cout << "MavPlanner GuiGcs MissionResume" << endl; 54 outputSocket->SendMessage("MavPlanner GuiGcs MissionResume"); 60 55 } 61 56 62 void GuiGcs:: WptSend() {63 cout << "MavPlanner GuiGcs WptSend" << endl;57 void GuiGcs::MissionSend() { 58 cout << "MavPlanner GuiGcs MissionSend" << endl; 64 59 } 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 39 39 protected: 40 40 41 virtual void MissionInitialize();42 41 virtual void MissionStart(); 43 42 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(); 48 45 49 46 private: -
branches/mavlink/tools/Controller/Mavlink/src/GuiInterface.cpp
r71 r77 29 29 #include <GroupBox.h> 30 30 #include <ListWidget.h> 31 #include <Label.h> 32 #include <ComboBox.h> 31 33 32 34 #include <string> … … 48 50 // Controls group 49 51 controlsGroupBox = new GroupBox(settingsTab->NewRow(), "Controls"); 50 btnInitialize = new PushButton(controlsGroupBox->LastRowLastCol(), "Initialize");51 52 btnStartMission = new PushButton(controlsGroupBox->LastRowLastCol(), "Start mission"); 52 53 btnStopMission = new PushButton(controlsGroupBox->LastRowLastCol(), "Stop mission"); 53 btn Kill = new PushButton(controlsGroupBox->LastRowLastCol(), "Kill");54 btnResumeMission = new PushButton(controlsGroupBox->LastRowLastCol(), "Resume mission"); 54 55 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"); 64 85 65 86 // 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"); 73 89 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"); 79 101 80 102 //TODO IP & PORT from config.h file … … 97 119 Thread::SleepMS(500); 98 120 // Buttons to control GUI 99 if (btnAddMissionWpt->Clicked()) { 100 listMissionWpt->AddItem(GetWptLatLon()); 121 if (btnAddMissionCmd->Clicked()) { 122 //TODO 123 listMissionItems->AddItem(MissionCmdGet()); 101 124 } 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(); 116 127 } 117 128 // Buttons to send commands 118 if (btnInitialize->Clicked()) {119 MissionInitialize();120 }121 129 if (btnStartMission->Clicked()) { 122 130 MissionStart(); … … 125 133 MissionStop(); 126 134 } 127 if (btn Kill->Clicked()) {128 Mission Kill();135 if (btnResumeMission->Clicked()) { 136 MissionResume(); 129 137 } 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(); 138 140 } 139 141 } 140 142 } 141 143 142 std::string GuiInterface:: GetWptLatLon() {144 std::string GuiInterface::MissionCmdGet() { 143 145 std::ostringstream stringStream; 144 stringStream.precision( 3);146 stringStream.precision(1); 145 147 stringStream << fixed; 146 stringStream << latField->Value() << " - " << lonField->Value();148 stringStream << commandsAvailable[comboCmd->CurrentIndex()] << "|" << param1Field->Value() << "|" << param2Field->Value() << "|" << param3Field->Value(); 147 149 return stringStream.str(); 148 150 } 149 -
branches/mavlink/tools/Controller/Mavlink/src/GuiInterface.h
r71 r77 35 35 class GroupBox; 36 36 class ListWidget; 37 class Label; 37 38 } 38 39 } … … 47 48 // reimplement the run of the Thread class 48 49 void Run(); 49 50 std::string GetWptLatLon();51 50 52 51 // First tab callbacks 53 virtual void MissionInitialize() = 0;54 52 virtual void MissionStart() = 0; 55 53 virtual void MissionStop() = 0; 56 virtual void Mission Kill() = 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(); 60 58 61 59 // Main GUI … … 66 64 // Controls groupbox 67 65 flair::gui::GroupBox* controlsGroupBox; 68 flair::gui::PushButton* btnInitialize;69 66 flair::gui::PushButton* btnStartMission; 70 67 flair::gui::PushButton* btnStopMission; 71 flair::gui::PushButton* btn Kill;68 flair::gui::PushButton* btnResumeMission; 72 69 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; 80 83 81 84 // Show wpt groupbox 82 flair::gui::GroupBox* show WptGroupBox;83 flair::gui::ListWidget* listMission Wpt;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; 89 92 90 93 // 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; 95 98 96 99 // Socket to send commands … … 98 101 99 102 //TODO : think if useful to have private members 103 104 private: 105 const std::vector<std::string> commandsAvailable = {"WAYPOINT", "TAKEOFF", "LAND", "RETURN", "JUMP"}; 100 106 }; 101 107 -
branches/mavlink/tools/Controller/Mavlink/src/main.cpp
r71 r77 49 49 50 50 FrameworkManager *manager; 51 manager = new FrameworkManager(" mavlink");51 manager = new FrameworkManager("MavPlanner"); 52 52 manager->SetupConnection(flairAddress, flairPort); 53 53 manager->SetupUserInterface(xmlFile);
Note:
See TracChangeset
for help on using the changeset viewer.