Public Member Functions | Private Member Functions | Private Attributes
stdr_server::Server Class Reference

Implements the STDR server functionalities. More...

#include <stdr_server.h>

List of all members.

Public Member Functions

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

Private Member Functions

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

Private Attributes

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

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:
void Services --------------------------

< 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 Rviz The 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:
bool Actions --------------------------
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.

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

The deleteCO2Source srv server.

Definition at line 372 of file stdr_server.h.

The deleteRfidTag srv server.

Definition at line 364 of file stdr_server.h.

The deleteSoundSource srv server.

Definition at line 386 of file stdr_server.h.

The deleteThermalSource srv server.

Definition at line 379 of file stdr_server.h.

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

Definition at line 348 of file stdr_server.h.

The addThermalSource srv server.

Definition at line 377 of file stdr_server.h.

boost::condition_variable stdr_server::Server::_cond [private]

A general Rviz publisher for all source types.

Definition at line 359 of file stdr_server.h.

The CO2 source list publisher towards the GUI.

Definition at line 374 of file stdr_server.h.

The rfid tag list publisher.

Definition at line 366 of file stdr_server.h.

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

Definition at line 339 of file stdr_server.h.

The sound source list publisher.

Definition at line 388 of file stdr_server.h.

The thermal source list publisher.

Definition at line 381 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 344 of file stdr_server.h.

Service server for moving robots.

Definition at line 329 of file stdr_server.h.

Service server for loading maps from GUI.

Definition at line 327 of file stdr_server.h.

ROS publisher for the ensemble of robots.

Definition at line 318 of file stdr_server.h.

Action server for registering robots.

Definition at line 332 of file stdr_server.h.

boost::mutex stdr_server::Server::_mut [private]

Boost condition variable for conflicting avoidance.

Definition at line 355 of file stdr_server.h.

A pointer to a MapServe object.

Definition at line 315 of file stdr_server.h.

Action server for spawning robots.

Definition at line 334 of file stdr_server.h.

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

Definition at line 346 of file stdr_server.h.

The addCO2Source srv server.

Definition at line 370 of file stdr_server.h.

Index that shows the next robot id.

Definition at line 341 of file stdr_server.h.

Action client for robot spawning.

Definition at line 321 of file stdr_server.h.

Boost mutex for conflict avoidance.

Definition at line 353 of file stdr_server.h.

Definition at line 389 of file stdr_server.h.

The addRfidTag srv server.

Definition at line 362 of file stdr_server.h.

Action client for robot unloading.

Definition at line 323 of file stdr_server.h.

Action server for deleting robots.

Definition at line 336 of file stdr_server.h.

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

Definition at line 350 of file stdr_server.h.

The addSoundSource srv server.

Definition at line 384 of file stdr_server.h.

Service server for loading maps from files.

Definition at line 325 of file stdr_server.h.


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


stdr_server
Author(s): Chris Zalidis
autogenerated on Thu Jun 6 2019 18:57:23