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"
18#include "LacqueyFetch_ParamsParser.h"
20#define CHECK_JOINT(j) do { int n; if (getNumberOfMotorsRaw(&n), (j) != n - 1) return false; } while (0)
34 public yarp::dev::IAxisInfoRaw,
35 public yarp::dev::IControlModeRaw,
36 public yarp::dev::IPWMControlRaw,
43 bool open(yarp::os::Searchable & config)
override;
44 bool close()
override;
48 unsigned int getId()
override;
57 bool getAxes(
int * ax)
override;
58 bool getAxisNameRaw(
int j, std::string & name)
override;
59 bool getJointTypeRaw(
int j, yarp::dev::JointTypeEnum & type)
override;
63 bool getControlModeRaw(
int j,
int * mode)
override;
64 bool getControlModesRaw(
int * modes)
override;
65 bool getControlModesRaw(
int n_joint,
const int * joints,
int * modes)
override;
66 bool setControlModeRaw(
int j,
int mode)
override;
67 bool setControlModesRaw(
int * modes)
override;
68 bool setControlModesRaw(
int n_joint,
const int * joints,
int * modes)
override;
72 bool getNumberOfMotorsRaw(
int * number)
override;
73 bool setRefDutyCycleRaw(
int m,
double ref)
override;
74 bool setRefDutyCyclesRaw(
const double * refs)
override;
75 bool getRefDutyCycleRaw(
int m,
double * ref)
override;
76 bool getRefDutyCyclesRaw(
double * refs)
override;
77 bool getDutyCycleRaw(
int m,
double * val)
override;
78 bool getDutyCyclesRaw(
double * vals)
override;
81 static constexpr unsigned int CAN_OP = 0x780;
83 bool send(
unsigned int len,
const std::uint8_t * msgData)
84 {
return sender && sender->
prepareMessage({CAN_OP + m_canId, len, msgData}); }
86 yarp::conf::float32_t refDutyCycles {0};
Definition LacqueyFetch_ParamsParser.h:43
Implementation for the Lacquey Fetch hand custom UC3M circuit as a single CAN bus joint (control boar...
Definition LacqueyFetch.hpp:39
unsigned int getId() override
Retrieve CAN node ID.
Definition ICanBusSharerImpl.cpp:9
bool finalize() override
Finalize CAN node communications.
Definition ICanBusSharerImpl.cpp:23
bool registerSender(roboticslab::ICanSenderDelegate *sender) override
Pass a handle to a CAN sender delegate instance.
Definition ICanBusSharerImpl.cpp:37
bool synchronize(double timestamp) override
Perform synchronized action on CAN master's request.
Definition ICanBusSharerImpl.cpp:45
bool notifyMessage(const roboticslab::can_message &message) override
Notify observers that a new CAN message has arrived.
Definition ICanBusSharerImpl.cpp:30
bool initialize() override
Perform CAN node initialization.
Definition ICanBusSharerImpl.cpp:16
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.
Proxy CAN message structure.
Definition CanMessage.hpp:20