PlatformControllerExecutor.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <string>
5
14
16{
17 class ComponentPlugin;
18}
19
21{
22
23 /**
24 * @brief The PlatformUnitExecutor class
25 *
26 * TODO: Should be renamed to whatever the new unit will be called which takes Mat4f
27 * as input instead of X/Y/Yaw, so that we have a generic interface.
28 */
30 {
31
32 public:
34
36 {
37 std::string robotName;
39 };
40
41 /**
42 * @param emergencyStop Consulted before re-activating a controller. `nullptr` means
43 * this deployment has no emergency-stop source, which is not the
44 * same as one that has gone silent: absent proceeds, broken
45 * refuses.
46 */
48 const Properties& properties,
49 const EmergencyStopInterface* emergencyStop = nullptr);
51
53 bool activateController = false) override;
55 bool activateController = false) override;
56
57 void start(ControllerType controllerType) override;
58
59 void ensureIsActive(ControllerType controllerType) override;
60
61 bool consumeEmergencyStopRelease() override;
62
63 void stop() override;
64
65 /// Bumps the controller's `diagnostics.dumpRequest`, which makes it write the episode it
66 /// has recorded and begin the next one. Does nothing if diagnostics are off.
67 void dumpDiagnostics() override;
68
69 void updateVelocityLimits(const core::TwistLimits& limits) override;
70
71 void updateVelocityFactor(float velocityFactor) override;
72
73
74 private:
75 /**
76 * @brief Deactivate both controllers regardless of whether they currently *run*.
77 *
78 * `stop()` cannot serve here: it only deactivates a controller that reports active, and
79 * during an emergency stop the RobotUnit has already deactivated ours -- so it would
80 * leave the request standing, which is the very thing that has to go. It also stops the
81 * platform through the PlatformUnit, which is meaningless while the drives are held.
82 */
83 void withdrawControllerRequests();
84
85 ControllerComponentPlugin& controllerPlugin_;
86
87 const Properties properties_;
88
89 /// Non-owning; outlives this object. Null when the deployment has no emergency stop.
90 const EmergencyStopInterface* emergencyStop_;
91
92
95 globalTrajCtrl_;
96
99 localTrajCtrl_;
100
103 globalTrajCtrlInitialConfig_;
104
107 localTrajCtrlInitialConfig_;
108
109
110 ControllerType lastActiveController_ = ControllerType::None;
111
112 /// Edge detection on `emergencyStop_->isActive()`, both read and written only from the
113 /// navigator's periodic task via `ensureIsActive` / `consumeEmergencyStopRelease`.
114 bool emergencyStopWasActive_ = false;
115 bool emergencyStopReleased_ = false;
116 };
117
118} // namespace armarx::navigation::server
Wrapper class for an NJointController proxy.
The robot's software emergency stop, as far as navigation needs to know it.
An executer the server navigator will use to send its control commands to.
void ensureIsActive(ControllerType controllerType) override
PlatformControllerExecutor(ControllerComponentPlugin &controllerComponentPlugin, const Properties &properties, const EmergencyStopInterface *emergencyStop=nullptr)
void updateVelocityLimits(const core::TwistLimits &limits) override
bool consumeEmergencyStopRelease() override
Whether the emergency stop has been released since this was last asked.
armarx::control::client::ComponentPlugin ControllerComponentPlugin
void execute(const core::LocalTrajectory &trajectory, bool activateController=false) override
void dumpDiagnostics() override
Bumps the controller's diagnostics.dumpRequest, which makes it write the episode it has recorded and ...
This file is part of ArmarX.
This file is part of ArmarX.