Class Ros2SensorPlugin

Inheritance Relationships

Base Type

Derived Types

Class Documentation

class Ros2SensorPlugin : public webots_ros2_driver::PluginInterface

Utility class for common Webots sensors.

Subclassed by webots_ros2_driver::Ros2Camera, webots_ros2_driver::Ros2Compass, webots_ros2_driver::Ros2DistanceSensor, webots_ros2_driver::Ros2Emitter, webots_ros2_driver::Ros2GPS, webots_ros2_driver::Ros2IMU, webots_ros2_driver::Ros2Lidar, webots_ros2_driver::Ros2LightSensor, webots_ros2_driver::Ros2RGBD, webots_ros2_driver::Ros2RangeFinder, webots_ros2_driver::Ros2Receiver, webots_ros2_driver::Ros2VacuumGripper

Public Functions

virtual void init(webots_ros2_driver::WebotsNode *node, std::unordered_map<std::string, std::string> &parameters) override

Prepare your plugin in this method. Fired before the node is spinned. Parameters are passed from the WebotsNode and/or from URDF.

Parameters:
  • node[in] WebotsNode inherited from rclcpp::Node with a few extra methods related

  • parameters[in] Parameters (key-value pairs) located under a <plugin> (dynamically loaded plugins) or <ros> (statically loaded plugins).

Protected Functions

bool preStep()

Checks if a sensor has data ready and updates the last update time.

Returns:

Should publishing from the sensor be considered

Protected Attributes

webots_ros2_driver::WebotsNode *mNode
std::string mTopicName
std::string mFrameName
double mPublishTimestep
bool mAlwaysOn
int mPublishTimestepSyncedMs
double mLastUpdate