iCub-main
Loading...
Searching...
No Matches
SkinConfigReader.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/* Copyright (C) 2012 iCub Facility, Istituto Italiano di Tecnologia
5 * Author: Valentina Gaggero
6 * email: valentina.gaggero@iit.it
7 * Permission is granted to copy, distribute, and/or modify this program
8 * under the terms of the GNU General Public License, version 2 or any
9 * later version published by the Free Software Foundation.
10 *
11 * A copy of the license can be found at
12 * http://www.robotcub.org/icub/license/gpl.txt
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
17 * Public License for more details
18 */
19
20#ifndef SKIN_CONFIG_READER
21#define SKIN_CONFIG_READER
22
23#include <stdint.h>
24#include <string>
25
26#include <yarp/os/LogStream.h>
27#include <yarp/sig/Vector.h>
28#include <yarp/sig/Matrix.h>
29
30//#include "skinParams.h"
31
32
33//default values for SkinBoardCfgParam
34#define sk_period_default 40 //millisec
35#define sk_skintype_default 0
36#define sk_noLoad_default 0xf0
37#define sk_useDiagnostic_default false
38
40{
41public:
42 uint8_t period;
43 uint8_t noLoad;
44 uint8_t skinType;
46
47public:
48
53
61
62 void debugPrint(void)
63 {
64 yDebug() << "period=" << period << "; noLoad=" << noLoad << "; skinType=" << skinType;
65 }
66};
67
68
69
70//default values for triangles
71#define skT_enabled_default true
72#define skT_shift_default 0
73#define skT_cdcOffset_default 0x2200
75{
76public:
77 bool enabled;
78 uint8_t shift;
79 uint16_t cdcOffset;
80
87
88 void debugPrint(void)
89 {
90 yDebug() << "enabled=" << enabled << "; shift=" << shift << "; cdcOffset=" << cdcOffset;
91 }
92};
93
94
96{
97public:
98 int patch; //in eth version it means number of patch where board is connected to, while in can means canDeviceNumber
100 int boardAddrEnd; //in eth version it means number of patch where board is connected to, while in can means canDeviceNumber
102
103 void debugPrint(void)
104 {
105 yDebug() << "patch num " << patch << ": startAddr=" << boardAddrStart << "endAddr=" << boardAddrEnd << "with cfg:";
106 cfg.debugPrint();
107 }
108};
109
111{
112public:
113 int patch; //in eth version it means number of patch where board is connected to, while in can means canDeviceNumber
118
119 void debugPrint(void)
120 {
121 yDebug() << "boardAddr " << boardAddr<< " on patch num " << patch << ": trisngleStart=" << triangleStart << "endAddr=" << triangleEnd << "with cfg:";
122 cfg.debugPrint();
123 }
124};
125
126#define CONFIG_READER_NAME_LEN 30
128{
129private:
130 char _name[CONFIG_READER_NAME_LEN];
131
132public:
134 void setName(char *name);
135 bool isDefaultBoardCfgPresent(yarp::os::Searchable& config);
136 bool readDefaultBoardCfg(yarp::os::Searchable& config, SkinBoardCfgParam *boardCfg);
137 bool isDefaultTriangleCfgPresent(yarp::os::Searchable& config);
138 bool readDefaultTriangleCfg(yarp::os::Searchable& config, SkinTriangleCfgParam *triangCfg);
139 bool readSpecialBoardCfg(yarp::os::Searchable& config, SpecialSkinBoardCfgParam *boardCfg, unsigned int *numofcfg);
140 bool readSpecialTriangleCfg(yarp::os::Searchable& config, SpecialSkinTriangleCfgParam *triangleCfg, unsigned int *numofcfg);
141};
142
143#endif
#define skT_enabled_default
#define sk_skintype_default
#define sk_useDiagnostic_default
#define skT_shift_default
#define CONFIG_READER_NAME_LEN
#define sk_period_default
#define sk_noLoad_default
#define skT_cdcOffset_default
void setDefaultValues(void)
Definition skinParams.h:39
void setName(char *name)
bool readDefaultBoardCfg(yarp::os::Searchable &config, SkinBoardCfgParam *boardCfg)
bool isDefaultBoardCfgPresent(yarp::os::Searchable &config)
bool readSpecialBoardCfg(yarp::os::Searchable &config, SpecialSkinBoardCfgParam *boardCfg, unsigned int *numofcfg)
bool readDefaultTriangleCfg(yarp::os::Searchable &config, SkinTriangleCfgParam *triangCfg)
bool readSpecialTriangleCfg(yarp::os::Searchable &config, SpecialSkinTriangleCfgParam *triangleCfg, unsigned int *numofcfg)
bool isDefaultTriangleCfgPresent(yarp::os::Searchable &config)