From 587dbf8de81883ab8b22c2377af879e3f98f95a7 Mon Sep 17 00:00:00 2001 From: Jan Staschulat Date: Fri, 13 Aug 2021 12:21:33 +0200 Subject: [PATCH] ament_uncrustify Signed-off-by: Jan Staschulat --- rclc_examples/src/example_parameter_server.c | 6 +-- rclc_examples/src/example_sub_context.c | 39 +++++++++++--------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/rclc_examples/src/example_parameter_server.c b/rclc_examples/src/example_parameter_server.c index 90d42221..2156495c 100644 --- a/rclc_examples/src/example_parameter_server.c +++ b/rclc_examples/src/example_parameter_server.c @@ -107,10 +107,10 @@ int main() rclc_parameter_get_int(¶m_server, "param2", ¶m2); rclc_parameter_get_double(¶m_server, "param3", ¶m3); - // Optional prepare for avoiding allocations during spin - rclc_executor_prepare(&executor); + // Optional prepare for avoiding allocations during spin + rclc_executor_prepare(&executor); - rclc_executor_spin(&executor); + rclc_executor_spin(&executor); // clean up rc = rclc_executor_fini(&executor); diff --git a/rclc_examples/src/example_sub_context.c b/rclc_examples/src/example_sub_context.c index 3341fe38..33a3c5ae 100644 --- a/rclc_examples/src/example_sub_context.c +++ b/rclc_examples/src/example_sub_context.c @@ -25,9 +25,10 @@ // Instead of creating some global variables, // we can define some data structures point to the local state info we care about -typedef struct { +typedef struct +{ int some_int; - char* some_text; + char * some_text; } sub_context_t; @@ -36,7 +37,7 @@ typedef struct { // subscriptions with context allow you to pass // additional state information to your subscription callback -void my_subscriber_callback_with_context(const void * msgin, void* context_void_ptr) +void my_subscriber_callback_with_context(const void * msgin, void * context_void_ptr) { const std_msgs__msg__String * msg = (const std_msgs__msg__String *)msgin; if (msg == NULL) { @@ -49,7 +50,7 @@ void my_subscriber_callback_with_context(const void * msgin, void* context_void_ printf("Callback: context is empty\n"); } else { // cast the context pointer into the appropriate type - sub_context_t * context_ptr = (sub_context_t * ) context_void_ptr; + sub_context_t * context_ptr = (sub_context_t *) context_void_ptr; // then you can access the context data printf("Callback: context contains: %s\n", context_ptr->some_text); printf("Callback: context also contains: %d\n", context_ptr->some_int); @@ -66,12 +67,12 @@ int main(int argc, const char * argv[]) rcl_ret_t rc; // within main, we can create the state information our subscriptions work with - const unsigned int n_topics=3; + const unsigned int n_topics = 3; const char * topic_names[] = {"topic_foo", "topic_bar", "topic_baz"}; - sub_context_t my_contexts[]= { - {0,"foo counting from zero"}, - {100,"bar counting from 100"}, - {300,"baz counting from 300"}, + sub_context_t my_contexts[] = { + {0, "foo counting from zero"}, + {100, "bar counting from 100"}, + {300, "baz counting from 300"}, }; rcl_publisher_t my_pubs[n_topics]; std_msgs__msg__String pub_msgs[n_topics]; @@ -97,7 +98,7 @@ int main(int argc, const char * argv[]) ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, String); //initialise each publisher and subscriber - for(unsigned int i=0; i