Skip to content

/clock Topic Not Published and Unreal Engine 5.7 Build Fix - #182

Open
shandilya1998 wants to merge 2 commits into
iamaisim:mainfrom
shandilya1998:shreyas/clock_publication_and_timestamping_for_ros_fixes
Open

/clock Topic Not Published and Unreal Engine 5.7 Build Fix#182
shandilya1998 wants to merge 2 commits into
iamaisim:mainfrom
shandilya1998:shreyas/clock_publication_and_timestamping_for_ros_fixes

Conversation

@shandilya1998

Copy link
Copy Markdown

Fixes: # 1. Build failure due to linking issues with libc++abi with Unreal Engine 5.7 clang toolchain
Fixes: # 2. Requests from Project AirSim C++ client not reaching sim server
Fixes: # 3. Timeout for failed requests not implemented on c++ client side causing further requests to be permanently blocked
Fixes: # 4. Timestamps from airsim not passed to published messages by the ROS2 client

About

  1. Need to explicitly add -lc++abi in link options to ensure build compatibility with Unreal Engine 5.7's v26 clang toollchain
  2. Uninitialised fis_canceled_ variable in class TAsyncResultProviderBase leads to garbage values in the variable which essentially cancels all incoming requests. /LoadScene coincidentlally works, however, none of the requests after scene is loaded work. Explicitly initialising fis_canceled_ fixes the issue. File changed is client/cpp/ProjectAirsimClientLib/src/AsyncResultInternal.h
  3. Added request cancellation and timeout instructions to process failed requests to sim server in client/cpp/ProjectAirsimClientLib/src/Client.cpp
  4. Overloaded MakeHeader and updated its usage in ros/projectairsim_ros2_cpp/src/projectairsim_ros2_cpp_node.cpp to ensure timestamps from unreal engine are published with ROS2 messages

How Has This Been Tested?

This was tested by setting up SITL with ardupilot and setting use_sim_time parameter for ardupilot to true. This forces ardupilot to use airsim timestamps. Previously it was observed that /clock topic has no published messages, which leads to a failed integration. However, after the fix the SITL setup works

Screenshots and videos (if appropriate):

ROS2 /clock topic echo output:

root@server1:/ws/sitl_ws/src/ue5/ProjectAirSim# ros2 topic echo /clock
A message was lost!!!
	total count change:1
	total count: 1---
clock:
  sec: 4514
  nanosec: 124000000
---
clock:
  sec: 4514
  nanosec: 124000000
---
clock:
  sec: 4514
  nanosec: 127000000
---
clock:
  sec: 4514
  nanosec: 130000000
---
clock:
  sec: 4514
  nanosec: 130000000
---
clock:
  sec: 4514
  nanosec: 133000000
---
clock:
  sec: 4514
  nanosec: 133000000
---
clock:
  sec: 4514
  nanosec: 136000000

This topic previously published nothing.

Refer to this link for a complete test with ArduPilot SITL. The video shows the published timestamps for IMU topics from Project AirSim ROS2 wrapper and ArduPilot SITL and the /clock topic published by Project AirSim ROS2 client.

Problem
=======
1. Build failure due to linking issues with libc++abi
2. Requests from Project AirSim C++ client not reaching sim server
3. Timeout for failed requests not implemented on c++ client side
   causing further requests to be permanently blocked
4. Timestamps from airsim not passed to published messages by the c++
   client

Solution
========
1. Need to explicitly add `-lc++abi` in link options to ensure build
   compatibility with Unreal Engine 5.7's v26 clang toollchain
2. Uninitialised `fis_canceled_` variable in `class
   TAsyncResultProviderBase` leads to garbage values in the variable
   which essentially cancels all incoming requests. `/LoadScene`
   coincidentlally works, however, none of the requests after scene is
   loaded work. Explicitly initialising `fis_canceled_` fixes the issue.
   File changed is
   `client/cpp/ProjectAirsimClientLib/src/AsyncResultInternal.h`
3. Added request cancellation and timeout instructions to process failed
   requests to sim server in
   `client/cpp/ProjectAirsimClientLib/src/Client.cpp`
4. Overloaded `MakeHeader` and updated its usage in
   `ros/projectairsim_ros2_cpp/src/projectairsim_ros2_cpp_node.cpp` to
   ensure timestamps from unreal engine are published with ROS2 messages

Note
====
1. Some formatting changes may have creeped in. Please ignore the same.
@andrewjong

Copy link
Copy Markdown
Contributor

FYI #177 also fixes this!

@LucasJSch

Copy link
Copy Markdown
Collaborator

Thank you for your contribution @shandilya1998! Nice work and observations 🦾

I'll answer by topic. Please update the code + description of this PR accordingly.

UE5.7 linking issue

I think the linking issues was solved as part of #162. Try rebasing your branch and let me know if you still see the issue.

C++ client requests not reaching sim server

Already solved before this PR, at least for the claimed fis_canceled_ cause. main branch already initializes fis_canceled_(false) in AsyncResultInternal.h.

Failed request timeout blocks later requests

I tested it locally, and this PR definitely solves the issue. Nice!

AirSim timestamps not passed to ROS2 messages

Also fixed by this PR, nice work!

@jonyMarino

Copy link
Copy Markdown
Contributor

Thanks @shandilya1998, the sensor headers should retain the simulator's timestamp. If /clock isn't being published, that's the only solution. Additionally, we should implement a topic on the server to publish the clock instead of using the GetSimTime service.

@jonyMarino jonyMarino added bug Something isn't working ros and removed roadmap Part of the official roadmap labels Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ros

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants