diff --git a/source/Concepts/Basic/About-Interfaces.rst b/source/Concepts/Basic/About-Interfaces.rst index e4f25b0d90..fbfdb27206 100644 --- a/source/Concepts/Basic/About-Interfaces.rst +++ b/source/Concepts/Basic/About-Interfaces.rst @@ -161,6 +161,49 @@ Field types can be: (*) All types that are more permissive than their ROS definition enforce the ROS constraints in range and length by software. +These array and sequence types have special mappings in Python. Any subclass of **collections.abc.Sequence** can be passed in for an array. +If a container or type is not mentioned then the default mapping is used. + +.. list-table:: + :header-rows: 1 + + * - IDL type + - IDL details + - Python type + - Notes + * - T[N] + - Numeric types: + float, double, + int8, uint8, + int16, uint16, + int32, uint32, + int64, uint64 + - numpy.ndarray( + shape=(N, ), + dtype=numpy.DT) + - shape = (N,) + where DT is based on T: + float -> float32 + double -> float64 + intX -> intX + uintX -> uintX + * - sequence + - Unbounded sequence + of numeric T + - array.array( + typecode ) + - typecode based on T: + f, d, b, B, + h, H, l, L, + q, Q + * - sequence + - Bounded sequence + of numeric T + - array.array( + typecode ) + - Same typecodes + as above + *Example of message definition using arrays and bounded types:* .. code-block:: bash