@@ -135,11 +135,13 @@ def binary_write_recursive_JointState(parent_off: int, bw_container: BinaryWrite
135135 type = "string"
136136 off = 136
137137
138- offset_from_heap = bw_container .heap_allocator .size () + 8 # 8 bytes for array_size and offset
138+ offset_from_heap = bw_container .heap_allocator .size ()
139+ if allocator .is_heap :
140+ offset_from_heap += 8 # 8 bytes for array_size and offset
139141 array_size = len (py_obj .name )
140142 a_b = array_size .to_bytes (4 , byteorder = 'little' )
141143 o_b = offset_from_heap .to_bytes (4 , byteorder = 'little' )
142- bw_container . heap_allocator .add (a_b + o_b , expected_offset = parent_off + off )
144+ allocator .add (a_b + o_b , expected_offset = parent_off + off )
143145 binary = binary_io .typeTobin_array (type , py_obj .name , 128 )
144146 bw_container .heap_allocator .add (binary , expected_offset = 0 )
145147
@@ -152,11 +154,13 @@ def binary_write_recursive_JointState(parent_off: int, bw_container: BinaryWrite
152154 type = "float64"
153155 off = 144
154156
155- offset_from_heap = bw_container .heap_allocator .size () + 8 # 8 bytes for array_size and offset
157+ offset_from_heap = bw_container .heap_allocator .size ()
158+ if allocator .is_heap :
159+ offset_from_heap += 8 # 8 bytes for array_size and offset
156160 array_size = len (py_obj .position )
157161 a_b = array_size .to_bytes (4 , byteorder = 'little' )
158162 o_b = offset_from_heap .to_bytes (4 , byteorder = 'little' )
159- bw_container . heap_allocator .add (a_b + o_b , expected_offset = parent_off + off )
163+ allocator .add (a_b + o_b , expected_offset = parent_off + off )
160164 binary = binary_io .typeTobin_array (type , py_obj .position , 8 )
161165 bw_container .heap_allocator .add (binary , expected_offset = 0 )
162166
@@ -169,11 +173,13 @@ def binary_write_recursive_JointState(parent_off: int, bw_container: BinaryWrite
169173 type = "float64"
170174 off = 152
171175
172- offset_from_heap = bw_container .heap_allocator .size () + 8 # 8 bytes for array_size and offset
176+ offset_from_heap = bw_container .heap_allocator .size ()
177+ if allocator .is_heap :
178+ offset_from_heap += 8 # 8 bytes for array_size and offset
173179 array_size = len (py_obj .velocity )
174180 a_b = array_size .to_bytes (4 , byteorder = 'little' )
175181 o_b = offset_from_heap .to_bytes (4 , byteorder = 'little' )
176- bw_container . heap_allocator .add (a_b + o_b , expected_offset = parent_off + off )
182+ allocator .add (a_b + o_b , expected_offset = parent_off + off )
177183 binary = binary_io .typeTobin_array (type , py_obj .velocity , 8 )
178184 bw_container .heap_allocator .add (binary , expected_offset = 0 )
179185
@@ -186,11 +192,13 @@ def binary_write_recursive_JointState(parent_off: int, bw_container: BinaryWrite
186192 type = "float64"
187193 off = 160
188194
189- offset_from_heap = bw_container .heap_allocator .size () + 8 # 8 bytes for array_size and offset
195+ offset_from_heap = bw_container .heap_allocator .size ()
196+ if allocator .is_heap :
197+ offset_from_heap += 8 # 8 bytes for array_size and offset
190198 array_size = len (py_obj .effort )
191199 a_b = array_size .to_bytes (4 , byteorder = 'little' )
192200 o_b = offset_from_heap .to_bytes (4 , byteorder = 'little' )
193- bw_container . heap_allocator .add (a_b + o_b , expected_offset = parent_off + off )
201+ allocator .add (a_b + o_b , expected_offset = parent_off + off )
194202 binary = binary_io .typeTobin_array (type , py_obj .effort , 8 )
195203 bw_container .heap_allocator .add (binary , expected_offset = 0 )
196204
0 commit comments