@@ -86,7 +86,7 @@ def _env_id_from_ns(ns: str) -> int | None:
8686 for part in ns .strip ("/" ).split ("/" ):
8787 if part .startswith ("env_" ):
8888 try :
89- return int (part [len ("env_" ):])
89+ return int (part [len ("env_" ) :])
9090 except ValueError :
9191 return None
9292 return None
@@ -106,12 +106,8 @@ def __init__(self, node: CamNode, ns: str, offset: tuple[float, float]) -> None:
106106 self .ns = ns
107107 self ._ox , self ._oy = offset
108108 self .set_view = node .create_client_wrapper (ViewportSetView , f"{ ns } /viewport/set_view" , timeout = 10.0 )
109- self .set_reference = node .create_client_wrapper (
110- ViewportSetReferenceFrame , f"{ ns } /viewport/set_reference_frame" , timeout = 10.0
111- )
112- self .set_projection = node .create_client_wrapper (
113- ViewportSetProjection , f"{ ns } /viewport/set_projection" , timeout = 10.0
114- )
109+ self .set_reference = node .create_client_wrapper (ViewportSetReferenceFrame , f"{ ns } /viewport/set_reference_frame" , timeout = 10.0 )
110+ self .set_projection = node .create_client_wrapper (ViewportSetProjection , f"{ ns } /viewport/set_projection" , timeout = 10.0 )
115111 # Generous timeout: a capture round-trips a full rendered frame.
116112 self .capture = node .create_client_wrapper (ViewportCapture , f"{ ns } /viewport/capture" , timeout = 30.0 )
117113 self .cmd_view = node .create_publisher (ViewportView , f"{ ns } /viewport/cmd_view" , _STREAM_QOS )
@@ -164,9 +160,7 @@ async def setup(self) -> None:
164160 rclpy .try_shutdown ()
165161 return
166162 if self ._recorder is not None and len (found ) != 1 :
167- self .get_logger ().error (
168- f"record needs exactly one target, found { len (found )} , narrow with --sim or --viz <env_id>"
169- )
163+ self .get_logger ().error (f"record needs exactly one target, found { len (found )} , narrow with --sim or --viz <env_id>" )
170164 rclpy .try_shutdown ()
171165 return
172166
@@ -325,9 +319,7 @@ async def drive(self, duration: float, world_orientation: bool, frame_at: Frame)
325319 break
326320 await asyncio .sleep (period )
327321
328- async def capture (
329- self , endpoint : _Endpoint , position : Vec3 , quat : Quat , world_orientation : bool , fov : float
330- ) -> object | None :
322+ async def capture (self , endpoint : _Endpoint , position : Vec3 , quat : Quat , world_orientation : bool , fov : float ) -> object | None :
331323 req = ViewportCapture .Request ()
332324 req .pose = _ros_pose (self ._local (endpoint , position ), quat )
333325 req .world_orientation = bool (world_orientation )
@@ -338,9 +330,7 @@ async def capture(
338330 self .get_logger ().warning (f"capture call failed: { e } " )
339331 return None
340332
341- async def _record_frame (
342- self , endpoint : _Endpoint , position : Vec3 , quat : Quat , world_orientation : bool , fov : float
343- ) -> bool :
333+ async def _record_frame (self , endpoint : _Endpoint , position : Vec3 , quat : Quat , world_orientation : bool , fov : float ) -> bool :
344334 res = await self .capture (endpoint , position , quat , world_orientation , fov )
345335 if res is None or not res .success :
346336 detail = "service timed out" if res is None else res .message
0 commit comments