Project Chrono: chrono::ros::ChROSInterface Class Reference

Public Member Functions | List of all members
chrono::ros::ChROSInterface Class Reference
ROS module » ROS Core

## Description

This class handles the API interface between Chrono and ROS.

It contains a rclcpp::Node which is accessible through GetNode(). Multiple ChROSInterfaces can be created to support multiple nodes.

`#include <ChROSInterface.h>`

## Public Member Functions
| ChROSInterface (const std::string node_name)
| Constructor for the ChROSInterface class.
void | Initialize (rclcpp::NodeOptions options=rclcpp::NodeOptions())
| Initialize the underlying ROS 2 node.
void | SpinSome (std::chrono::nanoseconds max_duration=std::chrono::nanoseconds(0))
| Tick once.
rclcpp::Node::SharedPtr | GetNode ()
| Retrieve the ROS node.

## Constructor & Destructor Documentation

## ◆ ChROSInterface()

chrono::ros::ChROSInterface::ChROSInterface | ( | const std::string | node_name | ) |

Constructor for the ChROSInterface class.

Parameters

  node_name | the name to set to the created node. ROS will throw an error if the node name is identical to previously created nodes.

## Member Function Documentation

## ◆ GetNode()

rclcpp::Node::SharedPtr chrono::ros::ChROSInterface::GetNode | ( |  | ) |
| inline

Retrieve the ROS node.

Use this API to create a publisher or subscriber or any other ROS component.

## ◆ Initialize()

void chrono::ros::ChROSInterface::Initialize | ( | rclcpp::NodeOptions | options = rclcpp::NodeOptions() | ) |

Initialize the underlying ROS 2 node.

A SingleThreadedExecutor will be created and the node will be added to it.

## ◆ SpinSome()

void chrono::ros::ChROSInterface::SpinSome | ( | std::chrono::nanoseconds | max_duration = std::chrono::nanoseconds(0) | ) |

Tick once.

Will basically just call rclcpp::spin_some() NOTE: This is non-blocking. Available work will be executed, but it won't wait until it's completed if max_duration is 0 or the time since the last call to SpinSome is less than max_duration.

The documentation for this class was generated from the following files:

- D:/W/B/src/chrono-9.0.1/src/chrono_ros/ChROSInterface.h
- D:/W/B/src/chrono-9.0.1/src/chrono_ros/ChROSInterface.cpp