Changeset 377 in flair-src for trunk/demos
- Timestamp:
- Dec 16, 2020, 9:40:44 AM (4 years ago)
- Location:
- trunk/demos/TwoWheelRobotCircleFollower/ugv
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/demos/TwoWheelRobotCircleFollower/ugv/resources/core2-64/ugv.sh
r376 r377 4 4 EXEC=./TwoWheelRobotCircleFollower_ugv_rt 5 5 else 6 EXEC=. TwoWheelRobotCircleFollower_ugv_nrt6 EXEC=./TwoWheelRobotCircleFollower_ugv_nrt 7 7 fi 8 8 -
trunk/demos/TwoWheelRobotCircleFollower/ugv/src/CircleFollower.cpp
r376 r377 25 25 #include <Tab.h> 26 26 #include <Pid.h> 27 #include <Ugv.h> 28 #include <UgvControls.h> 27 29 28 30 using namespace std; … … 32 34 using namespace flair::filter; 33 35 using namespace flair::meta; 36 using namespace flair::actuator; 34 37 35 38 CircleFollower::CircleFollower(string name,TargetController *controller): Thread(getFrameworkManager(),"CircleFollower",50), behaviourMode(BehaviourMode_t::Default), vrpnLost(false) { 36 39 this->controller=controller; 37 40 controller->Start(); 38 39 VrpnClient* vrpnclient=new VrpnClient("vrpn", "127.0.0.1:3883",80); 41 42 Ugv* ugv=GetUgv(); 43 ugv->UseDefaultPlot(); 44 45 VrpnClient* vrpnclient=new VrpnClient("vrpn", ugv->GetDefaultVrpnAddress(),80); 40 46 41 47 if(vrpnclient->ConnectionType()==VrpnClient::Xbee) { 42 u avVrpn = new MetaVrpnObject(name,(uint8_t)0);48 ugvVrpn = new MetaVrpnObject(name,(uint8_t)0); 43 49 targetVrpn=new MetaVrpnObject("target",1); 44 50 } else if (vrpnclient->ConnectionType()==VrpnClient::Vrpn) { 45 u avVrpn = new MetaVrpnObject(name);51 ugvVrpn = new MetaVrpnObject(name); 46 52 targetVrpn=new MetaVrpnObject("target"); 47 53 } 48 54 49 getFrameworkManager()->AddDeviceToLog(u avVrpn);55 getFrameworkManager()->AddDeviceToLog(ugvVrpn); 50 56 getFrameworkManager()->AddDeviceToLog(targetVrpn); 51 57 vrpnclient->Start(); … … 58 64 59 65 circle=new TrajectoryGenerator2DCircle(vrpnclient->GetLayout()->NewRow(),"circle"); 60 u avVrpn->xPlot()->AddCurve(circle->GetMatrix()->Element(0,0),DataPlot::Blue);61 u avVrpn->yPlot()->AddCurve(circle->GetMatrix()->Element(0,1),DataPlot::Blue);62 u avVrpn->VxPlot()->AddCurve(circle->GetMatrix()->Element(1,0),DataPlot::Blue);63 u avVrpn->VyPlot()->AddCurve(circle->GetMatrix()->Element(1,1),DataPlot::Blue);64 u avVrpn->XyPlot()->AddCurve(circle->GetMatrix()->Element(0,1),circle->GetMatrix()->Element(0,0),DataPlot::Blue,"circle");66 ugvVrpn->xPlot()->AddCurve(circle->GetMatrix()->Element(0,0),DataPlot::Blue); 67 ugvVrpn->yPlot()->AddCurve(circle->GetMatrix()->Element(0,1),DataPlot::Blue); 68 ugvVrpn->VxPlot()->AddCurve(circle->GetMatrix()->Element(1,0),DataPlot::Blue); 69 ugvVrpn->VyPlot()->AddCurve(circle->GetMatrix()->Element(1,1),DataPlot::Blue); 70 ugvVrpn->XyPlot()->AddCurve(circle->GetMatrix()->Element(0,1),circle->GetMatrix()->Element(0,0),DataPlot::Blue,"circle"); 65 71 /* 66 72 uX=new Pid(setupLawTab->At(1,0),"u_x"); … … 81 87 } 82 88 83 while (!ToBeStopped()) { /*84 float x=-controller->GetAxisValue(3)*forwardCoef->Value();85 float rot=controller->GetAxisValue(0)*turnCoef->Value();86 87 sumoControl->move(x, rot);88 89 while (!ToBeStopped()) { 90 float speed=-controller->GetAxisValue(3); 91 float turn=controller->GetAxisValue(0); 92 93 //sumoControl->move(x, rot); 94 GetUgv()->GetUgvControls()->SetControls(speed,turn); 89 95 if (button_kill->Clicked() == true) 90 96 SafeStop(); 91 */97 92 98 WaitPeriod(); 93 99 } -
trunk/demos/TwoWheelRobotCircleFollower/ugv/src/CircleFollower.h
r376 r377 23 23 namespace filter { 24 24 class TrajectoryGenerator2DCircle; 25 25 class Pid; 26 26 } 27 27 namespace meta { … … 56 56 57 57 flair::gui::PushButton *startCircle,*stopCircle,*button_kill; 58 flair::meta::MetaVrpnObject *targetVrpn,*u avVrpn;58 flair::meta::MetaVrpnObject *targetVrpn,*ugvVrpn; 59 59 flair::filter::TrajectoryGenerator2DCircle *circle; 60 60 61 }; 61 62 -
trunk/demos/TwoWheelRobotCircleFollower/ugv/src/main.cpp
r376 r377 14 14 #include "CircleFollower.h" 15 15 #include <FrameworkManager.h> 16 #include <UgvFactory.h> 16 17 #include <stdio.h> 17 18 #include <tclap/CmdLine.h> … … 24 25 using namespace flair::sensor; 25 26 27 string ugv_type; 26 28 string log_path; 27 29 int port; … … 43 45 manager->SetupLogger(log_path); 44 46 47 Ugv* ugv=CreateUgv(name,ugv_type); 45 48 TargetEthController *controller=new TargetEthController("Dualshock3",ds3port); 46 49 CircleFollower* demo=new CircleFollower(name,controller); … … 59 62 ValueArg<string> nameArg("n","name","uav name, also used for vrpn",true,"x4","string"); 60 63 cmd.add( nameArg ); 64 65 ValueArg<string> typeArg("t","type","ugv type: sumo, ugv_simu or ugv_simux (with x the number of the simulated ugv)",true,"ugv_sumo","string"); 66 cmd.add( typeArg ); 61 67 62 68 ValueArg<string> xmlArg("x","xml","fichier xml",true,"./reglages.xml","string"); … … 84 90 name=nameArg.getValue(); 85 91 address=addressArg.getValue(); 92 ugv_type=typeArg.getValue(); 86 93 87 94 } catch (ArgException &e) { // catch any exceptions
Note:
See TracChangeset
for help on using the changeset viewer.