chrono::ros::ChROSInterface Class Reference

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>

Inheritance diagram for chrono::ros::ChROSInterface:

Public Member Functions

 ChROSInterface (const std::string node_name)
 Constructor for the ChROSInterface class. More...
 
virtual ~ChROSInterface ()=default
 Virtual destructor for polymorphism.
 
virtual void Initialize (rclcpp::NodeOptions options=rclcpp::NodeOptions())
 Initialize the underlying ROS 2 node. More...
 
virtual void SpinSome (std::chrono::nanoseconds max_duration=std::chrono::nanoseconds(0))
 Tick once. More...
 
virtual rclcpp::Node::SharedPtr GetNode ()
 Retrieve the ROS node. More...
 
const std::string & GetNodeName () const
 Get the node name (for IPC interface access)
 

Constructor & Destructor Documentation

◆ ChROSInterface()

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

Constructor for the ChROSInterface class.

Parameters
node_namethe 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()

virtual rclcpp::Node::SharedPtr chrono::ros::ChROSInterface::GetNode ( )
inlinevirtual

Retrieve the ROS node.

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

Reimplemented in chrono::ros::ChROSIPCInterface.

◆ Initialize()

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

Initialize the underlying ROS 2 node.

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

Reimplemented in chrono::ros::ChROSIPCInterface.

◆ SpinSome()

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

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.

Reimplemented in chrono::ros::ChROSIPCInterface.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_ros/ChROSInterface.h
  • /builds/uwsbel/chrono/src/chrono_ros/ChROSInterface.cpp