YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
ImplementJointBrake.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025-2025 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
9
10#include <cstdio>
11using namespace yarp::dev;
12using namespace yarp::os;
13
14#define JOINTIDCHECK \
15 if (j >= castToMapper(helper)->axes()) { \
16 yError("joint id out of bound"); \
17 return ReturnValue::return_code::return_value_error_method_failed; \
18 }
19
21 helper(nullptr),
22 raw(r)
23{}
24
25bool ImplementJointBrake::initialize(int size, const int* amap)
26{
27 if (helper != nullptr) {
28 return false;
29 }
30
31 helper=(void *)(new ControlBoardHelper(size, amap));
32 yAssert (helper != nullptr);
33
34 return true;
35}
36
41
43{
44 if (helper!=nullptr)
45 {
46 delete castToMapper(helper);
47 helper=nullptr;
48 }
49
50 return true;
51}
52
59
66
68{
70 int k = castToMapper(helper)->toHw(j);
71 return raw->setAutoBrakeEnabledRaw(k, enabled);
72}
73
75{
77 int k = castToMapper(helper)->toHw(j);
78 return raw->getAutoBrakeEnabledRaw(k, enabled);
79}
yarp::dev::ControlBoardHelper * castToMapper(void *p)
#define JOINTIDCHECK
#define yAssert(x)
Definition Log.h:388
Interface for controlling a joint equipped with brakes (hardware or simulated).
Definition IJointBrake.h:70
virtual yarp::dev::ReturnValue setManualBrakeActiveRaw(int j, bool active)=0
virtual yarp::dev::ReturnValue isJointBrakedRaw(int j, bool &braked) const =0
virtual yarp::dev::ReturnValue getAutoBrakeEnabledRaw(int j, bool &enabled) const =0
virtual yarp::dev::ReturnValue setAutoBrakeEnabledRaw(int j, bool enabled)=0
virtual yarp::dev::ReturnValue setManualBrakeActive(int j, bool active) override
Enables/Disables manually the joint brake.
ImplementJointBrake(yarp::dev::IJointBrakeRaw *y)
virtual yarp::dev::ReturnValue isJointBraked(int j, bool &braked) const override
Check is the joint brake is currently active.
virtual ~ImplementJointBrake()
Destructor.
yarp::dev::IJointBrakeRaw * raw
bool uninitialize()
Clean up internal data and memory.
bool initialize(int size, const int *amap)
Initialize the internal data and alloc memory.
virtual yarp::dev::ReturnValue setAutoBrakeEnabled(int j, bool enabled) override
Enables/Disables the automatic joint brake.
virtual yarp::dev::ReturnValue getAutoBrakeEnabled(int j, bool &enabled) const override
checks if the automatic joint brake mode is enabled or disabled.
A mini-server for performing network communication in the background.
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.