Skip to content

Commit

Permalink
qos: fix enum casts for humble (and maybe galactic)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffmann-stefan committed May 15, 2023
1 parent ba38428 commit 712a7e0
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions rcldotnet/rcldotnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,15 +708,23 @@ int32_t native_rcl_write_to_qos_profile_handle(
{
rmw_qos_profile_t *qos_profile = (rmw_qos_profile_t *)qos_profile_handle;

qos_profile->history = (enum rmw_qos_history_policy_t)history;
// Can't name the enums for both Foxy and Humble the in code.
// So use implicit conversions for now...
// This breaking change was introduced in https://github.com/ros2/rmw/commit/05f973575e8e93454e39f51da6227509061ff189
// In Foxy they are defined as `enum rmw_qos_history_policy_t { ... };
// -> so the type is called `enum rmw_qos_history_policy_t`
// In Humble tey are defined as `typedef enum rmw_qos_history_policy_e { ... } rmw_qos_history_policy_t;
// -> so the type is called `rmw_qos_history_policy_t`

qos_profile->history = /* (rmw_qos_history_policy_t) */ history;
qos_profile->depth = (size_t)depth;
qos_profile->reliability = (enum rmw_qos_reliability_policy_t)reliability;
qos_profile->durability = (enum rmw_qos_durability_policy_t)durability;
qos_profile->reliability = /* (rmw_qos_reliability_policy_t) */ reliability;
qos_profile->durability = /* (rmw_qos_durability_policy_t) */ durability;
qos_profile->deadline.sec = deadline_sec;
qos_profile->deadline.nsec = deadline_nsec;
qos_profile->lifespan.sec = lifespan_sec;
qos_profile->lifespan.nsec = lifespan_nsec;
qos_profile->liveliness = (enum rmw_qos_liveliness_policy_t)liveliness;
qos_profile->liveliness = /* (rmw_qos_liveliness_policy_t) */ liveliness;
qos_profile->liveliness_lease_duration.sec = liveliness_lease_duration_sec;
qos_profile->liveliness_lease_duration.nsec = liveliness_lease_duration_nsec;
qos_profile->avoid_ros_namespace_conventions = avoid_ros_namespace_conventions != 0;
Expand Down

0 comments on commit 712a7e0

Please sign in to comment.