|
33 | 33 | from compas_fab.backends.ros.messages import PositionConstraint |
34 | 34 | from compas_fab.backends.ros.messages import PositionIKRequest |
35 | 35 | from compas_fab.backends.ros.messages import RobotState |
| 36 | +from compas_fab.backends.ros.messages import TrajectoryConstraints |
36 | 37 | from compas_fab.backends.ros.planner_backend import PlannerBackend |
37 | 38 | from compas_fab.backends.ros.planner_backend import ServiceDescription |
38 | 39 | from compas_fab.robots import Configuration |
@@ -206,6 +207,8 @@ def plan_cartesian_motion_async(self, callback, errback, |
206 | 207 | aco = AttachedCollisionObject.from_attached_collision_mesh(acm) |
207 | 208 | start_state.attached_collision_objects.append(aco) |
208 | 209 |
|
| 210 | + path_constraints = self._convert_constraints_to_rosmsg(path_constraints, header) |
| 211 | + |
209 | 212 | request = dict(header=header, |
210 | 213 | start_state=start_state, |
211 | 214 | group_name=group, |
@@ -264,38 +267,12 @@ def plan_motion_async(self, callback, errback, |
264 | 267 | aco = AttachedCollisionObject.from_attached_collision_mesh(acm) |
265 | 268 | start_state.attached_collision_objects.append(aco) |
266 | 269 |
|
267 | | - # goal constraints |
268 | | - constraints = Constraints() |
269 | | - for c in goal_constraints: |
270 | | - if c.type == c.JOINT: |
271 | | - constraints.joint_constraints.append( |
272 | | - JointConstraint.from_joint_constraint(c)) |
273 | | - elif c.type == c.POSITION: |
274 | | - constraints.position_constraints.append( |
275 | | - PositionConstraint.from_position_constraint(header, c)) |
276 | | - elif c.type == c.ORIENTATION: |
277 | | - constraints.orientation_constraints.append( |
278 | | - OrientationConstraint.from_orientation_constraint(header, c)) |
279 | | - else: |
280 | | - raise NotImplementedError |
281 | | - goal_constraints = [constraints] |
282 | | - |
283 | | - # path constraints |
284 | | - if path_constraints: |
285 | | - constraints = Constraints() |
286 | | - for c in path_constraints: |
287 | | - if c.type == c.JOINT: |
288 | | - constraints.joint_constraints.append( |
289 | | - JointConstraint.from_joint_constraint(c)) |
290 | | - elif c.type == c.POSITION: |
291 | | - constraints.position_constraints.append( |
292 | | - PositionConstraint.from_position_constraint(header, c)) |
293 | | - elif c.type == c.ORIENTATION: |
294 | | - constraints.orientation_constraints.append( |
295 | | - OrientationConstraint.from_orientation_constraint(header, c)) |
296 | | - else: |
297 | | - raise NotImplementedError |
298 | | - path_constraints = constraints |
| 270 | + # convert constraints |
| 271 | + goal_constraints = [self._convert_constraints_to_rosmsg(goal_constraints, header)] |
| 272 | + path_constraints = self._convert_constraints_to_rosmsg(path_constraints, header) |
| 273 | + |
| 274 | + if trajectory_constraints is not None: |
| 275 | + trajectory_constraints = TrajectoryConstraints(constraints=self._convert_constraints_to_rosmsg(path_constraints, header)) |
299 | 276 |
|
300 | 277 | request = dict(start_state=start_state, |
301 | 278 | goal_constraints=goal_constraints, |
|
0 commit comments