source: flair-src/trunk/lib/FlairSensorActuator/src/SumoUgvControls.cpp@ 459

Last change on this file since 459 was 435, checked in by Sanahuja Guillaume, 3 years ago

add logs to ugv

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5// created: 2020/&2/09
6// filename: SumoUgvControls.cpp
7//
8// author: Guillaume Sanahuja
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: Class for a parrot sumo ugv controls
14//
15//
16/*********************************************************************/
17#ifdef CORE2_64
18
19#include "SumoUgvControls.h"
20#include <Matrix.h>
21#include <control.h>
22#include <image.h>
23
24using std::string;
25using namespace sumo;
26
27class ImageProcessing : public sumo::Image {
28public:
29 void handleImage(const struct sumo::image *, const uint8_t *buffer, size_t size) {
30 //nothing to do in this demo
31 }
32};
33
34namespace flair {
35namespace actuator {
36
37SumoUgvControls::SumoUgvControls(string name)
38 : UgvControls(name) {
39
40 sumoControl= new Control (new ImageProcessing);
41 if (!sumoControl->open()) {
42 Err("error opening sumo control\n");
43 } else {
44 SetIsReady(true);
45 }
46}
47
48SumoUgvControls::~SumoUgvControls() {
49 sumoControl->close();
50 delete sumoControl;
51}
52
53void SumoUgvControls::SetControls(float speed,float turn) {
54 sumoControl->move(speed*127, turn*127);
55
56 // on prend une fois pour toute le mutex et on fait des accès directs
57 output->GetMutex();
58 output->SetValueNoMutex(0, 0, speed);
59 output->SetValueNoMutex(1, 0, turn);
60 output->ReleaseMutex();
61
62 output->SetDataTime(core::GetTime());
63 ProcessUpdate(output);
64}
65
66
67} // end namespace sensor
68} // end namespace flair
69
70#endif
Note: See TracBrowser for help on using the repository browser.