fallbacks.py
Go to the documentation of this file.
1 #! /usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 from moveit.task_constructor import core, stages
5 from py_binding_tools import roscpp_init
6 import time
7 
8 roscpp_init("mtc_tutorial")
9 
10 # use cartesian and joint interpolation planners
11 cartesianPlanner = core.CartesianPath()
12 jointPlanner = core.JointInterpolationPlanner()
13 
14 # initialize the mtc task
15 task = core.Task()
16 task.name = "fallbacks"
17 
18 # add the current planning scene state to the task hierarchy
19 currentState = stages.CurrentState("Current State")
20 task.add(currentState)
21 
22 # [initAndConfigFallbacks]
23 # create a fallback container to fall back to a different planner
24 # if motion generation fails with the primary one
25 fallbacks = core.Fallbacks("Fallbacks")
26 
27 # primary motion plan
28 moveTo1 = stages.MoveTo("Move To Goal Configuration 1", cartesianPlanner)
29 moveTo1.group = "panda_arm"
30 moveTo1.setGoal("extended")
31 fallbacks.insert(moveTo1)
32 
33 # fallback motion plan
34 moveTo2 = stages.MoveTo("Move To Goal Configuration 2", jointPlanner)
35 moveTo2.group = "panda_arm"
36 moveTo2.setGoal("extended")
37 fallbacks.insert(moveTo2)
38 
39 # add the fallback container to the task hierarchy
40 task.add(fallbacks)
41 # [initAndConfigFallbacks]
42 
43 if task.plan():
44  task.publish(task.solutions[0])
45 time.sleep(1)
moveit::task_constructor


demo
Author(s): Robert Haschke , Simon Goldstein , Henning Kayser
autogenerated on Sat May 3 2025 02:40:30