Calc Results By Python: Vision data type conversion to Python data types

The following information holds for Mech-Vision 1.7.x.

Supported Vision data types

  • PoseList
  • Pose2DList
  • NumberList
  • StringLis
  • Image;Cloud(XYZ)
  • Cloud(XYZ-Normal)
  • Size3DList
  • StringList
  • BoolList
  • IndexList

Input/Output Port Definition

Define multiple inputs by inserting a “;” (without space after “;” else input after the space gets dismissed)
E.g.: Input Port(s): NumberList;StringList

If the number of output ports does not match the number of outputs of the Python function it will happen that the Vision block (Calc Results by) returns “No Output” and the warning: “The number of parameters in the Python script is inconsistent with the number of output ports defined in the Step’s parameter.”

Data Type Mapping

Input/Output Port Shape/len Type DataType Comment
PoseList (N,7) np.array np.float64
Pose2DList (N,3) np.array np.float64 Order: (x,y,theta)
NumberList N list float
StringList N list str
Image/Color (H,W,3) np.array np.uint8
Image/Depth (H,W,1) np.array np.float32
Cloud(XYZ) (N,3) np.array np.float32 x,y,z in m
Cloud(XYZ-Normal) (N,7) np.array np.float32 x,y,z in m; Order: (x,y,z,nx,ny,nz,0)
Size3DList (N,3) np.array np.float64
BoolList N List bool
IndexList N List int

Mech-Vision Lists

It is possible to also pass a list to the Calc Results By Python block. A list in Mech-Vision will be converted to a nested Python list. E.g. PoseList[.] will be converted to a Python list that contains np.arrays.

1 Like