@@ -128,9 +128,13 @@ class IMUOptions(RigidSensorOptionsMixin, NoisySensorOptionsMixin, SensorOptions
128128 draw_debug : bool, optional
129129 If True and the rasterizer visualization is active, an arrow for linear acceleration will be drawn.
130130 debug_acc_color : float, optional
131- The rgba color of the debug acceleration arrow. Defaults to (1 .0, 0 .0, 0 .0, 0.5).
131+ The rgba color of the debug acceleration arrow. Defaults to (0 .0, 1 .0, 1 .0, 0.5).
132132 debug_acc_scale: float, optional
133133 The scale factor for the debug acceleration arrow. Defaults to 0.01.
134+ debug_gyro_color : float, optional
135+ The rgba color of the debug gyroscope arrow. Defaults to (1.0, 1.0, 0.0, 0.5).
136+ debug_gyro_scale: float, optional
137+ The scale factor for the debug gyroscope arrow. Defaults to 0.01.
134138 """
135139
136140 acc_resolution : MaybeTuple3FType = 0.0
@@ -144,8 +148,10 @@ class IMUOptions(RigidSensorOptionsMixin, NoisySensorOptionsMixin, SensorOptions
144148 acc_random_walk : MaybeTuple3FType = 0.0
145149 gyro_random_walk : MaybeTuple3FType = 0.0
146150
147- debug_acc_color : tuple [float , float , float , float ] = (1 .0 , 0 .0 , 0 .0 , 0.5 )
151+ debug_acc_color : tuple [float , float , float , float ] = (0 .0 , 1 .0 , 1 .0 , 0.5 )
148152 debug_acc_scale : float = 0.01
153+ debug_gyro_color : tuple [float , float , float , float ] = (1.0 , 1.0 , 0.0 , 0.5 )
154+ debug_gyro_scale : float = 0.01
149155
150156 def validate (self , scene ):
151157 super ().validate (scene )
@@ -252,7 +258,7 @@ def build(self):
252258 )
253259
254260 if self ._options .draw_debug :
255- self .debug_object = None
261+ self .debug_objects = [ None , None ]
256262 self .quat_offset = self ._shared_metadata .offsets_quat [0 , self ._idx ]
257263 self .pos_offset = self ._shared_metadata .offsets_pos [0 , self ._idx ]
258264
@@ -334,9 +340,15 @@ def _draw_debug(self, context: "RasterizerContext"):
334340 pos = self .link .get_pos (envs_idx = envs_idx ).squeeze (0 ) + transform_by_quat (self .pos_offset , quat )
335341
336342 data = self .read (envs_idx = envs_idx )
337- vec = data ["lin_acc" ].squeeze (0 ) * self ._options .debug_acc_scale
338- vec = tensor_to_array (transform_by_quat (vec , transform_quat_by_quat (self .quat_offset , quat )))
339-
340- if self .debug_object is not None :
341- context .clear_debug_object (self .debug_object )
342- self .debug_object = context .draw_debug_arrow (pos = pos , vec = vec , color = self ._options .debug_acc_color )
343+ acc_vec = data ["lin_acc" ].squeeze (0 ) * self ._options .debug_acc_scale
344+ gyro_vec = data ["ang_vel" ].squeeze (0 ) * self ._options .debug_gyro_scale
345+ # transform from local frame to world frame
346+ offset_quat = transform_quat_by_quat (self .quat_offset , quat )
347+ acc_vec = tensor_to_array (transform_by_quat (acc_vec , offset_quat ))
348+ gyro_vec = tensor_to_array (transform_by_quat (gyro_vec , offset_quat ))
349+
350+ for debug_object in self .debug_objects :
351+ if debug_object is not None :
352+ context .clear_debug_object (debug_object )
353+ self .debug_objects [0 ] = context .draw_debug_arrow (pos = pos , vec = acc_vec , color = self ._options .debug_acc_color )
354+ self .debug_objects [1 ] = context .draw_debug_arrow (pos = pos , vec = gyro_vec , color = self ._options .debug_gyro_color )
0 commit comments