Simulation needs to be stopped, then started again, in order to see IMU data

I have an IMU sensor created like so:

        success, _isaac_sensor_prim = omni.kit.commands.execute(
            "IsaacSensorCreateImuSensor",
            path="/imu_yaw1_link",
            parent=self.body_path,
            sensor_period=sensor_period,
            linear_acceleration_filter_size=5,
            angular_velocity_filter_size=5,
            orientation_filter_size=10,
            translation = Gf.Vec3d(0, 0, 0),
            orientation = Gf.Quatd(1, 0, 0, 0),
        )

        self.imu_interface = _sensor.acquire_imu_sensor_interface()

        self.publisher_ = self.create_publisher(Imu, 'imu_yaw1_link', 1)
        timer_period = sensor_period
        self.timer = self.create_timer(timer_period, self.timer_callback)

    def timer_callback(self):
        msg = Imu()
        imu_reading = self.imu_interface.get_sensor_reading(self.body_path + "/imu_yaw1_link", use_latest_data = True)

I find that imu_reading is all-zeros unless I do:

    simulation_context.play()
    simulation_context.stop()
    simulation_context.play()

?!

Which version are you using? Could you provide a script to quickly replicate the issue?

version 4.2.0. I don’t know about a script to replicate it, what I have is proprietary and complicated

Please refer to the implementation of ~/.local/share/ov/pkg/isaac-sim-4.2.0/exts/omni.isaac.sensor/omni/isaac/sensor/scripts/samples/imu_sensor.py:

    def build_ui(self):
...
            self.sub = _physx.get_physx_interface().subscribe_physics_step_events(self._on_update)
...
    def _on_update(self, dt):
        if self._timeline.is_playing() and self.sliders:
            reading = self._is.get_sensor_reading(self.body_path + "/sensor")**strong text**