3
3
#ifndef __CAN_BUS_BROKER_HPP__
4
4
#define __CAN_BUS_BROKER_HPP__
5
5
6
+ #include < map>
7
+ #include < string>
8
+ #include < tuple>
6
9
#include < vector>
7
10
11
+ #include < yarp/dev/IMultipleWrapper.h>
8
12
#include < yarp/dev/ControlBoardInterfaces.h>
9
13
#include < yarp/dev/MultipleAnalogSensorsInterfaces.h>
14
+ #include < yarp/dev/PolyDriverList.h>
10
15
11
16
#include " DeviceMapper.hpp"
12
17
#include " SingleBusBroker.hpp"
@@ -25,7 +30,7 @@ namespace roboticslab
25
30
26
31
/* *
27
32
* @ingroup CanBusBroker
28
- * @brief CAN-oriented control board that implements all YARP motor interfaces.
33
+ * @brief CAN-oriented control board that implements all YARP motor and MAS interfaces.
29
34
*
30
35
* This control board wrapper subdevice exposes motor commands to CAN nodes
31
36
* modelled as wrapped motor raw subdevices (i.e. devices which implement the
@@ -38,6 +43,7 @@ namespace roboticslab
38
43
* <a href="https://github.com/roboticslab-uc3m/yarp-devices/issues/241#issuecomment-569112698">instructions</a>.
39
44
*/
40
45
class CanBusBroker : public yarp ::dev::DeviceDriver,
46
+ public yarp::dev::IMultipleWrapper,
41
47
// control board interfaces
42
48
public yarp::dev::IAmplifierControl,
43
49
public yarp::dev::IAxisInfo,
@@ -79,6 +85,11 @@ class CanBusBroker : public yarp::dev::DeviceDriver,
79
85
bool open (yarp::os::Searchable & config) override ;
80
86
bool close () override ;
81
87
88
+ // -------- IMultipleWrapper declarations. Implementation in IMultipleWrapperImpl.cpp --------
89
+
90
+ bool attachAll (const yarp::dev::PolyDriverList & drivers) override ;
91
+ bool detachAll () override ;
92
+
82
93
// ---------- CONTROL BOARD INTERFACES ----------
83
94
84
95
// --------- IAmplifierControl declarations. Implementation in IAmplifierControlImpl.cpp ---------
@@ -408,10 +419,22 @@ class CanBusBroker : public yarp::dev::DeviceDriver,
408
419
bool getThreeAxisMagnetometerMeasure (std::size_t sens_index, yarp::sig::Vector & out, double & timestamp) const override ;
409
420
410
421
private:
422
+ bool attachBusDevice (const yarp::dev::PolyDriverDescriptor * device, int index);
423
+ bool attachNodeDevice (const yarp::dev::PolyDriverDescriptor * device);
424
+
411
425
DeviceMapper deviceMapper;
412
426
413
- std::vector<yarp::dev::PolyDriver *> busDevices;
414
- std::vector<yarp::dev::PolyDriver *> nodeDevices;
427
+ std::map<std::string, std::vector<std::string>> deviceKeys;
428
+
429
+ std::vector<std::string> busNames;
430
+ // std::map<std::string, std::pair<std::string, int>>
431
+ std::vector<std::tuple<std::string, std::string, int >> deviceKeys2;
432
+
433
+ yarp::dev::PolyDriverList busDevices;
434
+ yarp::dev::PolyDriverList nodeDevices;
435
+ // std::vector<yarp::dev::PolyDriver *> busDevices;
436
+ // std::vector<yarp::dev::PolyDriver *> nodeDevices;
437
+
415
438
std::vector<SingleBusBroker *> brokers;
416
439
417
440
SyncPeriodicThread * syncThread {nullptr };
0 commit comments