Public Member Functions | Private Member Functions | Private Attributes | List of all members
stdr_server::Server Class Reference

Implements the STDR server functionalities. More...

#include <stdr_server.h>

Public Member Functions

void deleteRobotCallback (const stdr_msgs::DeleteRobotGoalConstPtr &goal)
 Action callback for robot deletion. More...
 
bool loadExternalMapCallback (stdr_msgs::LoadExternalMap::Request &req, stdr_msgs::LoadExternalMap::Response &res)
 Service callback for loading the map from GUI. More...
 
bool loadMapCallback (stdr_msgs::LoadMap::Request &req, stdr_msgs::LoadMap::Response &res)
 Service callback for loading the map. More...
 
void registerRobotCallback (const stdr_msgs::RegisterRobotGoalConstPtr &goal)
 Action callback for robot registering. More...
 
 Server (int argc, char **argv)
 Default constructor. More...
 
void spawnRobotCallback (const stdr_msgs::SpawnRobotGoalConstPtr &goal)
 Action callback for robot spawning. More...
 

Private Member Functions

void activateActionServers (void)
 Initializes the spawn,delete,register action servers. More...
 
bool addCO2SourceCallback (stdr_msgs::AddCO2Source::Request &req, stdr_msgs::AddCO2Source::Response &res)
 Service callback for adding new CO2 source to the environment. More...
 
bool addNewRobot (stdr_msgs::RobotMsg description, stdr_msgs::SpawnRobotResult *result)
 Adds new robot to simulator. More...
 
bool addRfidTagCallback (stdr_msgs::AddRfidTag::Request &req, stdr_msgs::AddRfidTag::Response &res)
 Service callback for adding new rfid tag to the environment. More...
 
bool addSoundSourceCallback (stdr_msgs::AddSoundSource::Request &req, stdr_msgs::AddSoundSource::Response &res)
 Service callback for adding new sound source to the environment. More...
 
bool addThermalSourceCallback (stdr_msgs::AddThermalSource::Request &req, stdr_msgs::AddThermalSource::Response &res)
 Service callback for adding new thermal source to the environment. More...
 
template<class SourceMsg >
visualization_msgs::Marker createMarker (const SourceMsg &msg, bool added)
 Creates a marker message corresponding to every element of msg that is independent of the source's specific type. More...
 
bool deleteCO2SourceCallback (stdr_msgs::DeleteCO2Source::Request &req, stdr_msgs::DeleteCO2Source::Response &res)
 Service callback for deleting a CO2 source from the environment. More...
 
bool deleteRfidTagCallback (stdr_msgs::DeleteRfidTag::Request &req, stdr_msgs::DeleteRfidTag::Response &res)
 Service callback for deleting an rfid tag from the environment. More...
 
bool deleteRobot (std::string name, stdr_msgs::DeleteRobotResult *result)
 Deletes a robot from simulator. More...
 
bool deleteSoundSourceCallback (stdr_msgs::DeleteSoundSource::Request &req, stdr_msgs::DeleteSoundSource::Response &res)
 Service callback for deleting a sound source from the environment. More...
 
bool deleteThermalSourceCallback (stdr_msgs::DeleteThermalSource::Request &req, stdr_msgs::DeleteThermalSource::Response &res)
 Service callback for deleting a thermal source from the environment. More...
 
bool hasDublicateFrameIds (const stdr_msgs::RobotMsg &robot, std::string &f_id)
 
void republishSources ()
 Republishes existing sources to RVIZ after a successful deletion. More...
 
visualization_msgs::Marker toMarker (const stdr_msgs::CO2Source &msg, bool added)
 Translate the stdr_C02Source message into a marker message. More...
 
visualization_msgs::Marker toMarker (const stdr_msgs::ThermalSource &msg, bool added)
 Translate the stdr_ThermalSource message into a marker message. More...
 
visualization_msgs::Marker toMarker (const stdr_msgs::SoundSource &msg, bool added)
 Translate the stdr_SoundSource message into a marker message. More...
 
visualization_msgs::Marker toMarker (const stdr_msgs::RfidTag &msg, bool added)
 Translate the stdr_RfidTag message into a marker message. More...
 

Private Attributes

ros::ServiceServer _addCO2SourceServiceServer
 The deleteCO2Source srv server. More...
 
ros::ServiceServer _addRfidTagServiceServer
 The deleteRfidTag srv server. More...
 
ros::ServiceServer _addSoundSourceServiceServer
 The deleteSoundSource srv server. More...
 
ros::ServiceServer _addThermalSourceServiceServer
 The deleteThermalSource srv server. More...
 
CO2SourceMap _CO2SourceMap
 An std::map that contains the thermal sources existent in the environment. More...
 
ros::Publisher _CO2SourceVectorPublisher
 The addThermalSource srv server. More...
 
boost::condition_variable _cond
 A general Rviz publisher for all source types. More...
 
ros::ServiceServer _deleteCO2SourceServiceServer
 The CO2 source list publisher towards the GUI. More...
 
ros::ServiceServer _deleteRfidTagServiceServer
 The rfid tag list publisher. More...
 
DeleteRobotServer _deleteRobotServer
 An std::map that contains the robots based on theor frame_id. More...
 
ros::ServiceServer _deleteSoundSourceServiceServer
 The sound source list publisher. More...
 
ros::ServiceServer _deleteThermalSourceServiceServer
 The thermal source list publisher. More...
 
int _id
 An std::map that contains the rfid tags existent in the environment. More...
 
ros::ServiceServer _loadExternalMapService
 Service server for moving robots. More...
 
ros::ServiceServer _loadMapService
 Service server for loading maps from GUI. More...
 
MapServerPtr _mapServer
 ROS publisher for the ensemble of robots. More...
 
ros::ServiceServer _moveRobotService
 Action server for registering robots. More...
 
boost::mutex _mut
 Boost condition variable for conflicting avoidance. More...
 
ros::NodeHandle _nh
 A pointer to a MapServe object. More...
 
RegisterRobotServer _registerRobotServer
 Action server for spawning robots. More...
 
RfidTagMap _rfidTagMap
 An std::map that contains the CO2 sources existent in the environment. More...
 
ros::Publisher _rfidTagVectorPublisher
 The addCO2Source srv server. More...
 
RobotMap _robotMap
 Index that shows the next robot id. More...
 
ros::Publisher _robotsPublisher
 Action client for robot spawning. More...
 
SoundSourceMap _soundSourceMap
 Boost mutex for conflict avoidance. More...
 
ros::Publisher _soundSourceVectorPublisher
 
ros::Publisher _sourceVectorPublisherRviz
 The addRfidTag srv server. More...
 
ros::ServiceClient _spawnRobotClient
 Action client for robot unloading. More...
 
SpawnRobotServer _spawnRobotServer
 Action server for deleting robots. More...
 
ThermalSourceMap _thermalSourceMap
 An std::map that contains the sound sources existent in the environment. More...
 
ros::Publisher _thermalSourceVectorPublisher
 The addSoundSource srv server. More...
 
ros::ServiceClient _unloadRobotClient
 Service server for loading maps from files. More...
 

Detailed Description

Implements the STDR server functionalities.

Definition at line 99 of file stdr_server.h.

Constructor & Destructor Documentation

stdr_server::Server::Server ( int  argc,
char **  argv 
)

Default constructor.

Parameters
argc[int] Number of input arguments
argv[char**] The input arguments
Returns
voidServices -----------------------—

< if we don't have map, no point to start servers

< Rviz publisher

< Rfid tags

< CO2 sources

< Thermal sources

< Sound sources

Definition at line 30 of file stdr_server.cpp.

Member Function Documentation

void stdr_server::Server::activateActionServers ( void  )
private

Initializes the spawn,delete,register action servers.

Returns
void

Definition at line 601 of file stdr_server.cpp.

bool stdr_server::Server::addCO2SourceCallback ( stdr_msgs::AddCO2Source::Request &  req,
stdr_msgs::AddCO2Source::Response &  res 
)
private

Service callback for adding new CO2 source to the environment.

Parameters
req[stdr_msgs::AddCO2Source::Request &] The request
res[stdr_msgs::AddCO2Source::Response &] The Response
Returns
bool

< Sanity check for the source

< A source exists with the same id

< Publish the new source list to both our custom GUI and Rviz.

< Republish existing sources as markers

< Return success

Definition at line 188 of file stdr_server.cpp.

bool stdr_server::Server::addNewRobot ( stdr_msgs::RobotMsg  description,
stdr_msgs::SpawnRobotResult *  result 
)
private

Adds new robot to simulator.

Parameters
description[stdr_msgs::RobotMsg] The new robot description
result[stdr_msgs::SpawnRobotResult*] The action result
Returns
bool

< wait until robot calls RobotRegisterAction or timeout expires

Definition at line 614 of file stdr_server.cpp.

bool stdr_server::Server::addRfidTagCallback ( stdr_msgs::AddRfidTag::Request &  req,
stdr_msgs::AddRfidTag::Response &  res 
)
private

Service callback for adding new rfid tag to the environment.

Parameters
req[stdr_msgs::AddRfidTag::Request &] The request
res[stdr_msgs::AddRfidTag::Response &] The Response
Returns
bool

< Sanity check for the RFID tag

< A rfid tag exists with the same tag_id

< Publish the new RFID tag list

< Republish existing sources as markers

< Return success

Definition at line 147 of file stdr_server.cpp.

bool stdr_server::Server::addSoundSourceCallback ( stdr_msgs::AddSoundSource::Request &  req,
stdr_msgs::AddSoundSource::Response &  res 
)
private

Service callback for adding new sound source to the environment.

Parameters
req[stdr_msgs::AddSoundSource::Request &] The request
res[stdr_msgs::AddSoundSource::Response &] The Response
Returns
bool

< Sanity check for the source

< A source exists with the same id

< Publish the new source list

< Republish existing sources as markers

< Return success

Definition at line 272 of file stdr_server.cpp.

bool stdr_server::Server::addThermalSourceCallback ( stdr_msgs::AddThermalSource::Request &  req,
stdr_msgs::AddThermalSource::Response &  res 
)
private

Service callback for adding new thermal source to the environment.

Parameters
req[stdr_msgs::AddThermalSource::Request &] The request
res[stdr_msgs::AddThermalSource::Response &] The Response
Returns
bool

< Sanity check for the source

< A source exists with the same id

< Publish the new source list

< Republish existing sources as markers

< Return success

Definition at line 230 of file stdr_server.cpp.

template<class SourceMsg >
visualization_msgs::Marker stdr_server::Server::createMarker ( const SourceMsg &  msg,
bool  added 
)
private

Creates a marker message corresponding to every element of msg that is independent of the source's specific type.

Parameters
msg[SourceMsg] The source message
added[bool] True if the marker is added, false if it should be deleted
Returns
[visualization_msgs::Marker] the marker message to be published to RvizThe ROS node handle

Definition at line 885 of file stdr_server.cpp.

bool stdr_server::Server::deleteCO2SourceCallback ( stdr_msgs::DeleteCO2Source::Request &  req,
stdr_msgs::DeleteCO2Source::Response &  res 
)
private

Service callback for deleting a CO2 source from the environment.

Parameters
req[stdr_msgs::DeleteCO2Source::Request &] The request
res[stdr_msgs::DeleteCO2Source::Response &] The Response
Returns
bool

< Publish the new sources list

< Republish existing sources to RVIZ.

< Source does not exist

Definition at line 351 of file stdr_server.cpp.

bool stdr_server::Server::deleteRfidTagCallback ( stdr_msgs::DeleteRfidTag::Request &  req,
stdr_msgs::DeleteRfidTag::Response &  res 
)
private

Service callback for deleting an rfid tag from the environment.

Parameters
req[stdr_msgs::DeleteRfidTag::Request &] The request
res[stdr_msgs::DeleteRfidTag::Response &] The Response
Returns
bool

< Publish the new RFID tag list

< Republish existing sources to RVIZ.

< Tag does not exist

Definition at line 314 of file stdr_server.cpp.

bool stdr_server::Server::deleteRobot ( std::string  name,
stdr_msgs::DeleteRobotResult *  result 
)
private

Deletes a robot from simulator.

Parameters
name[std::string] The robot frame_id
result[stdr_msgs::DeleteRobotResult*] The action result
Returns
bool

Definition at line 659 of file stdr_server.cpp.

void stdr_server::Server::deleteRobotCallback ( const stdr_msgs::DeleteRobotGoalConstPtr &  goal)

Action callback for robot deletion.

Parameters
goal[const stdr_msgs::DeleteRobotGoalConstPtr&] The action goal
Returns
void

Definition at line 545 of file stdr_server.cpp.

bool stdr_server::Server::deleteSoundSourceCallback ( stdr_msgs::DeleteSoundSource::Request &  req,
stdr_msgs::DeleteSoundSource::Response &  res 
)
private

Service callback for deleting a sound source from the environment.

Parameters
req[stdr_msgs::DeleteSoundSource::Request &] The request
res[stdr_msgs::DeleteSoundSource::Response &] The Response
Returns
bool

< Publish the new sources list

< Republish existing sources to RVIZ.

< Source does not exist

Definition at line 425 of file stdr_server.cpp.

bool stdr_server::Server::deleteThermalSourceCallback ( stdr_msgs::DeleteThermalSource::Request &  req,
stdr_msgs::DeleteThermalSource::Response &  res 
)
private

Service callback for deleting a thermal source from the environment.

Parameters
req[stdr_msgs::DeleteThermalSource::Request &] The request
res[stdr_msgs::DeleteThermalSource::Response &] The Response
Returns
bool

< Publish the new sources list

< Republish existing sources to RVIZ.

< Source does not exist

Definition at line 388 of file stdr_server.cpp.

bool stdr_server::Server::hasDublicateFrameIds ( const stdr_msgs::RobotMsg &  robot,
std::string &  f_id 
)
private

Definition at line 692 of file stdr_server.cpp.

bool stdr_server::Server::loadExternalMapCallback ( stdr_msgs::LoadExternalMap::Request &  req,
stdr_msgs::LoadExternalMap::Response &  res 
)

Service callback for loading the map from GUI.

Parameters
req[stdr_msgs::LoadExternalMap::Request&] The service request
res[stdr_msgs::LoadExternalMap::Response&] The service response
Returns
boolActions -----------------------—
Parameters
req[stdr_msgs::LoadExternalMap::Request&] The service request
res[stdr_msgs::LoadExternalMap::Response&] The service response
Returns
bool

< if we don't have map, no point to start servers

Definition at line 488 of file stdr_server.cpp.

bool stdr_server::Server::loadMapCallback ( stdr_msgs::LoadMap::Request &  req,
stdr_msgs::LoadMap::Response &  res 
)

Service callback for loading the map.

Parameters
req[stdr_msgs::LoadMap::Request&] The service request
res[stdr_msgs::LoadMap::Response&] The service response
Returns
bool

< if we don't have map, no point to start servers

Definition at line 467 of file stdr_server.cpp.

void stdr_server::Server::registerRobotCallback ( const stdr_msgs::RegisterRobotGoalConstPtr &  goal)

Action callback for robot registering.

Parameters
goal[const stdr_msgs::RegisterRobotGoalConstPtr&] The action goal
Returns
void

< notify spawn action, to reply to spawnner

Definition at line 573 of file stdr_server.cpp.

void stdr_server::Server::republishSources ( )
private

Republishes existing sources to RVIZ after a successful deletion.

Returns
[void]

Definition at line 855 of file stdr_server.cpp.

void stdr_server::Server::spawnRobotCallback ( const stdr_msgs::SpawnRobotGoalConstPtr &  goal)

Action callback for robot spawning.

Parameters
goal[const stdr_msgs::SpawnRobotGoalConstPtr&] The action goal
Returns
void

< publish to active_robots topic

Definition at line 509 of file stdr_server.cpp.

visualization_msgs::Marker stdr_server::Server::toMarker ( const stdr_msgs::CO2Source &  msg,
bool  added 
)
private

Translate the stdr_C02Source message into a marker message.

Parameters
msg[stdr_msgs::CO2Source] The GUI message to be translated
added[bool] True if the marker is added, false if it should be deleted
Returns
[visualization_msgs::Marker] the marker message to be published to Rviz

Definition at line 774 of file stdr_server.cpp.

visualization_msgs::Marker stdr_server::Server::toMarker ( const stdr_msgs::ThermalSource &  msg,
bool  added 
)
private

Translate the stdr_ThermalSource message into a marker message.

Parameters
msg[stdr_msgs::ThermalSource] The GUI message to be translated
added[bool] True if the marker is added, false if it should be deleted
Returns
[visualization_msgs::Marker] the marker message to be published to Rviz

Definition at line 795 of file stdr_server.cpp.

visualization_msgs::Marker stdr_server::Server::toMarker ( const stdr_msgs::SoundSource &  msg,
bool  added 
)
private

Translate the stdr_SoundSource message into a marker message.

Parameters
msg[stdr_msgs::SoundSource] The GUI message to be translated
added[bool] True if the marker is added, false if it should be deleted
Returns
[visualization_msgs::Marker] the marker message to be published to Rviz

Definition at line 816 of file stdr_server.cpp.

visualization_msgs::Marker stdr_server::Server::toMarker ( const stdr_msgs::RfidTag &  msg,
bool  added 
)
private

Translate the stdr_RfidTag message into a marker message.

Translate the stdr_SoundSource message into a marker message.

Parameters
msg[stdr_msgs::RfidTag] The GUI message to be translated
added[bool] True if the marker is added, false if it should be deleted
Returns
[visualization_msgs::Marker] the marker message to be published to Rviz

Definition at line 837 of file stdr_server.cpp.

Member Data Documentation

ros::ServiceServer stdr_server::Server::_addCO2SourceServiceServer
private

The deleteCO2Source srv server.

Definition at line 371 of file stdr_server.h.

ros::ServiceServer stdr_server::Server::_addRfidTagServiceServer
private

The deleteRfidTag srv server.

Definition at line 363 of file stdr_server.h.

ros::ServiceServer stdr_server::Server::_addSoundSourceServiceServer
private

The deleteSoundSource srv server.

Definition at line 385 of file stdr_server.h.

ros::ServiceServer stdr_server::Server::_addThermalSourceServiceServer
private

The deleteThermalSource srv server.

Definition at line 378 of file stdr_server.h.

CO2SourceMap stdr_server::Server::_CO2SourceMap
private

An std::map that contains the thermal sources existent in the environment.

Definition at line 347 of file stdr_server.h.

ros::Publisher stdr_server::Server::_CO2SourceVectorPublisher
private

The addThermalSource srv server.

Definition at line 375 of file stdr_server.h.

boost::condition_variable stdr_server::Server::_cond
private

A general Rviz publisher for all source types.

Definition at line 356 of file stdr_server.h.

ros::ServiceServer stdr_server::Server::_deleteCO2SourceServiceServer
private

The CO2 source list publisher towards the GUI.

Definition at line 373 of file stdr_server.h.

ros::ServiceServer stdr_server::Server::_deleteRfidTagServiceServer
private

The rfid tag list publisher.

Definition at line 365 of file stdr_server.h.

DeleteRobotServer stdr_server::Server::_deleteRobotServer
private

An std::map that contains the robots based on theor frame_id.

Definition at line 337 of file stdr_server.h.

ros::ServiceServer stdr_server::Server::_deleteSoundSourceServiceServer
private

The sound source list publisher.

Definition at line 387 of file stdr_server.h.

ros::ServiceServer stdr_server::Server::_deleteThermalSourceServiceServer
private

The thermal source list publisher.

Definition at line 380 of file stdr_server.h.

int stdr_server::Server::_id
private

An std::map that contains the rfid tags existent in the environment.

Definition at line 342 of file stdr_server.h.

ros::ServiceServer stdr_server::Server::_loadExternalMapService
private

Service server for moving robots.

Definition at line 328 of file stdr_server.h.

ros::ServiceServer stdr_server::Server::_loadMapService
private

Service server for loading maps from GUI.

Definition at line 326 of file stdr_server.h.

MapServerPtr stdr_server::Server::_mapServer
private

ROS publisher for the ensemble of robots.

Definition at line 316 of file stdr_server.h.

ros::ServiceServer stdr_server::Server::_moveRobotService
private

Action server for registering robots.

Definition at line 330 of file stdr_server.h.

boost::mutex stdr_server::Server::_mut
private

Boost condition variable for conflicting avoidance.

Definition at line 354 of file stdr_server.h.

ros::NodeHandle stdr_server::Server::_nh
private

A pointer to a MapServe object.

Definition at line 314 of file stdr_server.h.

RegisterRobotServer stdr_server::Server::_registerRobotServer
private

Action server for spawning robots.

Definition at line 333 of file stdr_server.h.

RfidTagMap stdr_server::Server::_rfidTagMap
private

An std::map that contains the CO2 sources existent in the environment.

Definition at line 345 of file stdr_server.h.

ros::Publisher stdr_server::Server::_rfidTagVectorPublisher
private

The addCO2Source srv server.

Definition at line 367 of file stdr_server.h.

RobotMap stdr_server::Server::_robotMap
private

Index that shows the next robot id.

Definition at line 340 of file stdr_server.h.

ros::Publisher stdr_server::Server::_robotsPublisher
private

Action client for robot spawning.

Definition at line 319 of file stdr_server.h.

SoundSourceMap stdr_server::Server::_soundSourceMap
private

Boost mutex for conflict avoidance.

Definition at line 351 of file stdr_server.h.

ros::Publisher stdr_server::Server::_soundSourceVectorPublisher
private

Definition at line 389 of file stdr_server.h.

ros::Publisher stdr_server::Server::_sourceVectorPublisherRviz
private

The addRfidTag srv server.

Definition at line 360 of file stdr_server.h.

ros::ServiceClient stdr_server::Server::_spawnRobotClient
private

Action client for robot unloading.

Definition at line 322 of file stdr_server.h.

SpawnRobotServer stdr_server::Server::_spawnRobotServer
private

Action server for deleting robots.

Definition at line 335 of file stdr_server.h.

ThermalSourceMap stdr_server::Server::_thermalSourceMap
private

An std::map that contains the sound sources existent in the environment.

Definition at line 349 of file stdr_server.h.

ros::Publisher stdr_server::Server::_thermalSourceVectorPublisher
private

The addSoundSource srv server.

Definition at line 382 of file stdr_server.h.

ros::ServiceClient stdr_server::Server::_unloadRobotClient
private

Service server for loading maps from files.

Definition at line 324 of file stdr_server.h.


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


stdr_server
Author(s): Chris Zalidis
autogenerated on Mon Jun 10 2019 15:15:07