Skip to content

Commit 50568a9

Browse files
committed
fix: added generated bindings for ROS Humble and Jazzy
Signed-off-by: Esteve Fernandez <[email protected]>
1 parent da8268c commit 50568a9

File tree

4 files changed

+12287
-135
lines changed

4 files changed

+12287
-135
lines changed

rclrs/build.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ fn main() {
123123

124124
let bindings = builder.generate().expect("Unable to generate bindings");
125125

126-
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
126+
let ros_distro = get_env_var_or_abort(ROS_DISTRO);
127+
let out_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()).join("src");
127128
bindings
128-
.write_to_file(out_path.join("rcl_bindings_generated.rs"))
129+
.write_to_file(out_path.join(format!("rcl_bindings_generated_{}.rs", ros_distro)))
129130
.expect("Couldn't write bindings!");
130131
}

rclrs/src/rcl_bindings.rs

Lines changed: 16 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -13,141 +13,24 @@
1313

1414
cfg_if::cfg_if! {
1515
if #[cfg(feature="use_ros_shim")] {
16-
#[repr(C)]
17-
#[derive(Debug)]
18-
pub struct rcl_allocator_t;
16+
include!(
17+
concat!(
18+
env!("CARGO_MANIFEST_DIR"),
19+
"/src/rcl_bindings_generated_",
20+
"rolling", // rolling will always be a valid ROS distro
21+
".rs",
22+
)
23+
);
1924

20-
#[repr(C)]
21-
#[derive(Debug)]
22-
pub struct rcl_arguments_t;
23-
24-
#[repr(C)]
25-
#[derive(Debug)]
26-
pub struct rcl_client_t;
27-
28-
#[repr(C)]
29-
#[derive(Debug)]
30-
pub struct rcl_clock_t;
31-
32-
#[repr(C)]
33-
#[derive(Debug)]
34-
pub struct rcl_clock_type_t;
35-
36-
#[repr(C)]
37-
#[derive(Debug)]
38-
pub struct rcl_context_t;
39-
40-
#[repr(C)]
41-
#[derive(Debug)]
42-
pub struct rcl_guard_condition_t;
43-
44-
#[repr(C)]
45-
#[derive(Debug)]
46-
pub struct rcl_names_and_types_t;
47-
48-
#[repr(C)]
49-
#[derive(Debug)]
50-
pub struct rcl_node_options_t;
51-
52-
#[repr(C)]
53-
#[derive(Debug)]
54-
pub struct rcl_node_params_t;
55-
56-
#[repr(C)]
57-
#[derive(Debug)]
58-
pub struct rcl_node_t;
59-
60-
#[repr(C)]
61-
#[derive(Debug)]
62-
pub struct rcl_params_t;
63-
64-
#[repr(C)]
65-
#[derive(Debug)]
66-
pub struct rcl_publisher_t;
67-
68-
#[repr(C)]
69-
#[derive(Debug)]
70-
pub struct rcl_ret_t;
71-
72-
#[repr(C)]
73-
#[derive(Debug)]
74-
pub struct rcl_service_t;
75-
76-
#[repr(C)]
77-
#[derive(Debug)]
78-
pub struct rcl_subscription_t;
79-
80-
#[repr(C)]
81-
#[derive(Debug)]
82-
pub struct rcl_topic_endpoint_info_array_t;
83-
84-
#[repr(C)]
85-
#[derive(Debug)]
86-
pub struct rcl_variant_t;
87-
88-
#[repr(C)]
89-
#[derive(Debug)]
90-
pub struct rcl_wait_set_t;
91-
92-
#[repr(C)]
93-
#[derive(Debug)]
94-
pub struct rcl_timer_t;
95-
96-
#[repr(C)]
97-
#[derive(Debug)]
98-
pub struct rcutils_string_array_t;
99-
100-
#[repr(C)]
101-
#[derive(Debug)]
102-
pub struct rmw_message_info_t;
103-
104-
#[repr(C)]
105-
#[derive(Debug)]
106-
pub struct rmw_names_and_types_t;
107-
108-
#[repr(C)]
109-
#[derive(Debug)]
110-
pub struct rmw_qos_durability_policy_t;
111-
112-
#[repr(C)]
113-
#[derive(Debug)]
114-
pub struct rmw_qos_history_policy_t;
115-
116-
#[repr(C)]
117-
#[derive(Debug)]
118-
pub struct rmw_qos_liveliness_policy_t;
119-
120-
#[repr(C)]
121-
#[derive(Debug)]
122-
pub struct rmw_qos_profile_t;
123-
124-
#[repr(C)]
125-
#[derive(Debug)]
126-
pub struct rmw_qos_reliability_policy_t;
127-
128-
#[repr(C)]
129-
#[derive(Debug)]
130-
pub struct rmw_request_id_t;
131-
132-
#[repr(C)]
133-
#[derive(Debug)]
134-
pub struct rmw_time_t;
135-
136-
#[repr(C)]
137-
#[derive(Debug)]
138-
pub struct rmw_topic_endpoint_info_array_t;
139-
140-
#[repr(C)]
141-
#[derive(Debug)]
142-
pub struct rosidl_message_type_support_t;
143-
144-
pub const RMW_GID_STORAGE_SIZE: usize = 24;
145-
146-
extern "C" {
147-
pub fn rcl_context_is_valid(context: *const rcl_context_t) -> bool;
148-
}
14925
} else {
150-
include!(concat!(env!("OUT_DIR"), "/rcl_bindings_generated.rs"));
26+
include!(
27+
concat!(
28+
env!("CARGO_MANIFEST_DIR"),
29+
"/src/rcl_bindings_generated_",
30+
env!("ROS_DISTRO"),
31+
".rs",
32+
)
33+
);
15134

15235
pub const RMW_GID_STORAGE_SIZE: usize = rmw_gid_storage_size_constant;
15336
}

0 commit comments

Comments
 (0)