iCub-main
Loading...
Searching...
No Matches
embObjMais.h
Go to the documentation of this file.
1// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2
3
4#ifndef __embObjMais_h__
5#define __embObjMais_h__
6
7#include <yarp/dev/DeviceDriver.h>
8#include <yarp/os/PeriodicThread.h>
9#include <yarp/dev/MultipleAnalogSensorsInterfaces.h>
10#include <string>
11#include <list>
12#include <mutex>
13
16
17
18#include "IethResource.h"
19#include <ethManager.h>
20#include <abstractEthResource.h>
21
22
23#include <yarp/os/LogStream.h>
24
25#include "serviceParser.h"
26
27namespace yarp {
28 namespace dev {
29 class embObjMais;
30 }
31}
32
33
34#define EMBOBJMAIS_USESERVICEPARSER
35
36
37// -- class embObjMais
38
39class yarp::dev::embObjMais: public yarp::dev::DeviceDriver,
40 public eth::IethResource,
41 public yarp::dev::IEncoderArrays
42{
43
44public:
45
46 enum { mais_Channels = 15, mais_FormatData = 8 };
47
48public:
49
50 embObjMais();
52
53 // An open function yarp factory compatible
54 bool open(yarp::os::Searchable &config);
55 bool close();
56
57 // IEncoderArrays interface
58 virtual size_t getNrOfEncoderArrays() const override;
59 virtual yarp::dev::MAS_status getEncoderArrayStatus(size_t sens_index) const override;
60 virtual bool getEncoderArrayName(size_t sens_index, std::string &name) const override;
61 virtual bool getEncoderArrayMeasure(size_t sens_index, yarp::sig::Vector& out, double& timestamp) const override;
62 virtual size_t getEncoderArraySize(size_t sens_index) const override;
63
64 // IethResource interface
65 virtual bool initialised();
66 virtual eth::iethresType_t type();
67 virtual bool update(eOprotID32_t id32, double timestamp, void* rxdata);
68
69private:
70
71 string boardIPstring;
72 string boardName;
73 eOipv4addr_t ipv4addr;
74
75 eth::TheEthManager* ethManager;
77 ServiceParser* parser;
78
79 bool opened;
80 bool verbosewhenok;
81
82 unsigned int counterSat;
83 unsigned int counterError;
84 unsigned int counterTimeout;
85
87 // parameters
88 servConfigMais_t serviceConfig;
89
90 std::mutex mtx;
91
92 yarp::sig::Vector analogdata;
93
94 short status;
95 double timeStamp;
96
97private:
98
99 // for all
100 bool extractGroup(Bottle &input, Bottle &out, const std::string &key1, const std::string &txt, int size);
101 bool fromConfig(yarp::os::Searchable &config);
102 bool initRegulars();
103 void cleanup(void);
104 void printServiceConfig(void);
105
106 // for mais
107 bool sendConfig2Mais(void);
108
109
110 // for ??
111 void resetCounters();
112 void getCounters(unsigned int &saturations, unsigned int &errors, unsigned int &timeouts);
113};
114
115
116#endif
117
Interface for a factory device; a device that can create objects.
virtual bool initialised()
virtual bool getEncoderArrayMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
virtual bool getEncoderArrayName(size_t sens_index, std::string &name) const override
virtual bool update(eOprotID32_t id32, double timestamp, void *rxdata)
virtual size_t getNrOfEncoderArrays() const override
bool open(yarp::os::Searchable &config)
virtual yarp::dev::MAS_status getEncoderArrayStatus(size_t sens_index) const override
virtual eth::iethresType_t type()
virtual size_t getEncoderArraySize(size_t sens_index) const override
iethresType_t
Copyright (C) 2008 RobotCub Consortium.
out
Definition sine.m:8