Fixposition SDK 0.0.0-heads/main-0-gd0a6ce2
Collection of c++ libraries and apps for use with Fixposition products
Loading...
Searching...
No Matches
utils.hpp
Go to the documentation of this file.
1/**
2 * \verbatim
3 * ___ ___
4 * \ \ / /
5 * \ \/ / Copyright (c) Fixposition AG
6 * / /\ \ License: see the LICENSE file
7 * /__/ \__\
8 * \endverbatim
9 *
10 * @file
11 * @brief Fixposition SDK: ROS2 utilities
12 *
13 * @page FPSDK_ROS2_UTILS ROS2 utilities
14 *
15 * **API**: fpsdk_ros2/utils.hpp and fpsdk::ros2::utils
16 *
17 */
18#ifndef __FPSDK_ROS2_UTILS_HPP__
19#define __FPSDK_ROS2_UTILS_HPP__
20
21/* LIBC/STL */
22
23/* EXTERNAL */
24#include <fpsdk_ros2/ext/rclcpp.hpp>
25
26/* Fixposition SDK */
27#include <fpsdk_common/time.hpp>
28
29/* PACKAGE */
30
31namespace fpsdk {
32namespace ros2 {
33/**
34 * @brief ROS2 utilities
35 */
36namespace utils {
37/* ****************************************************************************************************************** */
38
39/**
40 * @brief Redirect fp:common::logging to ROS console
41 *
42 * This configures the fpsdk::common::logging facility to output via the ROS console. This does *not* configure the ROS
43 * console (logger level, logger name, etc.).
44 *
45 * The mapping of fpsdk::common::logging::LoggingLevel to rclcpp levels is as follows:
46 *
47 * - TRACE and DEBUG --> DEBUG
48 * - INFO and NOTICE --> INFO
49 * - WARNING --> WARN
50 * - ERROR --> ERROR
51 * - FATAL --> FATAL
52 *
53 * @param[in] logger_name The name of the logger. The recommended value is node->get_logger().get_name()
54 */
55void RedirectLoggingToRosConsole(const char* logger_name = "fpsdk_ros2");
56
57/**
58 * @brief Convert to ROS time (atomic -> POSIX)
59 *
60 * @param[in] time The Time object (atomic)
61 * @param[in] clock_type The clock to use (to assume)
62 *
63 * @returns the ROS time object (POSIX)
64 */
65rclcpp::Time ConvTime(const fpsdk::common::time::Time& time, rcl_clock_type_t clock_type = RCL_ROS_TIME);
66
67/**
68 * @brief Convert from ROS time (POSIX -> atomic)
69 *
70 * @param[in] time The ROS time object (POSIX)
71 *
72 * @returns the Time object (atomic)
73 */
74fpsdk::common::time::Time ConvTime(const rclcpp::Time& time);
75
76/* ****************************************************************************************************************** */
77} // namespace utils
78} // namespace ros2
79} // namespace fpsdk
80#endif // __FPSDK_ROS2_UTILS_HPP__
void RedirectLoggingToRosConsole(const char *logger_name="fpsdk_ros2")
Redirect fp:common::logging to ROS console.
rclcpp::Time ConvTime(const fpsdk::common::time::Time &time, rcl_clock_type_t clock_type=RCL_ROS_TIME)
Convert to ROS time (atomic -> POSIX)
Fixposition SDK.
Fixposition SDK: Time utilities.