SimulationProgram
¶
A simulation program.
It's holding a list of instructions and reference to its parent if applicable. Also takes note of the current robot position and cube state.
Attributes:
Name | Type | Description |
---|---|---|
name |
str |
the name of the simulation program for logging purposes |
parent |
Optional[SimulationProgram] |
the parent simulation program for building a tree-like structure |
initial_cube_state |
CubeState |
the cube state in the beginning of the program when no intruction has been carried out |
initial_robot_joints |
List[float] |
the angle of each robot joint before the simulation should start |
collision_checking_result |
Optional[SimulationResult] |
the result of the path simulation (including collision checking) through RoboDK |
append_instruction(self, instruction, recalculate_resulting_cube_state=True)
¶
Appends a given instruction to the end of the program.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instruction |
SimulationInstruction |
the instruction to append |
required |
recalculate_resulting_cube_state |
bool |
flag, indicating whether to immediately recalculate the resulting cube state or post pone it to the next access |
True |
Source code in core/manipulator/SimulationProgram.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
append_instructions(self, instructions, recalculate_resulting_cube_state=True)
¶
Appends a given set of instructions to the end of the program.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instructions |
List[core.manipulator.SimulationInstruction.SimulationInstruction] |
the instructions to append |
required |
recalculate_resulting_cube_state |
bool |
flag, indicating whether to immediately recalculate the resulting cube state or post pone it to the next access |
True |
Source code in core/manipulator/SimulationProgram.py
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 |
|
create_follow_up(self, name)
¶
Creates a follow-up program.
The newly created simulation program has this program as its parent and the resulting robot position as its initial robot position.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str |
the name of the follow-up program |
required |
Returns:
Type | Description |
---|---|
SimulationProgram |
the follow-up |
Source code in core/manipulator/SimulationProgram.py
109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
execute(self)
¶
Executes the program through python including all parent instructions.
Source code in core/manipulator/SimulationProgram.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
final_robot_position(self)
¶
Returns the robot joints after the program was run.
Returns:
Type | Description |
---|---|
List[float] |
the robot joints of the last |
Source code in core/manipulator/SimulationProgram.py
159 160 161 162 163 164 165 166 167 168 169 170 |
|
flattened_standalone(self, name)
¶
Creates a standalone program.
All instructions including those of its parents are deepcopied and added to the standalone.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str |
the name of the flattened program |
required |
Returns:
Type | Description |
---|---|
SimulationProgram |
the flattened program |
Source code in core/manipulator/SimulationProgram.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
get_unchecked_collision_checking_programs(self)
¶
Returns all unchecked programs in the current hierarchy path (i.e. including unchecked parents).
Returns:
Type | Description |
---|---|
List[SimulationProgram] |
the unchecked programs |
Source code in core/manipulator/SimulationProgram.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
resulting_cube_state(self)
¶
Calculates the state of the cube when the program was run.
Returns:
Type | Description |
---|---|
CubeState |
the resulting cube state |
Source code in core/manipulator/SimulationProgram.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
RoboDKProgram
¶
An interface to a RoboDK program.
This class can setup, collision check, execute and teardown a RoboDK program.
Attributes:
Name | Type | Description |
---|---|---|
simulation_program |
SimulationProgram |
the simulation program to create in RoboDK |
program_name |
str |
the name of the program in the RoboDK item tree. |
program |
Optional[robolink.Item] |
the RoboDK program item |
evaluate(self)
¶
Sets up the program and performs a collision checking evaluation.
Returns:
Type | Description |
---|---|
SimulationResult |
the simulation result |
Source code in core/manipulator/RoboDKProgram.py
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 |
|
execute(self, teardown_on_done=True)
¶
Executes the program through RoboDK.
Source code in core/manipulator/RoboDKProgram.py
85 86 87 88 89 90 91 92 93 94 95 |
|
perform_remaining_collision_checks(simulation_program, program_name_prefix=None)
classmethod
¶
Performs collision checking on the untested portions of the given simulation program. The results of each simulation program will be set afterwards.
Source code in core/manipulator/RoboDKProgram.py
97 98 99 100 101 102 103 104 105 106 107 |
|
setup(self)
¶
Prepares the program for evaluation.
Creates a fresh RoboDK Program and adds the instructions of the simulation program to it.
Source code in core/manipulator/RoboDKProgram.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
teardown(self)
¶
Deletes the program from the RoboDK item tree.
Source code in core/manipulator/RoboDKProgram.py
48 49 50 51 52 53 54 55 56 |
|
SimulationResult
¶
A container for simulation results.
It stores the evaluation results of a RoboDK program.
Attributes:
Name | Type | Description |
---|---|---|
num_valid_instructions |
int |
the number of valid instructions |
time |
float |
the time in seconds needed for execution |
distance |
float |
the distance travelled in mm |
path_validity_percentage |
float |
the percentage of the path which can be followed without a collision |
message |
str |
a message given by RoboDK during the evaluation |