ros2_canopen  master
C++ ROS CANopen Library
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ros2_canopen::node_interfaces::NodeCanopenProxyDriver< NODETYPE > Class Template Reference

#include <node_canopen_proxy_driver.hpp>

Inheritance diagram for ros2_canopen::node_interfaces::NodeCanopenProxyDriver< NODETYPE >:
Inheritance graph
[legend]
Collaboration diagram for ros2_canopen::node_interfaces::NodeCanopenProxyDriver< NODETYPE >:
Collaboration graph
[legend]

Public Member Functions

 NodeCanopenProxyDriver (NODETYPE *node)
 
virtual void init (bool called_from_base) override
 Initialises the driver. More...
 
virtual bool reset_node_nmt_command ()
 
virtual bool start_node_nmt_command ()
 
virtual bool tpdo_transmit (COData &data)
 
virtual bool sdo_write (COData &data)
 
virtual bool sdo_read (COData &data)
 
- Public Member Functions inherited from ros2_canopen::node_interfaces::NodeCanopenBaseDriver< NODETYPE >
 NodeCanopenBaseDriver (NODETYPE *node)
 
virtual ~NodeCanopenBaseDriver ()
 
virtual void configure (bool called_from_base)
 Configure the driver. More...
 
virtual void activate (bool called_from_base)
 Activates the driver. More...
 
virtual void deactivate (bool called_from_base)
 Deactivates the driver. More...
 
virtual void cleanup (bool called_from_base)
 Cleanup the driver. More...
 
virtual void shutdown (bool called_from_base)
 Shuts down the driver. More...
 
virtual void add_to_master ()
 Add the driver to master. More...
 
virtual void remove_from_master ()
 Remove the driver from master. More...
 
void register_nmt_state_cb (std::function< void(canopen::NmtState, uint8_t)> nmt_state_cb)
 Register a callback for NMT state change. More...
 
void register_rpdo_cb (std::function< void(COData, uint8_t)> rpdo_cb)
 Register a callback for RPDO. More...
 
void register_emcy_cb (std::function< void(COEmcy, uint8_t)> emcy_cb)
 Register a callback for EMCY. More...
 
- Public Member Functions inherited from ros2_canopen::node_interfaces::NodeCanopenDriver< NODETYPE >
 NodeCanopenDriver (NODETYPE *node)
 
virtual void set_master (std::shared_ptr< lely::ev::Executor > exec, std::shared_ptr< lely::canopen::AsyncMaster > master)
 Set Master. More...
 
void init ()
 Initialise the driver. More...
 
void configure ()
 Configure the driver. More...
 
void activate ()
 Activate the driver. More...
 
void deactivate ()
 Deactivate the driver. More...
 
void cleanup ()
 Cleanup the driver. More...
 
void shutdown ()
 Shutdown the driver. More...
 
virtual void demand_set_master ()
 Demand set Master. More...
 
- Public Member Functions inherited from ros2_canopen::node_interfaces::NodeCanopenDriverInterface
 NodeCanopenDriverInterface ()
 

Protected Member Functions

virtual void on_nmt (canopen::NmtState nmt_state) override
 
virtual void on_rpdo (COData data) override
 
virtual void on_tpdo (const canopen_interfaces::msg::COData::SharedPtr msg)
 
virtual void diagnostic_callback (diagnostic_updater::DiagnosticStatusWrapper &stat) override
 
void on_nmt_state_reset (const std_srvs::srv::Trigger::Request::SharedPtr request, std_srvs::srv::Trigger::Response::SharedPtr response)
 
void on_nmt_state_start (const std_srvs::srv::Trigger::Request::SharedPtr request, std_srvs::srv::Trigger::Response::SharedPtr response)
 
void on_sdo_read (const canopen_interfaces::srv::CORead::Request::SharedPtr request, canopen_interfaces::srv::CORead::Response::SharedPtr response)
 
void on_sdo_write (const canopen_interfaces::srv::COWrite::Request::SharedPtr request, canopen_interfaces::srv::COWrite::Response::SharedPtr response)
 
- Protected Member Functions inherited from ros2_canopen::node_interfaces::NodeCanopenBaseDriver< NODETYPE >
virtual void poll_timer_callback ()
 
void nmt_listener ()
 
void rdpo_listener ()
 
void emcy_listener ()
 
virtual void on_emcy (COEmcy emcy)
 

Protected Attributes

rclcpp::Publisher< std_msgs::msg::String >::SharedPtr nmt_state_publisher
 
rclcpp::Publisher< canopen_interfaces::msg::COData >::SharedPtr rpdo_publisher
 
rclcpp::Subscription< canopen_interfaces::msg::COData >::SharedPtr tpdo_subscriber
 
rclcpp::Service< std_srvs::srv::Trigger >::SharedPtr nmt_state_reset_service
 
rclcpp::Service< std_srvs::srv::Trigger >::SharedPtr nmt_state_start_service
 
rclcpp::Service< canopen_interfaces::srv::CORead >::SharedPtr sdo_read_service
 
rclcpp::Service< canopen_interfaces::srv::COWrite >::SharedPtr sdo_write_service
 
std::mutex sdo_mtex
 
- Protected Attributes inherited from ros2_canopen::node_interfaces::NodeCanopenBaseDriver< NODETYPE >
std::thread nmt_state_publisher_thread_
 
std::thread rpdo_publisher_thread_
 
std::thread emcy_publisher_thread_
 
std::mutex driver_mutex_
 
std::shared_ptr< ros2_canopen::LelyDriverBridgelely_driver_
 
uint32_t period_ms_
 
int sdo_timeout_ms_
 
bool polling_
 
std::function< void(canopen::NmtState, uint8_t)> nmt_state_cb_
 
std::function< void(COData, uint8_t)> rpdo_cb_
 
std::function< void(COEmcy, uint8_t)> emcy_cb_
 
std::shared_ptr< ros2_canopen::SafeQueue< ros2_canopen::COEmcy > > emcy_queue_
 
std::shared_ptr< ros2_canopen::SafeQueue< ros2_canopen::COData > > rpdo_queue_
 
rclcpp::TimerBase::SharedPtr poll_timer_
 
std::atomic< bool > diagnostic_enabled_
 
uint32_t diagnostic_period_ms_
 
std::shared_ptr< diagnostic_updater::Updater > diagnostic_updater_
 
std::shared_ptr< DiagnosticsCollectordiagnostic_collector_
 
- Protected Attributes inherited from ros2_canopen::node_interfaces::NodeCanopenDriver< NODETYPE >
NODETYPE * node_
 
std::shared_ptr< lely::ev::Executor > exec_
 
std::shared_ptr< lely::canopen::AsyncMaster > master_
 
std::shared_ptr< lely::canopen::BasicDriver > driver_
 
std::chrono::milliseconds non_transmit_timeout_
 
YAML::Node config_
 
uint8_t node_id_
 
std::string container_name_
 
std::string eds_
 
std::string bin_
 
rclcpp::CallbackGroup::SharedPtr client_cbg_
 
rclcpp::CallbackGroup::SharedPtr timer_cbg_
 
std::atomic< bool > master_set_
 
std::atomic< bool > initialised_
 
std::atomic< bool > configured_
 
std::atomic< bool > activated_
 

Constructor & Destructor Documentation

◆ NodeCanopenProxyDriver()

template<class NODETYPE >
NodeCanopenProxyDriver::NodeCanopenProxyDriver ( NODETYPE *  node)

Member Function Documentation

◆ on_nmt()

template<class NODETYPE >
void NodeCanopenProxyDriver::on_nmt ( canopen::NmtState  nmt_state)
overrideprotectedvirtual

◆ on_rpdo()

template<class NODETYPE >
void NodeCanopenProxyDriver::on_rpdo ( ros2_canopen::COData  d)
overrideprotectedvirtual

◆ on_tpdo()

template<class NODETYPE >
void NodeCanopenProxyDriver::on_tpdo ( const canopen_interfaces::msg::COData::SharedPtr  msg)
protectedvirtual

◆ diagnostic_callback()

template<class NODETYPE >
void NodeCanopenProxyDriver::diagnostic_callback ( diagnostic_updater::DiagnosticStatusWrapper &  stat)
overrideprotectedvirtual

◆ on_nmt_state_reset()

template<class NODETYPE >
void NodeCanopenProxyDriver::on_nmt_state_reset ( const std_srvs::srv::Trigger::Request::SharedPtr  request,
std_srvs::srv::Trigger::Response::SharedPtr  response 
)
protected

◆ on_nmt_state_start()

template<class NODETYPE >
void NodeCanopenProxyDriver::on_nmt_state_start ( const std_srvs::srv::Trigger::Request::SharedPtr  request,
std_srvs::srv::Trigger::Response::SharedPtr  response 
)
protected

◆ on_sdo_read()

template<class NODETYPE >
void NodeCanopenProxyDriver::on_sdo_read ( const canopen_interfaces::srv::CORead::Request::SharedPtr  request,
canopen_interfaces::srv::CORead::Response::SharedPtr  response 
)
protected

◆ on_sdo_write()

template<class NODETYPE >
void NodeCanopenProxyDriver::on_sdo_write ( const canopen_interfaces::srv::COWrite::Request::SharedPtr  request,
canopen_interfaces::srv::COWrite::Response::SharedPtr  response 
)
protected

◆ init()

template<class NODETYPE >
void NodeCanopenProxyDriver::init ( bool  called_from_base)
overridevirtual

Initialises the driver.

This does not do anything, it is an empty function. it should be overridden by derived classes.

Todo:
Potentially make this an abstract function. This is mainly for debugging purposes.
Parameters
called_from_base

Reimplemented from ros2_canopen::node_interfaces::NodeCanopenBaseDriver< NODETYPE >.

Reimplemented in ros2_canopen::node_interfaces::NodeCanopen402Driver< NODETYPE >.

◆ reset_node_nmt_command()

template<class NODETYPE >
bool NodeCanopenProxyDriver::reset_node_nmt_command
virtual

◆ start_node_nmt_command()

template<class NODETYPE >
bool NodeCanopenProxyDriver::start_node_nmt_command
virtual

◆ tpdo_transmit()

template<class NODETYPE >
bool NodeCanopenProxyDriver::tpdo_transmit ( ros2_canopen::COData data)
virtual

◆ sdo_write()

template<class NODETYPE >
bool NodeCanopenProxyDriver::sdo_write ( ros2_canopen::COData data)
virtual

◆ sdo_read()

template<class NODETYPE >
bool NodeCanopenProxyDriver::sdo_read ( ros2_canopen::COData data)
virtual

Member Data Documentation

◆ nmt_state_publisher

template<class NODETYPE >
rclcpp::Publisher<std_msgs::msg::String>::SharedPtr ros2_canopen::node_interfaces::NodeCanopenProxyDriver< NODETYPE >::nmt_state_publisher
protected

◆ rpdo_publisher

template<class NODETYPE >
rclcpp::Publisher<canopen_interfaces::msg::COData>::SharedPtr ros2_canopen::node_interfaces::NodeCanopenProxyDriver< NODETYPE >::rpdo_publisher
protected

◆ tpdo_subscriber

template<class NODETYPE >
rclcpp::Subscription<canopen_interfaces::msg::COData>::SharedPtr ros2_canopen::node_interfaces::NodeCanopenProxyDriver< NODETYPE >::tpdo_subscriber
protected

◆ nmt_state_reset_service

template<class NODETYPE >
rclcpp::Service<std_srvs::srv::Trigger>::SharedPtr ros2_canopen::node_interfaces::NodeCanopenProxyDriver< NODETYPE >::nmt_state_reset_service
protected

◆ nmt_state_start_service

template<class NODETYPE >
rclcpp::Service<std_srvs::srv::Trigger>::SharedPtr ros2_canopen::node_interfaces::NodeCanopenProxyDriver< NODETYPE >::nmt_state_start_service
protected

◆ sdo_read_service

template<class NODETYPE >
rclcpp::Service<canopen_interfaces::srv::CORead>::SharedPtr ros2_canopen::node_interfaces::NodeCanopenProxyDriver< NODETYPE >::sdo_read_service
protected

◆ sdo_write_service

template<class NODETYPE >
rclcpp::Service<canopen_interfaces::srv::COWrite>::SharedPtr ros2_canopen::node_interfaces::NodeCanopenProxyDriver< NODETYPE >::sdo_write_service
protected

◆ sdo_mtex

template<class NODETYPE >
std::mutex ros2_canopen::node_interfaces::NodeCanopenProxyDriver< NODETYPE >::sdo_mtex
protected

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