25 #define USAGE "\nUSAGE: stdr_server <map.yaml>\n" \ 26 " map.yaml: map description file\n" 31 #include <stdr_msgs/LoadMap.h> 32 #include <stdr_msgs/LoadExternalMap.h> 33 #include <stdr_msgs/RegisterGui.h> 34 #include <stdr_msgs/RegisterRobotAction.h> 35 #include <stdr_msgs/SpawnRobotAction.h> 36 #include <stdr_msgs/DeleteRobotAction.h> 37 #include <stdr_msgs/RobotIndexedMsg.h> 38 #include <stdr_msgs/RobotIndexedVectorMsg.h> 40 #include <visualization_msgs/Marker.h> 41 #include <visualization_msgs/MarkerArray.h> 43 #include <stdr_msgs/RfidTagVector.h> 44 #include <stdr_msgs/AddRfidTag.h> 45 #include <stdr_msgs/DeleteRfidTag.h> 47 #include <stdr_msgs/CO2SourceVector.h> 48 #include <stdr_msgs/AddCO2Source.h> 49 #include <stdr_msgs/DeleteCO2Source.h> 51 #include <stdr_msgs/ThermalSourceVector.h> 52 #include <stdr_msgs/AddThermalSource.h> 53 #include <stdr_msgs/DeleteThermalSource.h> 55 #include <stdr_msgs/SoundSourceVector.h> 56 #include <stdr_msgs/AddSoundSource.h> 57 #include <stdr_msgs/DeleteSoundSource.h> 59 #include <nodelet/NodeletLoad.h> 60 #include <nodelet/NodeletUnload.h> 79 typedef std::map<std::string, stdr_msgs::RobotIndexedMsg>
RobotMap;
81 typedef std::map<std::string, stdr_msgs::RfidTag>
RfidTagMap;
82 typedef std::map<std::string, stdr_msgs::RfidTag>::iterator
RfidTagMapIt;
85 typedef std::map<std::string, stdr_msgs::CO2Source>::iterator
CO2SourceMapIt;
88 typedef std::map<std::string, stdr_msgs::ThermalSource>::iterator
92 typedef std::map<std::string, stdr_msgs::SoundSource>::iterator
110 Server(
int argc,
char** argv);
121 stdr_msgs::LoadMap::Response& res);
130 stdr_msgs::LoadExternalMap::Response& res);
147 const stdr_msgs::DeleteRobotGoalConstPtr& goal);
155 const stdr_msgs::RegisterRobotGoalConstPtr& goal);
172 stdr_msgs::SpawnRobotResult* result);
180 bool deleteRobot(std::string name, stdr_msgs::DeleteRobotResult* result);
189 stdr_msgs::AddRfidTag::Request &req,
190 stdr_msgs::AddRfidTag::Response &res);
199 stdr_msgs::DeleteRfidTag::Request &req,
200 stdr_msgs::DeleteRfidTag::Response &res);
209 stdr_msgs::AddCO2Source::Request &req,
210 stdr_msgs::AddCO2Source::Response &res);
219 stdr_msgs::DeleteCO2Source::Request &req,
220 stdr_msgs::DeleteCO2Source::Response &res);
229 stdr_msgs::AddThermalSource::Request &req,
230 stdr_msgs::AddThermalSource::Response &res);
239 stdr_msgs::DeleteThermalSource::Request &req,
240 stdr_msgs::DeleteThermalSource::Response &res);
249 stdr_msgs::AddSoundSource::Request &req,
250 stdr_msgs::AddSoundSource::Response &res);
259 stdr_msgs::DeleteSoundSource::Request &req,
260 stdr_msgs::DeleteSoundSource::Response &res);
271 visualization_msgs::Marker
toMarker(
const stdr_msgs::CO2Source& msg,
bool added);
279 visualization_msgs::Marker
toMarker(
const stdr_msgs::ThermalSource& msg,
bool added);
287 visualization_msgs::Marker
toMarker(
const stdr_msgs::SoundSource& msg,
bool added);
295 visualization_msgs::Marker
toMarker(
const stdr_msgs::RfidTag& msg,
bool added);
310 template <
class SourceMsg>
311 visualization_msgs::Marker
createMarker(
const SourceMsg& msg,
bool added);
bool deleteThermalSourceCallback(stdr_msgs::DeleteThermalSource::Request &req, stdr_msgs::DeleteThermalSource::Response &res)
Service callback for deleting a thermal source from the environment.
void registerRobotCallback(const stdr_msgs::RegisterRobotGoalConstPtr &goal)
Action callback for robot registering.
bool hasDublicateFrameIds(const stdr_msgs::RobotMsg &robot, std::string &f_id)
MapServerPtr _mapServer
ROS publisher for the ensemble of robots.
ros::Publisher _CO2SourceVectorPublisher
The addThermalSource srv server.
bool addNewRobot(stdr_msgs::RobotMsg description, stdr_msgs::SpawnRobotResult *result)
Adds new robot to simulator.
std::map< std::string, stdr_msgs::SoundSource > SoundSourceMap
ros::ServiceServer _addSoundSourceServiceServer
The deleteSoundSource srv server.
void spawnRobotCallback(const stdr_msgs::SpawnRobotGoalConstPtr &goal)
Action callback for robot spawning.
bool deleteSoundSourceCallback(stdr_msgs::DeleteSoundSource::Request &req, stdr_msgs::DeleteSoundSource::Response &res)
Service callback for deleting a sound source from the environment.
ros::ServiceServer _deleteCO2SourceServiceServer
The CO2 source list publisher towards the GUI.
SpawnRobotServer _spawnRobotServer
Action server for deleting robots.
bool addSoundSourceCallback(stdr_msgs::AddSoundSource::Request &req, stdr_msgs::AddSoundSource::Response &res)
Service callback for adding new sound source to the environment.
bool loadExternalMapCallback(stdr_msgs::LoadExternalMap::Request &req, stdr_msgs::LoadExternalMap::Response &res)
Service callback for loading the map from GUI.
ros::Publisher _rfidTagVectorPublisher
The addCO2Source srv server.
The main namespace for STDR Server.
bool deleteRfidTagCallback(stdr_msgs::DeleteRfidTag::Request &req, stdr_msgs::DeleteRfidTag::Response &res)
Service callback for deleting an rfid tag from the environment.
bool addCO2SourceCallback(stdr_msgs::AddCO2Source::Request &req, stdr_msgs::AddCO2Source::Response &res)
Service callback for adding new CO2 source to the environment.
ros::NodeHandle _nh
A pointer to a MapServe object.
RegisterRobotServer _registerRobotServer
Action server for spawning robots.
ros::ServiceClient _spawnRobotClient
Action client for robot unloading.
RfidTagMap _rfidTagMap
An std::map that contains the CO2 sources existent in the environment.
std::map< std::string, stdr_msgs::RobotIndexedMsg > RobotMap
bool deleteRobot(std::string name, stdr_msgs::DeleteRobotResult *result)
Deletes a robot from simulator.
ros::ServiceServer _deleteRfidTagServiceServer
The rfid tag list publisher.
CO2SourceMap _CO2SourceMap
An std::map that contains the thermal sources existent in the environment.
ros::ServiceServer _deleteSoundSourceServiceServer
The sound source list publisher.
std::map< std::string, stdr_msgs::CO2Source >::iterator CO2SourceMapIt
ros::ServiceServer _loadMapService
Service server for loading maps from GUI.
RobotMap _robotMap
Index that shows the next robot id.
ros::Publisher _thermalSourceVectorPublisher
The addSoundSource srv server.
std::map< std::string, stdr_msgs::ThermalSource >::iterator ThermalSourceMapIt
ros::ServiceServer _addThermalSourceServiceServer
The deleteThermalSource srv server.
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 sp...
SoundSourceMap _soundSourceMap
Boost mutex for conflict avoidance.
bool addThermalSourceCallback(stdr_msgs::AddThermalSource::Request &req, stdr_msgs::AddThermalSource::Response &res)
Service callback for adding new thermal source to the environment.
ros::ServiceServer _addCO2SourceServiceServer
The deleteCO2Source srv server.
ros::ServiceServer _loadExternalMapService
Service server for moving robots.
ThermalSourceMap _thermalSourceMap
An std::map that contains the sound sources existent in the environment.
std::map< std::string, stdr_msgs::RfidTag >::iterator RfidTagMapIt
ros::ServiceServer _addRfidTagServiceServer
The deleteRfidTag srv server.
ros::ServiceClient _unloadRobotClient
Service server for loading maps from files.
int _id
An std::map that contains the rfid tags existent in the environment.
bool loadMapCallback(stdr_msgs::LoadMap::Request &req, stdr_msgs::LoadMap::Response &res)
Service callback for loading the map.
ros::ServiceServer _deleteThermalSourceServiceServer
The thermal source list publisher.
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.
void deleteRobotCallback(const stdr_msgs::DeleteRobotGoalConstPtr &goal)
Action callback for robot deletion.
bool addRfidTagCallback(stdr_msgs::AddRfidTag::Request &req, stdr_msgs::AddRfidTag::Response &res)
Service callback for adding new rfid tag to the environment.
Implements the STDR server functionalities.
ros::Publisher _soundSourceVectorPublisher
std::map< std::string, stdr_msgs::SoundSource >::iterator SoundSourceMapIt
bool deleteCO2SourceCallback(stdr_msgs::DeleteCO2Source::Request &req, stdr_msgs::DeleteCO2Source::Response &res)
Service callback for deleting a CO2 source from the environment.
actionlib::SimpleActionServer< stdr_msgs::RegisterRobotAction > RegisterRobotServer
ros::Publisher _sourceVectorPublisherRviz
The addRfidTag srv server.
boost::mutex _mut
Boost condition variable for conflicting avoidance.
actionlib::SimpleActionServer< stdr_msgs::SpawnRobotAction > SpawnRobotServer
boost::condition_variable _cond
A general Rviz publisher for all source types.
ros::ServiceServer _moveRobotService
Action server for registering robots.
void activateActionServers(void)
Initializes the spawn,delete,register action servers.
std::map< std::string, stdr_msgs::ThermalSource > ThermalSourceMap
std::map< std::string, stdr_msgs::RfidTag > RfidTagMap
ros::Publisher _robotsPublisher
Action client for robot spawning.
DeleteRobotServer _deleteRobotServer
An std::map that contains the robots based on theor frame_id.
boost::shared_ptr< MapServer > MapServerPtr
std::map< std::string, stdr_msgs::CO2Source > CO2SourceMap
actionlib::SimpleActionServer< stdr_msgs::DeleteRobotAction > DeleteRobotServer
Server(int argc, char **argv)
Default constructor.