Features
Returns the currently set tool geometry information among the current safety setup parameters.
Return
|
Value |
Data Types |
Description |
|---|---|---|
|
ret |
class.config_tool_shape |
Tool Geometry Settings Information |
Class
class.config_tool_shape
|
||
|
Field |
Data Types |
Description |
|---|---|---|
|
obj |
list |
Object information for this class |
|
validity |
int[5] |
Validate(0, 1) |
|
shape |
class.safety_object[5] |
Detailed geometry information |
class.safety_object
|
||
|
Field |
Data Types |
Description |
|---|---|---|
|
obj |
list |
Object information for this class |
|
target_ref |
int |
Unused variable |
|
object_type |
int |
Safety Object Types 0: sphere 1: capsule 2: cuboid |
|
object |
class.safety_object_data |
About each solid shape |
Note
The safety_object_data class is a class organized as a union union in C++ and returns a different class depending on the object_type.
class.safety_object_data
|
|||
|
object_type |
Field |
Data Types |
Description |
|---|---|---|---|
|
- |
obj |
list |
Object information for this class |
|
0 |
sphere |
class.safety_object_sphere |
sphere-shaped objects |
|
1 |
capsule |
class.safety_object_capsule |
Capsule-Shaped Objects |
|
2 |
cuboid |
class.safety_object_cuboid |
Cuboid Shape Objects |
Note
The previous name 'cube' is changed into 'cuboid'.
Can use either 'cube' or 'cuboid' based on the current version of the manual but usage of 'cube' will be deprecated. 'cube' is not recommended
class.safety_object_sphere
|
||
|
Field |
Data Types |
Description |
|---|---|---|
|
obj |
list |
Object information for this class |
|
radius |
float |
Radius |
|
target_pos |
class.point_3d |
3D point information (x, y, z) |
class.point_3d
|
||
|
Field |
Data Types |
Description |
|---|---|---|
|
obj |
list |
Object information for this class |
|
x |
float |
x-axis |
|
y |
float |
y-axis |
|
z |
float |
z-axis |
class.safety_object_capsule
|
||
|
Field |
Data Types |
Description |
|---|---|---|
|
obj |
list |
Object information for this class |
|
radius |
float |
Radius |
|
target_pos |
class.point_3d[2] |
3D point information (x, y, z) |
class.safety_object_cuboid
|
||
|
Field |
Data Types |
Description |
|---|---|---|
|
obj |
list |
Object information for this class |
|
target_pos |
class.point_3d[2] |
3D point information (x, y, z) |
class.point_2d
|
||
|
Field |
Data Types |
Description |
|---|---|---|
|
obj |
list |
Object information for this class |
|
x |
float |
x-axis |
|
y |
float |
y-axis |
Example
tool = get_current_tool_shape()
tp_log("---------------- example start -------------------")
validity = tool.validity # get tool validity
indices = [i for i, x in enumerate(validity) if x] # make list of activated part indexs
tp_log("part validity: {}".format(validity))
for n in indices:
tp_log("> part{} datas".format(n))
tool_shape = tool.shape[n]
obj_type = tool_shape.object_type # get tool object type
if obj_type == 0: # obj type is Sphere
r = tool_shape.object.sphere.radius
target_pos = tool_shape.object.sphere.target_pos
target_pos = [ target_pos.x, target_pos.y, target_pos.z]
tp_log("type: sphere | radious: {:.2f} pos: {}".format(r, target_pos))
elif obj_type == 1: # obj type is Capsule
r = tool_shape.object.capsule.radius
target_pos = tool_shape.object.capsule.target_pos
target_pos = [[ target_pos[j].x, target_pos[j].y, target_pos[j].z] for j in range(2)]
tp_log("type: capsule | radious: {:.2f} pos: {}".format(r, target_pos))
elif obj_type == 2: # obj type is Cuboid
# the previous name 'cube' is changed into 'cuboid'
# can use either 'cube' or 'cuboid' based on the current version of the manual but usage of 'cube' will be deprecated. 'cube' is not recommended
# target_pos = tool_shape.object.cube.target_pos
target_pos = tool_shape.object.cuboid.target_pos
target_pos = [[ target_pos[j].x, target_pos[j].y, target_pos[j].z] for j in range(2)]
tp_log("type: cuboid | pos: {}".format(target_pos))
tp_log("---------------- example end ---------------------")