Skip to content

Flaoting-point precision issues of sensor reader #193

@MingfeiCheng

Description

@MingfeiCheng

Hi,

I noticed that floating-point precision sometimes affects sensor readings. I am using CARLA 0.9.10.1. Specifically, in the sensor.speedometer configuration

elif type_ == 'sensor.speedometer':

I encountered an issue when setting the simulation FPS to 25 Hz. The time difference calculated by GameTime.get_time() in the following codes

if current_time - latest_time > (1 / self._reading_frequency) \
is:

current_time - latest_time = 0.03999999910593033

However, the expected reading interval is:

1 / self._reading_frequency = 0.04

This slight mismatch (due to > comparison) results in a SensorReceivedNoData error on the speedometer sensor.

Have you encountered this issue before? Is this considered expected behavior due to floating-point precision limits?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions