|
3 | 3 | from rcl_interfaces.srv import GetParameters |
4 | 4 | from ament_index_python.packages import get_package_share_directory |
5 | 5 | from xbot2_interface import pyxbot2_interface as xbi |
6 | | -from pyopensot import AffineHelper, OptvarHelper, GenericTask, Task |
7 | | -from pyopensot.tasks.velocity import Postural, Cartesian, Manipulability, MinimumEffort |
8 | | -from pyopensot.constraints.velocity import JointLimits, VelocityLimits |
| 6 | +from pyopensot import AffineHelper, OptvarHelper, GenericTask, Task, AffineTask, AffineConstraint |
| 7 | +from pyopensot.tasks.velocity import Cartesian |
| 8 | +from pyopensot.constraints.velocity import JointLimits |
9 | 9 | import pyopensot as pysot |
10 | 10 | import numpy as np |
11 | 11 | from sensor_msgs.msg import JointState |
@@ -138,7 +138,6 @@ def publish(self, joint_state_msg): |
138 | 138 |
|
139 | 139 | dt = 1./100. |
140 | 140 |
|
141 | | - |
142 | 141 | nx = 3 # [px, py, pz] |
143 | 142 | nu = 3 # [vx, vy, vz] |
144 | 143 |
|
@@ -250,7 +249,15 @@ def create(cls, vee, v): |
250 | 249 |
|
251 | 250 | min_u = pysot.AggregatedTask(min_u_list, variables.getSize()) |
252 | 251 |
|
253 | | -stack = pysot.AutoStack(ik_task + min_u + goal_task_list[Ns-1]) << initial_state |
| 252 | +c = Cartesian("Cartesian", model, "fp3_link8", "world") |
| 253 | +c.setLambda(10.) |
| 254 | + |
| 255 | +qmin, qmax = model.getJointLimits() |
| 256 | +qlims = JointLimits(model, qmax, qmin) |
| 257 | +qlims.setBoundScaling(1./dt) |
| 258 | + |
| 259 | + |
| 260 | +stack = pysot.AutoStack(ik_task + min_u + goal_task_list[Ns-1] + AffineTask.toAffine(c[3:], variables.getVariable("qdot0"))) << initial_state << AffineConstraint.toAffine(qlims, variables.getVariable("qdot0")) |
254 | 261 | stack.update() |
255 | 262 | solver = pysot.iHQP(stack) |
256 | 263 |
|
@@ -279,6 +286,8 @@ def create(cls, vee, v): |
279 | 286 | pose_ref.linear = R.from_quat(quat).as_matrix() |
280 | 287 | goal_task_list[Ns-1].setb(pose_ref.translation) |
281 | 288 |
|
| 289 | + c.setReference(pose_ref) |
| 290 | + |
282 | 291 |
|
283 | 292 | x0 = model.getPose("fp3_link8").translation |
284 | 293 | initial_state.setb(x0) |
|
0 commit comments