@@ -43,10 +43,12 @@ class TracedCommands:
4343 def __init__ (self , traceparent = "" ) -> None :
4444 self .traceparent = traceparent
4545 self .commands = defaultdict (dict )
46+ self .timestamp = 0
4647
4748 def clear (self ):
4849 self .traceparent = ""
4950 self .commands .clear ()
51+ self .timestamp = 0
5052
5153
5254
@@ -193,9 +195,9 @@ def on_dynamic_joint_commands(self, command: DynamicJointState):
193195 })
194196 with self .pub_lock :
195197 rm .travel_span ("wait_for_pub_lock" ,
196- start_time = start_wait ,
197- tracer = self .tracer ,
198- )
198+ start_time = start_wait ,
199+ tracer = self .tracer ,
200+ )
199201 self .requested_commands .traceparent = rm .traceparent ()
200202 for name , iv in zip (command .joint_names , command .interface_values ):
201203 if name not in self .joint_state :
@@ -211,12 +213,18 @@ def on_dynamic_joint_commands(self, command: DynamicJointState):
211213 )
212214 continue
213215 self .requested_commands .commands [name ][k ] = v
216+
217+ self .requested_commands .timestamp = time .time_ns ()
214218 self .joint_command_request_pub .set ()
215219 self .on_dynamic_joint_commands_counter -= 1
216220
217221 def publish_command_loop (self ):
218222 while rclpy .ok ():
219223 self .joint_command_request_pub .wait ()
224+ rm .travel_span ("wait_for_command_request_pub" ,
225+ start_time = self .requested_commands .timestamp ,
226+ tracer = self .tracer ,
227+ context = rm .ctx_from_traceparent (self .requested_commands .traceparent ))
220228
221229 with self .pub_lock :
222230 self .handle_commands (self .requested_commands )
0 commit comments