Skip to content

fix: add float() casts in ROS geometry_msgs coordinate conversion functions#159

Open
thueljules wants to merge 1 commit into
iamaisim:mainfrom
AHive-Org:fix/ros-geometry-msgs-float-cast
Open

fix: add float() casts in ROS geometry_msgs coordinate conversion functions#159
thueljules wants to merge 1 commit into
iamaisim:mainfrom
AHive-Org:fix/ros-geometry-msgs-float-cast

Conversation

@thueljules

@thueljules thueljules commented Jun 18, 2026

Copy link
Copy Markdown

Summary

  • ROS 2 `geometry_msgs` fields (`Point`, `Vector3`, `Quaternion`) assert that assigned values are `float`; ProjectAirSim delivers pose/position data as Python `int`, triggering `AssertionError: The 'x' field must be of type 'float'` at runtime.
  • Added explicit `float()` casts on every numeric component in five functions in `utils.py`: `to_ros_point`, `to_ros_position_vector3`, `to_ros_position_list2list`, `to_ros_quaternion`, and `to_ros_quaternion_list2list`.

Test plan

  • Run the ROS bridge with a live ProjectAirSim instance and confirm no `AssertionError` is raised when pose/transform data is published.
  • Verify that coordinate values (including negated components like `-vector["y"]`) are correctly cast and published to ROS topics.

ROS 2 geometry_msgs fields assert float values; ProjectAirSim delivers
pose/position data as int, causing AssertionError at runtime. Wrap every
numeric component in float() in to_ros_point, to_ros_position_vector3,
to_ros_position_list2list, to_ros_quaternion, and to_ros_quaternion_list2list.
@LucasJSch

Copy link
Copy Markdown
Collaborator

This is awesome! Thanks for your contribution @thueljules 🦾

Is this already for review, or is it a WIP? Because I see the test plan's checkboxes still empty.

@thueljules

Copy link
Copy Markdown
Author

I've run it on my side, but I thought maybe someone should try it before merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants