Ignore:
Timestamp:
Dec 16, 2020, 9:40:44 AM (9 months ago)
Author:
Sanahuja Guillaume
Message:

ugv update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/demos/TwoWheelRobotCircleFollower/ugv/src/CircleFollower.cpp

    r376 r377  
    2525#include <Tab.h>
    2626#include <Pid.h>
     27#include <Ugv.h>
     28#include <UgvControls.h>
    2729
    2830using namespace std;
     
    3234using namespace flair::filter;
    3335using namespace flair::meta;
     36using namespace flair::actuator;
    3437
    3538CircleFollower::CircleFollower(string name,TargetController *controller): Thread(getFrameworkManager(),"CircleFollower",50), behaviourMode(BehaviourMode_t::Default), vrpnLost(false) {
    3639   this->controller=controller;
    3740    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);
    4046   
    4147    if(vrpnclient->ConnectionType()==VrpnClient::Xbee) {
    42         uavVrpn = new MetaVrpnObject(name,(uint8_t)0);
     48        ugvVrpn = new MetaVrpnObject(name,(uint8_t)0);
    4349        targetVrpn=new MetaVrpnObject("target",1);
    4450    } else if (vrpnclient->ConnectionType()==VrpnClient::Vrpn) {
    45         uavVrpn = new MetaVrpnObject(name);
     51        ugvVrpn = new MetaVrpnObject(name);
    4652        targetVrpn=new MetaVrpnObject("target");
    4753    }
    4854   
    49     getFrameworkManager()->AddDeviceToLog(uavVrpn);
     55    getFrameworkManager()->AddDeviceToLog(ugvVrpn);
    5056    getFrameworkManager()->AddDeviceToLog(targetVrpn);
    5157    vrpnclient->Start();
     
    5864   
    5965    circle=new TrajectoryGenerator2DCircle(vrpnclient->GetLayout()->NewRow(),"circle");
    60     uavVrpn->xPlot()->AddCurve(circle->GetMatrix()->Element(0,0),DataPlot::Blue);
    61     uavVrpn->yPlot()->AddCurve(circle->GetMatrix()->Element(0,1),DataPlot::Blue);
    62     uavVrpn->VxPlot()->AddCurve(circle->GetMatrix()->Element(1,0),DataPlot::Blue);
    63     uavVrpn->VyPlot()->AddCurve(circle->GetMatrix()->Element(1,1),DataPlot::Blue);
    64     uavVrpn->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");
    6571/*
    6672    uX=new Pid(setupLawTab->At(1,0),"u_x");
     
    8187    }
    8288
    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);
    8995        if (button_kill->Clicked() == true)
    9096            SafeStop();
    91         */
     97       
    9298        WaitPeriod();
    9399    }
Note: See TracChangeset for help on using the changeset viewer.