-
Notifications
You must be signed in to change notification settings - Fork 0
/
wbc.orogen
181 lines (137 loc) · 7.3 KB
/
wbc.orogen
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name "wbc"
using_library "base-types"
using_library "wbc-core"
import_types_from "base"
import_types_from "wbc/core/TaskConfig.hpp"
import_types_from "wbc/core/TaskStatus.hpp"
import_types_from "wbc/core/RobotModelConfig.hpp"
import_types_from "wbc/core/QuadraticProgram.hpp"
import_types_from "base/samples/RigidBodyStateSE3.hpp" # Workaround until we have RigidBodyStateSE3 in base/orogen/types
import_types_from "wbcTypes.hpp"
#
# Base WBC Task.
#
# configureHook:
#
# 1. Load and configure robot models
# 2. Configure wbc scene
# 3. Create dynamic ports
#
# updateHook:
#
# 1. Read input ports
# 2. Update robot models
# 3. Update Tasks and send them to the solver
#
task_context "WbcTask" do
needs_configuration
runtime_states "NO_JOINT_STATE", "NO_FLOATING_BASE_STATE"
property("robot_model", "wbc/RobotModelConfig").
doc("Configuration of the robot model. See wbc/core/RobotModelConfig.hpp for details.")
property("qp_solver", "std/string", "qpoases").
doc("Type of QP solver used. Can be one of ['hls','qpoases','qpswift','eiquadprog','proxqp']")
property("wbc_type", "std/string", "velocity_qp").
doc("Type of WBC scene used. Can be one of ['velocity','velocity_qp','acceleration','acceleration_tsid','acceleration_reduced_tsid']")
property("wbc_config", "std/vector<wbc/TaskConfig>").
doc("Configuration of Tasks. The WbcTask will dynamically create the following ports for each task:
Cartesian tasks:
[in] Reference Input (/base/samples/RigidBodyStateSE3): ref_<task_name>
[in] Weights (/base/VectorXd): weight_<task_name>
[in] Activation function (double): activation_<task_name>
[out] Task pose/twist/acceleration output (/base/samples/RigidBodyStateSE3): status_<task_name>
[out] Task debug output (/wbc/TaskStatus): task_<task_name>
Joint Space tasks:
[in] Reference Input (/base/samples/Joints): ref_<task_name>
[in] Weights (/base/VectorXd): weight_<task_name>
[in] Activation function (double): activation_<task_name>
[out] Current joint state output (base/samples/Joints): status_<task_name>
[out] Task debug output (/wbc/TaskStatus): task_<task_name>")
property("initial_joint_weights", "wbc/JointWeights").
doc("The joint weights control the contribution of each individual joint to the task solution. Values have to be within (0 <= wq <= 1). A zero means here that the joint is not used at all. Size has to be same as number of robot joints or empty, in which case each joint weight is set to 1.")
property("compute_task_status", "bool", true).
doc("For debugging purpose: Compute debug the current status for each task, which contains (a) the solver output projected to task space (desired task space motion) and
(b) the actual task space motion")
property("integrate", "bool", true).
doc("Perform numerical integration on the solver output, e.g. if output is acceleration type, integrate twice to get velocity and position")
# These dynamic ports are created according to the 'wbc_config' (see above)
dynamic_input_port /.*/, "/base/samples/Joints"
dynamic_input_port /.*/, "/base/samples/RigidBodyStateSE3"
dynamic_input_port /.*/, "/base/VectorXd"
dynamic_input_port /.*/, "/double"
dynamic_output_port /.*/, "/base/samples/Joints"
input_port("joint_weights", "wbc/JointWeights").
doc("Update joint weight values. Size has to be same number of joints.")
input_port("floating_base_state", "base/samples/RigidBodyStateSE3").
doc("Pose, Twist and spatial acceleration of the 6 dof floating base.")
input_port("floating_base_state_deprecated", "base/samples/RigidBodyState").
doc("Deprecated: In future the port floating_base_state should be used")
input_port("joint_state", "base/samples/Joints").
doc("Current joint state of the robot. Right now, only positions are required. All configured joints have to be in this vector.")
input_port("active_contacts", "wbc/ActiveContacts").
doc("Set active contact points. The given names have to be configured as contact_points in the robot model.
Depending on the WBC scene implementation this will change the qp according to the current contact configuration")
input_port("contact_wrenches", "base/samples/Wrenches").
doc("Measured contact wrenches. The given names have to be consistent with the configured contact points")
output_port("solver_output", "base/commands/Joints").
doc("Computed solver output")
output_port("com", "base/samples/RigidBodyStateSE3").
doc("Current center of mass")
output_port("current_joint_weights", "wbc/JointWeights").
doc("Debug: Current joint weight vector")
output_port("timing_stats", "wbc/TimingStats").
doc("Debug: Statistics on computation time")
output_port("current_qp", "wbc/HierarchicalQP").
doc("Debug: Output quadratic prosolver_outputgram for the solver.")
output_port("full_joint_state", "base/samples/Joints").
doc("Debug: Complete joint state including virtual joints as used by the solver.")
output_port("estimated_contact_wrenches", "base/samples/Wrenches").
doc("Estimated contact wrenches")
operation("activateTask").
argument("task_name", "std/string").
argument("activation", "double")
operation("activateTasks").
argument("task_names", "std/vector<std/string>").
argument("activation", "double")
operation("deactivateAllTasks")
periodic 0.001
end
#
# Convert samples of type base/samples/CartesianState to type base/samples/RigidBodyState and vice versa
#
task_context "RbsToCartesianStateTask" do
needs_configuration
dynamic_input_port /.*/, "/base/samples/RigidBodyState"
dynamic_output_port /.*/, "/base/samples/RigidBodyStateSE3"
property("input_ports", "std/vector<std/string>").
doc("Vector of names of the input ports of type base/samples/RigidBodyState")
port_driven
end
#
# Convert samples of type base/samples/RigidBodyState to type base/samples/CartesianState
#
task_context "CartesianStateToRbsTask" do
needs_configuration
dynamic_input_port /.*/, "/base/samples/RigidBodyStateSE3"
dynamic_output_port /.*/, "/base/samples/RigidBodyState"
property("input_ports", "std/vector<std/string>").
doc("Vector of names of the input ports of type base/samples/CartesianState")
port_driven
end
#
# Simple fake joint position interface required for the tutorials
#
task_context "LoopBackDriver" do
needs_configuration
property("initial_joint_state", "base/samples/Joints").
doc("Initial position of the robot. Needs to include all joints")
property("noise_std_dev", "double", 1e-4).
doc("White noise std deviation which is added to the position/velocity/acceleration readings")
input_port("command", "base/commands/Joints").
doc("Input joint command. Has to contain all joints configureed in initial_joint_state.")
output_port("joint_state", "base/samples/Joints").
doc("Current joint state.")
periodic 0.001
end
typekit do
export_types "wbc/TaskStatus"
end