-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathZeroTorqueControlMode.h
More file actions
45 lines (38 loc) · 1.46 KB
/
ZeroTorqueControlMode.h
File metadata and controls
45 lines (38 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <string>
#include "AbstractControlMode.h"
class ZeroTorqueControlMode : public AbstractControlMode {
public:
// Constructor
explicit ZeroTorqueControlMode() {
}
// Destructor
~ZeroTorqueControlMode() override = default;
// Start the control mode
void start() override {
// Set up any necessary parameters for zero torque control
robot_->setCollisionBehavior({{100.0, 100.0, 100.0, 100.0, 100.0, 300.0, 300.0}},
{{100.0, 100.0, 100.0, 100.0, 100.0, 300.0, 300.0}},
{{100.0, 100.0, 100.0, 100.0, 100.0, 100.0}},
{{100.0, 100.0, 100.0, 100.0, 100.0, 100.0}});
is_running_ = true;
std::function<franka::Torques(const franka::RobotState &, franka::Duration)>
joint_torque_callback = [this](const franka::RobotState &state, franka::Duration) -> franka::Torques
{
// TODO: quit the mode
if (!is_running_) {
return ;
}
franka::Torques zero_torques{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
this->current_state_->updateState(state);
zero_torques = this->model_->coriolis(state);
return zero_torques;
};
robot_->control(joint_torque_callback);
}
// Stop the control mode
void stop() override {
// Cleanup if necessary
}
protected:
// Setup control mode specifics
};