YARP
Yet Another Robot Platform
Loading...
Searching...
No Matches
Ros2Utils.cpp
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: 2023 Istituto Italiano di Tecnologia (IIT)
3
* SPDX-License-Identifier: BSD-3-Clause
4
*/
5
6
#include "
Ros2Utils.h
"
7
8
9
rclcpp::Node::SharedPtr
NodeCreator::createNode
(std::string name)
10
{
11
if
(!rclcpp::ok())
12
{
13
rclcpp::init(
/*argc*/
0,
/*argv*/
nullptr
);
14
}
15
return
std::make_shared<rclcpp::Node>(name);
16
17
}
18
rclcpp::Node::SharedPtr
NodeCreator::createNode
(std::string name, rclcpp::NodeOptions& node_options)
19
{
20
if
(!rclcpp::ok())
21
{
22
rclcpp::init(
/*argc*/
0,
/*argv*/
nullptr
);
23
}
24
return
std::make_shared<rclcpp::Node>(name, node_options);
25
26
}
27
28
builtin_interfaces::msg::Time
ros2TimeFromYarp
(
double
yarpTime)
29
{
30
builtin_interfaces::msg::Time ros2Time;
31
uint64_t sec_part;
32
uint64_t nsec_part;
33
sec_part = int(yarpTime);
// (time / 1000000000UL);
34
nsec_part = (yarpTime - sec_part)*1000000000UL;
35
ros2Time.sec = sec_part;
36
ros2Time.nanosec = (uint32_t)nsec_part;
37
return
ros2Time;
38
}
39
40
double
yarpTimeFromRos2
(builtin_interfaces::msg::Time ros2Time)
41
{
42
return
double(ros2Time.sec) + (double(ros2Time.nanosec) / 1000000000.0);
43
}
ros2TimeFromYarp
builtin_interfaces::msg::Time ros2TimeFromYarp(double yarpTime)
Definition
Ros2Utils.cpp:28
yarpTimeFromRos2
double yarpTimeFromRos2(builtin_interfaces::msg::Time ros2Time)
Definition
Ros2Utils.cpp:40
Ros2Utils.h
NodeCreator::createNode
static rclcpp::Node::SharedPtr createNode(std::string name)
Definition
Ros2Utils.cpp:9
YARP
3.9.0+221-20240917.5+git468e6091f
opt-modules
yarp-devices-ros2
src
devices
ros2Utils
Ros2Utils.cpp
Generated on Tue Oct 8 2024 02:33:11 for YARP by
1.9.8