iCub-main
Loading...
Searching...
No Matches
ftInfo.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 Istituto Italiano di Tecnologia (IIT)
3 * All rights reserved.
4 * Author: Luca Tricerri
5 * This software may be modified and distributed under the terms of the
6 * BSD-3-Clause license. See the accompanying LICENSE file for details.
7 */
8
9#include "ftInfo.h"
10
11#include <yarp/os/Log.h>
12#include <yarp/os/LogStream.h>
13
14bool FtInfo::toEomn(eOas_ft_sensordescriptor_t& out) const
15{
16 out.boardinfo.type = board;
17 out.canloc.addr = address;
18 out.canloc.insideindex = eobrd_caninsideindex_none;
19 out.boardinfo.firmware = {(uint8_t)majorFirmware, (uint8_t)minorFirmware, (uint8_t)buildFirmware};
20 out.boardinfo.protocol = {(uint8_t)majorProtocol, (uint8_t)minorProtocol};
21
22 try
23 {
24 if (port == 1)
25 out.canloc.port = eOcanport1;
26 else if (port == 2)
27 out.canloc.port = eOcanport2;
28 else
29 {
30 yError() << "FtInfo::toEomn() invalid can port";
31 out = eOas_ft_sensordescriptor_t();
32 return false;
33 }
34 }
35 catch (const std::exception& e)
36 {
37 yError() << "FtInfo::toEomn() invalid can port";
38 out = eOas_ft_sensordescriptor_t();
39 return false;
40 }
41
42 return true;
43}
44
45bool operator==(const FtInfo& right, const FtInfo& left)
46{
47 if (right.ftAcquisitionRate != left.ftAcquisitionRate)
48 return false;
50 return false;
51 if (right.useCalibration != left.useCalibration)
52 return false;
53 if (right.board != left.board)
54 return false;
55 if (right.port != left.port)
56 return false;
57 if (right.address != left.address)
58 return false;
59 if (right.majorProtocol != left.majorProtocol)
60 return false;
61 if (right.minorProtocol != left.minorProtocol)
62 return false;
63 if (right.majorFirmware != left.majorFirmware)
64 return false;
65 if (right.minorFirmware != left.minorFirmware)
66 return false;
67 if (right.buildFirmware != left.buildFirmware)
68 return false;
69 if (right.frameName != left.frameName)
70 return false;
71 return true;
72};
73
74bool operator!=(const FtInfo& right, const FtInfo& left)
75{
76 return !(right == left);
77}
bool operator==(const BatteryInfo &right, const BatteryInfo &left)
int buildFirmware
Definition ftInfo.h:29
eOas_ft_mode_t useCalibration
Definition ftInfo.h:21
uint8_t ftAcquisitionRate
Definition ftInfo.h:19
eObrd_type_t board
Definition ftInfo.h:22
int majorFirmware
Definition ftInfo.h:27
std::string frameName
Definition ftInfo.h:30
uint32_t temperatureAcquisitionRate
Definition ftInfo.h:20
int majorProtocol
Definition ftInfo.h:25
int minorFirmware
Definition ftInfo.h:28
int minorProtocol
Definition ftInfo.h:26
int port
Definition ftInfo.h:23
int address
Definition ftInfo.h:24
bool toEomn(eOas_ft_sensordescriptor_t &out) const
Definition ftInfo.cpp:14
bool operator!=(const FtInfo &right, const FtInfo &left)
Definition ftInfo.cpp:74
out
Definition sine.m:8