Changeset 377 in flair-src for trunk/demos/TwoWheelRobotCircleFollower/ugv/src/CircleFollower.cpp
- Timestamp:
- Dec 16, 2020, 9:40:44 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note:
See TracChangeset
for help on using the changeset viewer.