@@ -20,9 +20,10 @@ rcl_subscription_t subscriber_2;
2020std_msgs__msg__Int32 send_msg_2 ;
2121std_msgs__msg__Int32 recv_msg_2 ;
2222
23- void timer_callback_1 (rcl_timer_t * timer , int64_t last_call_time )
23+ void timer_callback_1 (rcl_timer_t * timer , int64_t last_call_time , uintptr_t user_data )
2424{
2525 (void ) last_call_time ;
26+ (void ) user_data ;
2627 if (timer != NULL ) {
2728 RCSOFTCHECK (rcl_publish (& publisher_1 , & send_msg_1 , NULL ));
2829 printf ("Node 1 -- Sent: %d\n" , send_msg_1 .data );
@@ -36,9 +37,10 @@ void subscription_callback_1(const void * msgin)
3637 printf ("Node 1 --Received: %d\n" , msg -> data );
3738}
3839
39- void timer_callback_2 (rcl_timer_t * timer , int64_t last_call_time )
40+ void timer_callback_2 (rcl_timer_t * timer , int64_t last_call_time , uintptr_t user_data )
4041{
4142 (void ) last_call_time ;
43+ (void ) user_data ;
4244 if (timer != NULL ) {
4345 RCSOFTCHECK (rcl_publish (& publisher_2 , & send_msg_2 , NULL ));
4446 printf ("Node 2 -- Sent: %d\n" , send_msg_2 .data );
@@ -82,11 +84,12 @@ int main(int argc, const char * const * argv)
8284
8385 // create timer,
8486 rcl_timer_t timer_1 ;
85- RCCHECK (rclc_timer_init_default (
87+ RCCHECK (rclc_timer_init_default2 (
8688 & timer_1 ,
8789 & support ,
8890 RCL_MS_TO_NS (1000 ),
89- timer_callback_1 ));
91+ timer_callback_1 ,
92+ true));
9093
9194 // create executor
9295 rclc_executor_t executor_1 = rclc_executor_get_zero_initialized_executor ();
@@ -115,11 +118,12 @@ int main(int argc, const char * const * argv)
115118
116119 // create timer,
117120 rcl_timer_t timer_2 ;
118- RCCHECK (rclc_timer_init_default (
121+ RCCHECK (rclc_timer_init_default2 (
119122 & timer_2 ,
120123 & support ,
121124 RCL_MS_TO_NS (1000 ),
122- timer_callback_2 ));
125+ timer_callback_2 ,
126+ true));
123127
124128 // create executor
125129 rclc_executor_t executor_2 = rclc_executor_get_zero_initialized_executor ();
0 commit comments