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... | |
Implements the STDR server functionalities.
Definition at line 99 of file stdr_server.h.
stdr_server::Server::Server | ( | int | argc, |
char ** | argv | ||
) |
Default constructor.
argc | [int] Number of input arguments |
argv | [char**] The input arguments |
< 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.
|
private |
Initializes the spawn,delete,register action servers.
Definition at line 601 of file stdr_server.cpp.
|
private |
Service callback for adding new CO2 source to the environment.
req | [stdr_msgs::AddCO2Source::Request &] The request |
res | [stdr_msgs::AddCO2Source::Response &] The Response |
< 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.
|
private |
Adds new robot to simulator.
description | [stdr_msgs::RobotMsg] The new robot description |
result | [stdr_msgs::SpawnRobotResult*] The action result |
< wait until robot calls RobotRegisterAction or timeout expires
Definition at line 614 of file stdr_server.cpp.
|
private |
Service callback for adding new rfid tag to the environment.
req | [stdr_msgs::AddRfidTag::Request &] The request |
res | [stdr_msgs::AddRfidTag::Response &] The Response |
< 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.
|
private |
Service callback for adding new sound source to the environment.
req | [stdr_msgs::AddSoundSource::Request &] The request |
res | [stdr_msgs::AddSoundSource::Response &] The Response |
< 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.
|
private |
Service callback for adding new thermal source to the environment.
req | [stdr_msgs::AddThermalSource::Request &] The request |
res | [stdr_msgs::AddThermalSource::Response &] The Response |
< 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.
|
private |
Creates a marker message corresponding to every element of msg that is independent of the source's specific type.
msg | [SourceMsg] The source message |
added | [bool] True if the marker is added, false if it should be deleted |
Definition at line 885 of file stdr_server.cpp.
|
private |
Service callback for deleting a CO2 source from the environment.
req | [stdr_msgs::DeleteCO2Source::Request &] The request |
res | [stdr_msgs::DeleteCO2Source::Response &] The Response |
< Publish the new sources list
< Republish existing sources to RVIZ.
< Source does not exist
Definition at line 351 of file stdr_server.cpp.
|
private |
Service callback for deleting an rfid tag from the environment.
req | [stdr_msgs::DeleteRfidTag::Request &] The request |
res | [stdr_msgs::DeleteRfidTag::Response &] The Response |
< Publish the new RFID tag list
< Republish existing sources to RVIZ.
< Tag does not exist
Definition at line 314 of file stdr_server.cpp.
|
private |
Deletes a robot from simulator.
name | [std::string] The robot frame_id |
result | [stdr_msgs::DeleteRobotResult*] The action result |
Definition at line 659 of file stdr_server.cpp.
void stdr_server::Server::deleteRobotCallback | ( | const stdr_msgs::DeleteRobotGoalConstPtr & | goal | ) |
Action callback for robot deletion.
goal | [const stdr_msgs::DeleteRobotGoalConstPtr&] The action goal |
Definition at line 545 of file stdr_server.cpp.
|
private |
Service callback for deleting a sound source from the environment.
req | [stdr_msgs::DeleteSoundSource::Request &] The request |
res | [stdr_msgs::DeleteSoundSource::Response &] The Response |
< Publish the new sources list
< Republish existing sources to RVIZ.
< Source does not exist
Definition at line 425 of file stdr_server.cpp.
|
private |
Service callback for deleting a thermal source from the environment.
req | [stdr_msgs::DeleteThermalSource::Request &] The request |
res | [stdr_msgs::DeleteThermalSource::Response &] The Response |
< Publish the new sources list
< Republish existing sources to RVIZ.
< Source does not exist
Definition at line 388 of file stdr_server.cpp.
|
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.
req | [stdr_msgs::LoadExternalMap::Request&] The service request |
res | [stdr_msgs::LoadExternalMap::Response&] The service response |
req | [stdr_msgs::LoadExternalMap::Request&] The service request |
res | [stdr_msgs::LoadExternalMap::Response&] The service response |
< 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.
req | [stdr_msgs::LoadMap::Request&] The service request |
res | [stdr_msgs::LoadMap::Response&] The service response |
< 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.
goal | [const stdr_msgs::RegisterRobotGoalConstPtr&] The action goal |
< notify spawn action, to reply to spawnner
Definition at line 573 of file stdr_server.cpp.
|
private |
Republishes existing sources to RVIZ after a successful deletion.
Definition at line 855 of file stdr_server.cpp.
void stdr_server::Server::spawnRobotCallback | ( | const stdr_msgs::SpawnRobotGoalConstPtr & | goal | ) |
Action callback for robot spawning.
goal | [const stdr_msgs::SpawnRobotGoalConstPtr&] The action goal |
< publish to active_robots topic
Definition at line 509 of file stdr_server.cpp.
|
private |
Translate the stdr_C02Source message into a marker message.
msg | [stdr_msgs::CO2Source] The GUI message to be translated |
added | [bool] True if the marker is added, false if it should be deleted |
Definition at line 774 of file stdr_server.cpp.
|
private |
Translate the stdr_ThermalSource message into a marker message.
msg | [stdr_msgs::ThermalSource] The GUI message to be translated |
added | [bool] True if the marker is added, false if it should be deleted |
Definition at line 795 of file stdr_server.cpp.
|
private |
Translate the stdr_SoundSource message into a marker message.
msg | [stdr_msgs::SoundSource] The GUI message to be translated |
added | [bool] True if the marker is added, false if it should be deleted |
Definition at line 816 of file stdr_server.cpp.
|
private |
Translate the stdr_RfidTag message into a marker message.
Translate the stdr_SoundSource message into a marker message.
msg | [stdr_msgs::RfidTag] The GUI message to be translated |
added | [bool] True if the marker is added, false if it should be deleted |
Definition at line 837 of file stdr_server.cpp.
|
private |
The deleteCO2Source srv server.
Definition at line 371 of file stdr_server.h.
|
private |
The deleteRfidTag srv server.
Definition at line 363 of file stdr_server.h.
|
private |
The deleteSoundSource srv server.
Definition at line 385 of file stdr_server.h.
|
private |
The deleteThermalSource srv server.
Definition at line 378 of file stdr_server.h.
|
private |
An std::map that contains the thermal sources existent in the environment.
Definition at line 347 of file stdr_server.h.
|
private |
The addThermalSource srv server.
Definition at line 375 of file stdr_server.h.
|
private |
A general Rviz publisher for all source types.
Definition at line 356 of file stdr_server.h.
|
private |
The CO2 source list publisher towards the GUI.
Definition at line 373 of file stdr_server.h.
|
private |
The rfid tag list publisher.
Definition at line 365 of file stdr_server.h.
|
private |
An std::map that contains the robots based on theor frame_id.
Definition at line 337 of file stdr_server.h.
|
private |
The sound source list publisher.
Definition at line 387 of file stdr_server.h.
|
private |
The thermal source list publisher.
Definition at line 380 of file stdr_server.h.
|
private |
An std::map that contains the rfid tags existent in the environment.
Definition at line 342 of file stdr_server.h.
|
private |
Service server for moving robots.
Definition at line 328 of file stdr_server.h.
|
private |
Service server for loading maps from GUI.
Definition at line 326 of file stdr_server.h.
|
private |
ROS publisher for the ensemble of robots.
Definition at line 316 of file stdr_server.h.
|
private |
Action server for registering robots.
Definition at line 330 of file stdr_server.h.
|
private |
Boost condition variable for conflicting avoidance.
Definition at line 354 of file stdr_server.h.
|
private |
A pointer to a MapServe object.
Definition at line 314 of file stdr_server.h.
|
private |
Action server for spawning robots.
Definition at line 333 of file stdr_server.h.
|
private |
An std::map that contains the CO2 sources existent in the environment.
Definition at line 345 of file stdr_server.h.
|
private |
The addCO2Source srv server.
Definition at line 367 of file stdr_server.h.
|
private |
Index that shows the next robot id.
Definition at line 340 of file stdr_server.h.
|
private |
Action client for robot spawning.
Definition at line 319 of file stdr_server.h.
|
private |
Boost mutex for conflict avoidance.
Definition at line 351 of file stdr_server.h.
|
private |
Definition at line 389 of file stdr_server.h.
|
private |
The addRfidTag srv server.
Definition at line 360 of file stdr_server.h.
|
private |
Action client for robot unloading.
Definition at line 322 of file stdr_server.h.
|
private |
Action server for deleting robots.
Definition at line 335 of file stdr_server.h.
|
private |
An std::map that contains the sound sources existent in the environment.
Definition at line 349 of file stdr_server.h.
|
private |
The addSoundSource srv server.
Definition at line 382 of file stdr_server.h.
|
private |
Service server for loading maps from files.
Definition at line 324 of file stdr_server.h.