mujoco_ros_utils
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MujocoRosUtils::SensorPublisher Class Reference

Plugin to publish sensor data. More...

#include <SensorPublisher.h>

Public Types

enum  MessageType_ { MsgScalar = 0, MsgPoint, MsgVector3, MsgQuaternion }
 Type of ROS message. More...
 
typedef enum MujocoRosUtils::SensorPublisher::MessageType_ MessageType
 Type of ROS message. More...
 

Public Member Functions

 SensorPublisher (SensorPublisher &&)=default
 Copy constructor. More...
 
void reset (const mjModel *m, int plugin_id)
 Reset. More...
 
void compute (const mjModel *m, mjData *d, int plugin_id)
 Compute. More...
 

Static Public Member Functions

static void RegisterPlugin ()
 Register plugin. More...
 
static SensorPublisherCreate (const mjModel *m, mjData *d, int plugin_id)
 Create an instance. More...
 

Protected Member Functions

 SensorPublisher (const mjModel *m, mjData *d, int sensor_id, MessageType msg_type, const std::string &frame_id, const std::string &topic_name, mjtNum publish_rate)
 Constructor. More...
 

Protected Attributes

int sensor_id_ = -1
 Sensor ID. More...
 
MessageType msg_type_
 Type of ROS message. More...
 
std::string frame_id_
 Frame ID of message header. More...
 
std::string topic_name_
 Topic name. More...
 
std::shared_ptr< ros::NodeHandle > nh_
 ROS node handle. More...
 
ros::Publisher pub_
 ROS publisher. More...
 
int publish_skip_ = 0
 Iteration interval to skip ROS publish. More...
 
int sim_cnt_ = 0
 Iteration count of simulation. More...
 

Detailed Description

Plugin to publish sensor data.

Definition at line 16 of file SensorPublisher.h.

Member Typedef Documentation

◆ MessageType

Type of ROS message.

Member Enumeration Documentation

◆ MessageType_

Type of ROS message.

Enumerator
MsgScalar 

Scalar.

MsgPoint 

Point.

MsgVector3 

3D vector

MsgQuaternion 

Quaternion.

Definition at line 20 of file SensorPublisher.h.

Constructor & Destructor Documentation

◆ SensorPublisher() [1/2]

MujocoRosUtils::SensorPublisher::SensorPublisher ( SensorPublisher &&  )
default

Copy constructor.

◆ SensorPublisher() [2/2]

MujocoRosUtils::SensorPublisher::SensorPublisher ( const mjModel *  m,
mjData *  d,
int  sensor_id,
MessageType  msg_type,
const std::string &  frame_id,
const std::string &  topic_name,
mjtNum  publish_rate 
)
protected

Constructor.

Parameters
mmodel
ddata
sensor_idsensor ID
msg_typetype of ROS message
frame_idframe ID of message header
topic_nametopic name
publish_ratepublish rate

Definition at line 159 of file SensorPublisher.cpp.

Member Function Documentation

◆ compute()

void MujocoRosUtils::SensorPublisher::compute ( const mjModel *  m,
mjData *  d,
int  plugin_id 
)

Compute.

Parameters
mmodel
ddata
plugin_idplugin ID

Definition at line 211 of file SensorPublisher.cpp.

◆ Create()

SensorPublisher * MujocoRosUtils::SensorPublisher::Create ( const mjModel *  m,
mjData *  d,
int  plugin_id 
)
static

Create an instance.

Parameters
mmodel
ddata
plugin_idplugin ID

Definition at line 74 of file SensorPublisher.cpp.

◆ RegisterPlugin()

void MujocoRosUtils::SensorPublisher::RegisterPlugin ( )
static

Register plugin.

Definition at line 15 of file SensorPublisher.cpp.

◆ reset()

void MujocoRosUtils::SensorPublisher::reset ( const mjModel *  m,
int  plugin_id 
)

Reset.

Parameters
mmodel
plugin_idplugin ID

Definition at line 205 of file SensorPublisher.cpp.

Member Data Documentation

◆ frame_id_

std::string MujocoRosUtils::SensorPublisher::frame_id_
protected

Frame ID of message header.

Definition at line 89 of file SensorPublisher.h.

◆ msg_type_

MessageType MujocoRosUtils::SensorPublisher::msg_type_
protected

Type of ROS message.

Definition at line 86 of file SensorPublisher.h.

◆ nh_

std::shared_ptr<ros::NodeHandle> MujocoRosUtils::SensorPublisher::nh_
protected

ROS node handle.

Definition at line 95 of file SensorPublisher.h.

◆ pub_

ros::Publisher MujocoRosUtils::SensorPublisher::pub_
protected

ROS publisher.

Definition at line 98 of file SensorPublisher.h.

◆ publish_skip_

int MujocoRosUtils::SensorPublisher::publish_skip_ = 0
protected

Iteration interval to skip ROS publish.

Definition at line 101 of file SensorPublisher.h.

◆ sensor_id_

int MujocoRosUtils::SensorPublisher::sensor_id_ = -1
protected

Sensor ID.

Definition at line 83 of file SensorPublisher.h.

◆ sim_cnt_

int MujocoRosUtils::SensorPublisher::sim_cnt_ = 0
protected

Iteration count of simulation.

Definition at line 104 of file SensorPublisher.h.

◆ topic_name_

std::string MujocoRosUtils::SensorPublisher::topic_name_
protected

Topic name.

Definition at line 92 of file SensorPublisher.h.


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