Skip to content

Commit 4bef3c3

Browse files
author
Javier Moreno
committed
fixed ament warning
1 parent 581d0bd commit 4bef3c3

19 files changed

Lines changed: 53 additions & 5 deletions

File tree

‎RAD0_actuator/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ find_package(std_msgs REQUIRED)
99
# Do not compile package if rclcpp is not found
1010
if (NOT rclc_FOUND)
1111
message(WARNING "${PROJECT_NAME} will be ignored due to rclc is not installed")
12+
ament_package()
1213
return()
1314
endif()
1415

‎RAD0_actuator/main.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
#include <stdio.h>
77

8+
#define ASSERT(ptr) if (ptr == NULL) return -1;
9+
810
static rclc_publisher_t* engine_pub;
911
static uint32_t engine_power = 100;
1012

@@ -40,8 +42,11 @@ int main(int argc, char* argv[])
4042

4143
rclc_init(0, NULL);
4244
node = rclc_create_node("actuator", "");
45+
ASSERT(node);
4346
engine_sub = rclc_create_subscription(node, RCLC_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32), "std_msgs_msg_Int32", engine_on_message, 1, false);
47+
ASSERT(engine_sub);
4448
engine_pub = rclc_create_publisher(node, RCLC_GET_MSG_TYPE_SUPPORT(std_msgs, msg, UInt32), "std_msgs_msg_UInt32", 1);
49+
ASSERT(engine_pub);
4550

4651
// Publish new altitude
4752
std_msgs__msg__UInt32 msg_out;

‎RAD0_altitude_sensor/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ find_package(std_msgs REQUIRED)
99
# Do not compile package if rclcpp is not found
1010
if (NOT rclc_FOUND)
1111
message(WARNING "${PROJECT_NAME} will be ignored due to rclc is not installed")
12+
ament_package()
1213
return()
1314
endif()
1415

‎RAD0_altitude_sensor/main.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <math.h>
77
#include <time.h>
88

9-
9+
#define ASSERT(ptr) if (ptr == NULL) return -1;
1010

1111
/**
1212
* @brief
@@ -25,7 +25,9 @@ int main(int argc, char *argv[])
2525
rclc_publisher_t* publisher = NULL;
2626

2727
node = rclc_create_node("altitude_sensor", "");
28+
ASSERT(node);
2829
publisher = rclc_create_publisher(node, RCLC_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Float64), "std_msgs_msg_Float64", 1);
30+
ASSERT(publisher);
2931

3032

3133
double A = 0;

‎RAD0_control/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ find_package(std_msgs REQUIRED)
1818
# Do not compile package if rclcpp is not found
1919
if (NOT rclcpp_FOUND)
2020
message(WARNING "${PROJECT_NAME} will be ignored due to rclcpp is not installed")
21+
ament_package()
2122
return()
2223
endif()
2324

‎RAD0_display/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ find_package(std_msgs REQUIRED)
99
# Do not compile package if rclcpp is not found
1010
if (NOT rclc_FOUND)
1111
message(WARNING "${PROJECT_NAME} will be ignored due to rclc is not installed")
12+
ament_package()
1213
return()
1314
endif()
1415

‎RAD0_display/main.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <stdio.h>
88

9+
#define ASSERT(ptr) if (ptr == NULL) return -1;
910

1011
static float altitude;
1112
static uint32_t engine_power;
@@ -84,10 +85,13 @@ int main(int argc, char *argv[])
8485
rclc_init(0, NULL);
8586

8687
node = rclc_create_node("display", "");
87-
88+
ASSERT(node);
8889
alert_subscription = rclc_create_subscription(node, RCLC_GET_MSG_TYPE_SUPPORT(std_msgs, msg, String), "std_msgs_msg_String", on_alert_message, 1, false);
90+
ASSERT(alert_subscription);
8991
altitude_subscription = rclc_create_subscription(node, RCLC_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Float64), "std_msgs_msg_Float64", on_altitude_message, 1, false);
92+
ASSERT(altitude_subscription);
9093
power_subscription = rclc_create_subscription(node, RCLC_GET_MSG_TYPE_SUPPORT(std_msgs, msg, UInt32), "std_msgs_msg_UInt32", on_power_message, 1, false);
94+
ASSERT(power_subscription);
9195

9296
rclc_spin_node(node);
9397

‎complex_msg_publisher/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ find_package(complex_msgs REQUIRED)
1010
# Do not compile package if rclcpp is not found
1111
if (NOT rclc_FOUND)
1212
message(WARNING "${PROJECT_NAME} will be ignored due to rclc is not installed")
13+
ament_package()
1314
return()
1415
endif()
1516

‎complex_msg_publisher/main.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,16 @@ int main(int argc, char* argv[])
99
(void)argv;
1010
rclc_init(0, NULL);
1111
rclc_node_t* node = rclc_create_node("publisher_node", "");
12+
if (node == NULL)
13+
{
14+
return -1;
15+
}
1216
rclc_publisher_t* publisher =
1317
rclc_create_publisher(node, RCLC_GET_MSG_TYPE_SUPPORT(complex_msgs, msg, NestedMsgTest), "complex_msgs_msg_NestedMsgTest", 1);
18+
if (publisher == NULL)
19+
{
20+
return -1;
21+
}
1422

1523
complex_msgs__msg__NestedMsgTest msg;
1624
char Buff1[30];

‎complex_msg_subscriber/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ find_package(complex_msgs REQUIRED)
99
# Do not compile package if rclcpp is not found
1010
if (NOT rclc_FOUND)
1111
message(WARNING "${PROJECT_NAME} will be ignored due to rclc is not installed")
12+
ament_package()
1213
return()
1314
endif()
1415

0 commit comments

Comments
 (0)