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

Last change on this file since 427 was 378, checked in by Sanahuja Guillaume, 4 years ago

up 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
53
54void SumoUgvControls::SetControls(float speed,float turn) {
55 sumoControl->move(speed*127, turn*127);
56
57 // on prend une fois pour toute le mutex et on fait des accès directs
58 output->GetMutex();
59 output->SetValueNoMutex(0, 0, speed);
60 output->SetValueNoMutex(1, 0, turn);
61 output->ReleaseMutex();
62}
63
64
65} // end namespace sensor
66} // end namespace flair
67
68#endif
Note: See TracBrowser for help on using the repository browser.