|
5 | 5 | import numpy.testing as nptest
|
6 | 6 |
|
7 | 7 | from tesseract_robotics.tesseract_common import GeneralResourceLocator
|
8 |
| -from tesseract_robotics.tesseract_environment import Environment |
| 8 | +from tesseract_robotics.tesseract_environment import Environment, AnyPoly_wrap_EnvironmentConst |
9 | 9 | from tesseract_robotics.tesseract_common import FilesystemPath, Isometry3d, Translation3d, Quaterniond, \
|
10 | 10 | ManipulatorInfo, AnyPoly, AnyPoly_wrap_double
|
11 | 11 | from tesseract_robotics.tesseract_command_language import CartesianWaypoint, WaypointPoly, \
|
|
15 | 15 | AnyPoly_wrap_CompositeInstruction, DEFAULT_PROFILE_KEY, JointWaypoint, JointWaypointPoly, \
|
16 | 16 | InstructionPoly_as_MoveInstructionPoly, WaypointPoly_as_StateWaypointPoly, \
|
17 | 17 | MoveInstructionPoly_wrap_MoveInstruction, StateWaypointPoly_wrap_StateWaypoint, \
|
18 |
| - CartesianWaypointPoly_wrap_CartesianWaypoint, JointWaypointPoly_wrap_JointWaypoint |
| 18 | + CartesianWaypointPoly_wrap_CartesianWaypoint, JointWaypointPoly_wrap_JointWaypoint, \ |
| 19 | + AnyPoly_wrap_ProfileDictionary |
19 | 20 |
|
20 |
| -from tesseract_robotics.tesseract_task_composer import TaskComposerPluginFactory, PlanningTaskComposerProblem, \ |
| 21 | +from tesseract_robotics.tesseract_task_composer import TaskComposerPluginFactory, \ |
21 | 22 | TaskComposerDataStorage, TaskComposerContext
|
22 | 23 |
|
23 | 24 | from tesseract_robotics_viewer import TesseractViewer
|
|
134 | 135 | task = factory.createTaskComposerNode("FreespacePipeline")
|
135 | 136 |
|
136 | 137 | # Get the output keys for the task
|
137 |
| -output_key = task.getOutputKeys()[0] |
| 138 | +output_key = task.getOutputKeys().get("program") |
| 139 | +input_key = task.getInputKeys().get("planning_input") |
138 | 140 |
|
139 | 141 | # Create a profile dictionary. Profiles can be customized by adding to this dictionary and setting the profiles
|
140 | 142 | # in the instructions.
|
|
143 | 145 | # Create an AnyPoly containing the program. This explicit step is required because the Python bindings do not
|
144 | 146 | # support implicit conversion from the CompositeInstruction to the AnyPoly.
|
145 | 147 | program_anypoly = AnyPoly_wrap_CompositeInstruction(program)
|
| 148 | +environment_anypoly = AnyPoly_wrap_EnvironmentConst(t_env) |
| 149 | +profiles_anypoly = AnyPoly_wrap_ProfileDictionary(profiles) |
146 | 150 |
|
147 |
| -# Create the task problem and input |
148 |
| -task_planning_problem = PlanningTaskComposerProblem(t_env, profiles) |
149 |
| -task_planning_problem.input = program_anypoly |
| 151 | +# Create the task data |
| 152 | +task_data = TaskComposerDataStorage() |
| 153 | +task_data.setData(input_key, program_anypoly) |
| 154 | +task_data.setData("environment", environment_anypoly) |
| 155 | +task_data.setData("profiles", profiles_anypoly) |
150 | 156 |
|
151 | 157 | # Create an executor to run the task
|
152 | 158 | task_executor = factory.createTaskComposerExecutor("TaskflowExecutor")
|
153 | 159 |
|
154 | 160 | # Run the task and wait for completion
|
155 |
| -future = task_executor.run(task.get(), task_planning_problem) |
| 161 | +future = task_executor.run(task.get(), task_data) |
156 | 162 | future.wait()
|
157 | 163 |
|
| 164 | +if not future.context.isSuccessful(): |
| 165 | + print("Planning task failed") |
| 166 | + exit(1) |
| 167 | + |
158 | 168 | # Retrieve the output, converting the AnyPoly back to a CompositeInstruction
|
159 | 169 | results = AnyPoly_as_CompositeInstruction(future.context.data_storage.getData(output_key))
|
160 | 170 |
|
|
0 commit comments