-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ROS 2 camera publish frequency is loosely respected #804
Comments
Yes, it will be loosely respected by its design. Sensor triggering in O3DE ROS 2 gemSensors in O3DE can be triggered by two sources:
I've modified ROS 2 gem to log those event and put two sensors in scene, one camera set to 10FPS and Imu set to 30 Hz. You can see in the images above:
Note that we look at data in Wall-Time domain. In simulation time (referenced to /clock topic) they are distributed evenly. AlgorithmAlgorithm that is introduced in ROS 2 gem works as expected (for camera sensor):
Let us do some math, assume that your machine delivers 100 FPS and you requested 60FPS.
The ideal triggering time for 60 FPS is 16.7 ms.
With that will give triggering time of However, you expect large discrepancy (not 5 FPs but 2x times). Known issuesOne frame statisticWe use only one frame to compute waiting number of frame - that is bad. Let's do our test again with no frame limiter: Frame with extra camera rendered takes twice time. What should we do? / tldr.Always use framelimiter and set its value to the fastest camera. It can be done in command line, can be done with lua: local SetMaxFPS =
{
Properties =
{
MaxFPS = {default = 60}
}
}
function SetMaxFPS:OnActivate()
command = string.format("sys_MaxFPS=%f", self.Properties.MaxFPS)
ConsoleRequestBus.Broadcast.ExecuteConsoleCommand("vsync_interval=0")
ConsoleRequestBus.Broadcast.ExecuteConsoleCommand(command)
Debug.Log("Set max FPS")
end
function SetMaxFPS:OnDeactivate()
ConsoleRequestBus.Broadcast.ExecuteConsoleCommand("vsync_interval=0")
ConsoleRequestBus.Broadcast.ExecuteConsoleCommand("sys_MaxFPS=100")
end
return SetMaxFPS
Other materials:Experimental branch with logging: |
Since it can be easily solved with framelimiter I lowered priority to major. |
Describe the bug
ROS 2 camera publish frequency is loosely respected.
Example: Full HD resolution. Setting output frequency to 60Hz results in ~30Hz on
ros2 topic hz
. Changing output on the very same scene and machine to 120Hz results in ~60hz on output. Differences vary depending on level complexity, but this suggest it is possible to achieve the desired frequency, but for some reason it is not the case.Steps to reproduce
Steps to reproduce the behavior:
ros2 topic hz <topic_name>
to check the output frequency.Expected behavior
Output frequency is relatively close to the desired.
Actual behavior
Output frequency is lower than desired.
Found in Branch
development
Desktop/Device (please complete the following information):
OS: Ubuntu 22.04
Version [e.g. 10, Monterey, Oreo]
CPU I7 13th gen.
GPU RTX 4080
Memory 64GB
The text was updated successfully, but these errors were encountered: