From e2a915e4f73ba8fefed22d87671ff8f935c0b1f1 Mon Sep 17 00:00:00 2001 From: Michael Carlstrom Date: Fri, 24 Oct 2025 17:25:57 -0700 Subject: [PATCH 1/4] Add specialziation table Signed-off-by: Michael Carlstrom --- source/Concepts/Basic/About-Interfaces.rst | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/source/Concepts/Basic/About-Interfaces.rst b/source/Concepts/Basic/About-Interfaces.rst index e4f25b0d90..0b0d831549 100644 --- a/source/Concepts/Basic/About-Interfaces.rst +++ b/source/Concepts/Basic/About-Interfaces.rst @@ -161,6 +161,48 @@ 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. +If a container or type is not mentioned then the default mapping is used. + +.. list-table:: + :header-rows: 1 + :widths: 1 4 4 3 + + * - 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 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 From 48a8f9db063f59af851eb76da24733cb609792a0 Mon Sep 17 00:00:00 2001 From: Michael Carlstrom Date: Fri, 24 Oct 2025 17:26:30 -0700 Subject: [PATCH 2/4] remove widths Signed-off-by: Michael Carlstrom --- source/Concepts/Basic/About-Interfaces.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/source/Concepts/Basic/About-Interfaces.rst b/source/Concepts/Basic/About-Interfaces.rst index 0b0d831549..f257a995ae 100644 --- a/source/Concepts/Basic/About-Interfaces.rst +++ b/source/Concepts/Basic/About-Interfaces.rst @@ -166,7 +166,6 @@ If a container or type is not mentioned then the default mapping is used. .. list-table:: :header-rows: 1 - :widths: 1 4 4 3 * - IDL type - IDL details From 309b7c80e6ed498bce3834c8a21bdb78c13cf9fa Mon Sep 17 00:00:00 2001 From: Michael Carlstrom Date: Fri, 24 Oct 2025 17:30:43 -0700 Subject: [PATCH 3/4] add other type stuff to numpy Signed-off-by: Michael Carlstrom --- source/Concepts/Basic/About-Interfaces.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/Concepts/Basic/About-Interfaces.rst b/source/Concepts/Basic/About-Interfaces.rst index f257a995ae..02c44bcec2 100644 --- a/source/Concepts/Basic/About-Interfaces.rst +++ b/source/Concepts/Basic/About-Interfaces.rst @@ -178,9 +178,11 @@ If a container or type is not mentioned then the default mapping is used. int16, uint16, int32, uint32, int64, uint64 - - numpy.ndarray + - numpy.ndarray( + shape=(N, ), + dtype=numpy.DT) - shape = (N,) - dtype based on T: + where DT is based on T: float -> float32 double -> float64 intX -> intX From 61aa86a4b429357b68ecef84f034cb26670e3fa0 Mon Sep 17 00:00:00 2001 From: Michael Carlstrom Date: Tue, 28 Oct 2025 19:32:19 -0700 Subject: [PATCH 4/4] add Sequence Signed-off-by: Michael Carlstrom --- source/Concepts/Basic/About-Interfaces.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Concepts/Basic/About-Interfaces.rst b/source/Concepts/Basic/About-Interfaces.rst index 02c44bcec2..fbfdb27206 100644 --- a/source/Concepts/Basic/About-Interfaces.rst +++ b/source/Concepts/Basic/About-Interfaces.rst @@ -161,7 +161,7 @@ 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. +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::