Changeset 377 in flair-src for trunk/lib/FlairSensorActuator


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

ugv update

Location:
trunk/lib/FlairSensorActuator/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSensorActuator/src/SimulatedUgvControls.cpp

    r376 r377  
    3131namespace actuator {
    3232
    33 SimulatedUgvControls::SimulatedUgvControls(const IODevice *parent,string name, uint32_t modelId,uint32_t deviceId)
    34     : UgvControls(parent,name) {
     33SimulatedUgvControls::SimulatedUgvControls(string name, uint32_t modelId,uint32_t deviceId)
     34    : UgvControls(name) {
    3535 
    36   shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId),2 * sizeof(float)+sizeof(Time));
     36  shmem = new SharedMem(this, ShMemName(modelId, deviceId),2 * sizeof(float)+sizeof(Time));
    3737 
    3838  buf=(char*)malloc(2 * sizeof(float)+sizeof(Time));
     
    5757void SimulatedUgvControls::SetControls(float speed,float turn) {
    5858  float *values=(float*)buf;
    59   buf[0]=speed;
    60   buf[1]=turn;
     59  values[0]=speed;
     60  values[1]=turn;
    6161  Time time=GetTime();
    6262  memcpy(buf+2 * sizeof(float),&time,sizeof(Time));
     
    6767  output->GetMutex();
    6868  for (int i = 0; i < 2; i++) {
    69     output->SetValueNoMutex(i, 0, buf[i]);
     69    output->SetValueNoMutex(i, 0, values[i]);
    7070  }
    7171  output->ReleaseMutex();
  • trunk/lib/FlairSensorActuator/src/SimulatedUgvControls.h

    r376 r377  
    3636  * Construct a SimulatedUgvControls.
    3737  *
    38   * \param parent parent
    3938  * \param name name
    4039  * \param modelId Model id
    4140  * \param deviceId Imu id of the Model
    4241  */
    43   SimulatedUgvControls(const core::IODevice *parent,std::string name,
     42  SimulatedUgvControls(std::string name,
    4443          uint32_t modelId,uint32_t deviceId);
    4544
     
    5049  ~SimulatedUgvControls();
    5150
    52 private:
    53  
    5451  /*!
    5552  * \brief Set controls values
     
    6158  */
    6259  void SetControls(float speed,float turn);
     60private:
     61 
    6362 
    6463  char *buf;
  • trunk/lib/FlairSensorActuator/src/UgvControls.cpp

    r376 r377  
    1818#include "UgvControls.h"
    1919#include <Matrix.h>
     20#include <FrameworkManager.h>
     21#include <Tab.h>
     22#include <DataPlot1D.h>
    2023
    2124using namespace flair::core;
     25using namespace flair::gui;
    2226
    2327using std::string;
     
    2630namespace actuator {
    2731
    28 UgvControls::UgvControls(const IODevice *parent, string name)
    29     : IODevice(parent, name) {
     32UgvControls::UgvControls(string name)
     33    : IODevice(getFrameworkManager(), name) {
     34  mainTab = new Tab(getFrameworkManager()->GetTabWidget(), name);
    3035 
    3136  MatrixDescriptor *desc = new MatrixDescriptor(2, 1);
     
    4247
    4348void UgvControls::UseDefaultPlot(void) {
    44  
     49  DataPlot1D *speedPlot = new DataPlot1D(mainTab->NewRow(), "speed", -1, 1);
     50  speedPlot->AddCurve(output->Element(0));
     51  DataPlot1D *turnPlot = new DataPlot1D(mainTab->LastRowLastCol(), "turn", -1, 1);
     52  turnPlot->AddCurve(output->Element(1));
    4553}
    4654
  • trunk/lib/FlairSensorActuator/src/UgvControls.h

    r376 r377  
    1818namespace flair {
    1919namespace core {
    20 class Matrix;
     20  class Matrix;
     21}
     22namespace gui {
     23  class Tab;
    2124}
    2225}
     
    3538  * \brief Constructor
    3639  *
    37   * Construct a UgvControls.
     40  * Construct a UgvControls. It will be child of the FrameworkManager.
    3841  *
    39   * \param parent parent
    4042  * \param name name
    4143  */
    42   UgvControls(const core::IODevice *parent, std::string name);
     44  UgvControls(std::string name);
    4345
    4446  /*!
     
    6365  core::Matrix *Output(void) const;
    6466 
     67  /*!
     68  * \brief Set controls values
     69  *
     70  * \param speed speed value
     71  * \param turn turn value
     72  */
     73  virtual void SetControls(float speed,float turn)=0;
     74 
    6575protected:
    6676  core::Matrix *output;
     
    7585  */
    7686  void UpdateFrom(const core::io_data *data){};
    77 
    78   /*!
    79   * \brief Set controls values
    80   *
    81   * \param speed speed value
    82   * \param turn turn value
    83   */
    84   virtual void SetControls(float speed,float turn)=0;
    8587 
    86 
     88  gui::Tab *mainTab;
    8789};
    8890} // end namespace actuator
Note: See TracChangeset for help on using the changeset viewer.