3 #ifndef __LACQUEY_FETCH_HPP__
4 #define __LACQUEY_FETCH_HPP__
10 #include <yarp/conf/numeric.h>
12 #include <yarp/dev/DeviceDriver.h>
13 #include <yarp/dev/IAxisInfo.h>
14 #include <yarp/dev/IControlMode.h>
15 #include <yarp/dev/IPWMControl.h>
17 #include "ICanBusSharer.hpp"
19 #define CHECK_JOINT(j) do { int n; if (getNumberOfMotorsRaw(&n), (j) != n - 1) return false; } while (0)
36 public yarp::dev::IAxisInfoRaw,
37 public yarp::dev::IControlModeRaw,
38 public yarp::dev::IPWMControlRaw,
44 bool open(yarp::os::Searchable & config)
override;
45 bool close()
override;
49 unsigned int getId()
override;
58 bool getAxes(
int * ax)
override;
59 bool getAxisNameRaw(
int j, std::string & name)
override;
60 bool getJointTypeRaw(
int j, yarp::dev::JointTypeEnum & type)
override;
64 bool getControlModeRaw(
int j,
int * mode)
override;
65 bool getControlModesRaw(
int * modes)
override;
66 bool getControlModesRaw(
int n_joint,
const int * joints,
int * modes)
override;
67 bool setControlModeRaw(
int j,
int mode)
override;
68 bool setControlModesRaw(
int * modes)
override;
69 bool setControlModesRaw(
int n_joint,
const int * joints,
int * modes)
override;
73 bool getNumberOfMotorsRaw(
int * number)
override;
74 bool setRefDutyCycleRaw(
int m,
double ref)
override;
75 bool setRefDutyCyclesRaw(
const double * refs)
override;
76 bool getRefDutyCycleRaw(
int m,
double * ref)
override;
77 bool getRefDutyCyclesRaw(
double * refs)
override;
78 bool getDutyCycleRaw(
int m,
double * val)
override;
79 bool getDutyCyclesRaw(
double * vals)
override;
82 static constexpr
unsigned int CAN_OP = 0x780;
84 bool send(
unsigned int len,
const std::uint8_t * msgData)
85 {
return sender && sender->
prepareMessage({CAN_OP + canId, len, msgData}); }
87 unsigned int canId {0};
89 yarp::conf::float32_t refDutyCycles {0};
Abstract base for a CAN bus sharer.
Definition: ICanBusSharer.hpp:25
Implementation-agnostic consumer for TX CAN transfers.
Definition: ICanSenderDelegate.hpp:22
virtual bool prepareMessage(const can_message &msg)=0
Register CAN message for write.
Implementation for the Lacquey Fetch hand custom UC3M circuit as a single CAN bus joint (control boar...
Definition: LacqueyFetch.hpp:40
bool registerSender(ICanSenderDelegate *sender) override
Pass a handle to a CAN sender delegate instance.
Definition: ICanBusSharerImpl.cpp:37
unsigned int getId() override
Retrieve CAN node ID.
Definition: ICanBusSharerImpl.cpp:9
bool finalize() override
Finalize CAN node communications.
Definition: ICanBusSharerImpl.cpp:23
bool notifyMessage(const can_message &message) override
Notify observers that a new CAN message has arrived.
Definition: ICanBusSharerImpl.cpp:30
bool synchronize(double timestamp) override
Perform synchronized action on CAN master's request.
Definition: ICanBusSharerImpl.cpp:45
bool initialize() override
Perform CAN node initialization.
Definition: ICanBusSharerImpl.cpp:16
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:6
Proxy CAN message structure.
Definition: CanMessage.hpp:20