Public Types | Signals | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
ROSnode Class Reference

ROS node, getting sensors data and sending commands. More...

#include <ROS_node.hpp>

Inheritance diagram for ROSnode:
Inheritance graph
[legend]

Public Types

typedef ::ros::console::Level LogLevel
 Log severity levels, comming from ROS::console. More...
 

Signals

void loggingUpdated ()
 Signals the GUI for log's update. More...
 

Public Member Functions

bool connected () const
 Indicates whether the node is connected to ROS. More...
 
void end ()
 Stops ROS if it has been started. More...
 
void init (Controller &ctrl)
 Connects to ROS server with main arguments. More...
 
void init (const std::string &master_url, const std::string &host_url, Controller &ctrl)
 Connects to ROS server with parameters. More...
 
void log (const LogLevel &level, const std::string &msg)
 Writes a message at given level in the log. More...
 
QStringListModel & loggingModel ()
 The Qt object used to show the logs. More...
 
 ROSnode (const int argc, char **argv)
 The constructor requires main()'s arguments (they can be forwarded to ROS). More...
 
std::string worldCommandFile (const bool empty=true)
 File name for the script starting the simulation. More...
 

Protected Member Functions

void run ()
 Main loop of the process (on a separate thread). More...
 

Private Member Functions

void newOdometry (const nav_msgs::Odometry::ConstPtr &odom)
 Sends the odometry data to the controller. More...
 
void ROSsetup (Controller &ctrl)
 Common part of the two initialisation methods. More...
 

Private Attributes

ros::Publisher cmd_publisher
 ROS object used to send the velocities. More...
 
QStringListModel log_model
 Qt object used to show the logs in the GUI. More...
 
Controllermotion_ctrl
 A pointer to the controller of the motion. More...
 
ros::Subscriber odom_subscriber
 ROS object used to get the odometry. More...
 
int ROS_argc
 Main arguments' count, forwarded to ROS. More...
 
char ** ROS_argv
 Main arguments' values, forwarded to ROS. More...
 

Detailed Description

ROS node, getting sensors data and sending commands.

This class is the one in charge of the communication with ROS. It only sends commands through a publisher, for the moment. It is a QThread, i.e. a process which runs its main loop in a separate thread. This class is a slight modification of the one generated by catkin_create_qt_pkg.

Since
0.2.0

Definition at line 42 of file ROS_node.hpp.

Member Typedef Documentation

typedef ::ros::console::Level ROSnode::LogLevel

Log severity levels, comming from ROS::console.

Since
0.2.1

Definition at line 112 of file ROS_node.hpp.

Constructor & Destructor Documentation

ROSnode::ROSnode ( const int  argc,
char **  argv 
)
inline

The constructor requires main()'s arguments (they can be forwarded to ROS).

Parameters
argcthe arguments' count,
argvthe arguments' value.
See also
init().

Definition at line 122 of file ROS_node.hpp.

Member Function Documentation

bool ROSnode::connected ( ) const
inline

Indicates whether the node is connected to ROS.

Returns
True if connected to ROS, false otherwise.
Since
0.2.1

Definition at line 135 of file ROS_node.hpp.

void ROSnode::end ( )

Stops ROS if it has been started.

See ROS Namespace, QThread.

Definition at line 17 of file ROS_node.cpp.

void ROSnode::init ( Controller ctrl)
inline

Connects to ROS server with main arguments.

Parameters
ctrlthe motion controller. See ROS Namespace, ROSsetup().

Definition at line 141 of file ROS_node.hpp.

void ROSnode::init ( const std::string &  master_url,
const std::string &  host_url,
Controller ctrl 
)

Connects to ROS server with parameters.

Parameters
master_urlthe URI of the ROS master,
host_urlthe URI of the host,
ctrlthe motion controller.

See ROS Namespace, ROSsetup().

Definition at line 118 of file ROS_node.cpp.

void ROSnode::log ( const LogLevel level,
const std::string &  msg 
)

Writes a message at given level in the log.

Parameters
levelthe log's severity level,
msgthe message.

See ROS::console, ROS::Time, QStringListModel, connected(), loggingModel(), loggingUpdated().

Definition at line 135 of file ROS_node.cpp.

QStringListModel& ROSnode::loggingModel ( )
inline

The Qt object used to show the logs.

Returns
A reference to the Qt object used to show the logs.

Definition at line 158 of file ROS_node.hpp.

void ROSnode::loggingUpdated ( )
signal

Signals the GUI for log's update.

See GUI and multi-thread.

void ROSnode::newOdometry ( const nav_msgs::Odometry::ConstPtr &  odom)
private

Sends the odometry data to the controller.

Parameters
odomthe new odometry data.
See also
Controller::newState().

Definition at line 64 of file ROS_node.cpp.

void ROSnode::ROSsetup ( Controller ctrl)
private

Common part of the two initialisation methods.

Parameters
ctrlthe motion controller. See ROS Namespace, ROS::Publisher, QThread.
See also
init(), init(const std::string&, const std::string&).

Definition at line 34 of file ROS_node.cpp.

void ROSnode::run ( )
protected

Main loop of the process (on a separate thread).

See QThread, ROS::Rate, stop(), geometry_msgs::Twist, ROS Namespace, log(const LogLevel&, const std::string&), ROS::Publisher, ROSshutdown().

Definition at line 89 of file ROS_node.cpp.

std::string ROSnode::worldCommandFile ( const bool  empty = true)
inline

File name for the script starting the simulation.

Parameters
emptyWether an empty workspace is wanted.
Returns
The file name of the script starting the simulation.

Definition at line 163 of file ROS_node.hpp.

Member Data Documentation

ros::Publisher ROSnode::cmd_publisher
private

ROS object used to send the velocities.

See ROS::Publisher.

Definition at line 60 of file ROS_node.hpp.

QStringListModel ROSnode::log_model
private

Qt object used to show the logs in the GUI.

See QStringListModel.

Definition at line 78 of file ROS_node.hpp.

Controller* ROSnode::motion_ctrl
private

A pointer to the controller of the motion.

A NULL value indicates the node is not connected to ROS.

Since
0.3.0

Definition at line 54 of file ROS_node.hpp.

ros::Subscriber ROSnode::odom_subscriber
private

ROS object used to get the odometry.

While this object is not used outside of the constructor, it has to remain defined as long as the ROS node exists, as it is in charge of transmitting the odometry's data to the method which handle them.

See ROS::Subscriber.

Definition at line 71 of file ROS_node.hpp.

int ROSnode::ROS_argc
private

Main arguments' count, forwarded to ROS.

Definition at line 45 of file ROS_node.hpp.

char** ROSnode::ROS_argv
private

Main arguments' values, forwarded to ROS.

Definition at line 46 of file ROS_node.hpp.


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


qt_ctrl
Author(s): Alexis Scheuer
autogenerated on Wed Dec 16 2020 15:51:32