Ignore:
Timestamp:
12/16/20 09:40:44 (19 months ago)
Author:
Sanahuja Guillaume
Message:

ugv update

Location:
trunk/demos/TwoWheelRobotCircleFollower/ugv/src
Files:
3 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    }
  • trunk/demos/TwoWheelRobotCircleFollower/ugv/src/CircleFollower.h

    r376 r377  
    2323    namespace filter {
    2424        class TrajectoryGenerator2DCircle;
    25                 class Pid;
     25        class Pid;
    2626    }
    2727    namespace meta {
     
    5656
    5757        flair::gui::PushButton *startCircle,*stopCircle,*button_kill;
    58         flair::meta::MetaVrpnObject *targetVrpn,*uavVrpn;
     58        flair::meta::MetaVrpnObject *targetVrpn,*ugvVrpn;
    5959        flair::filter::TrajectoryGenerator2DCircle *circle;
     60
    6061};
    6162
  • trunk/demos/TwoWheelRobotCircleFollower/ugv/src/main.cpp

    r376 r377  
    1414#include "CircleFollower.h"
    1515#include <FrameworkManager.h>
     16#include <UgvFactory.h>
    1617#include <stdio.h>
    1718#include <tclap/CmdLine.h>
     
    2425using namespace flair::sensor;
    2526
     27string ugv_type;
    2628string log_path;
    2729int port;
     
    4345    manager->SetupLogger(log_path);
    4446
     47    Ugv* ugv=CreateUgv(name,ugv_type);
    4548    TargetEthController *controller=new TargetEthController("Dualshock3",ds3port);
    4649    CircleFollower* demo=new CircleFollower(name,controller);
     
    5962        ValueArg<string> nameArg("n","name","uav name, also used for vrpn",true,"x4","string");
    6063        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 );
    6167
    6268        ValueArg<string> xmlArg("x","xml","fichier xml",true,"./reglages.xml","string");
     
    8490        name=nameArg.getValue();
    8591        address=addressArg.getValue();
     92        ugv_type=typeArg.getValue();
    8693
    8794        } catch (ArgException &e) { // catch any exceptions
Note: See TracChangeset for help on using the changeset viewer.