|
| 1 | +/* |
| 2 | +# Copyright (c) 2026 Murilo Marques Marinodeo |
| 3 | +# |
| 4 | +# This file is part of sas_common. |
| 5 | +# |
| 6 | +# sas_common is free software: you can redistribute it and/or modify |
| 7 | +# it under the terms of the GNU Lesser General Public License as published by |
| 8 | +# the Free Software Foundation, either version 3 of the License, or |
| 9 | +# (at your option) any later version. |
| 10 | +# |
| 11 | +# sas_common is distributed in the hope that it will be useful, |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | +# GNU Lesser General Public License for more details. |
| 15 | +# |
| 16 | +# You should have received a copy of the GNU Lesser General Public License |
| 17 | +# along with sas_common. If not, see <https://www.gnu.org/licenses/>. |
| 18 | +# |
| 19 | +# ################################################################ |
| 20 | +# |
| 21 | +# Author: Murilo M. Marinho, email: murilomarinodeo@ieee.org |
| 22 | +# |
| 23 | +# ################################################################*/ |
| 24 | +#include <exception> |
| 25 | +#include <rclcpp/rclcpp.hpp> |
| 26 | +#include <sas_common/sas_object_client.hpp> |
| 27 | + |
| 28 | +#include<signal.h> |
| 29 | +static std::atomic_bool kill_this_process(false); |
| 30 | +void sig_int_handler(int) |
| 31 | +{ |
| 32 | + kill_this_process = true; |
| 33 | +} |
| 34 | + |
| 35 | + |
| 36 | +int main(int argc, char** argv) |
| 37 | +{ |
| 38 | + if(signal(SIGINT, sig_int_handler) == SIG_ERR) |
| 39 | + { |
| 40 | + throw std::runtime_error("::Error setting the signal int handler."); |
| 41 | + } |
| 42 | + |
| 43 | + rclcpp::init(argc,argv,rclcpp::InitOptions(),rclcpp::SignalHandlerOptions::None); |
| 44 | + auto node = std::make_shared<rclcpp::Node>("sas_object_test_node"); |
| 45 | + |
| 46 | + try |
| 47 | + { |
| 48 | + auto object_client = sas::ObjectClient(node); |
| 49 | + } |
| 50 | + catch (const std::exception& e) |
| 51 | + { |
| 52 | + RCLCPP_ERROR_STREAM_ONCE(node->get_logger(),"::Exception::" << e.what()); |
| 53 | + } |
| 54 | + |
| 55 | + |
| 56 | + return 0; |
| 57 | +} |
0 commit comments