18 #include <boost/shared_ptr.hpp> 23 #include <geometry_msgs/Pose.h> 24 #include <asr_direct_search_manager/directSearchAction.h> 25 #include <dynamic_reconfigure/server.h> 27 #include <asr_direct_search_manager/DynamicParametersConfig.h> 46 asr_direct_search_manager::directSearchFeedback
feedback_;
47 asr_direct_search_manager::directSearchResult
result_;
54 nh_.
getParam(
"directSearchMode", directSearchMode);
57 if (directSearchMode == 1) {
59 std::string initializedGridFilePath;
60 nh_.
getParam(
"initializedGridFilePath", initializedGridFilePath);
61 ROS_INFO_STREAM(
"Initialized grid file path: " << initializedGridFilePath);
63 }
else if (directSearchMode == 2) {
65 std::string recordFilePath;
66 nh_.
getParam(
"recordFilePath", recordFilePath);
71 std::string gridFilePath;
72 nh_.
getParam(
"gridFilePath", gridFilePath);
77 directSearchHandlerPtr->initHandler();
84 boost::lock_guard<boost::mutex> guard(mtx_);
88 nh_.
setParam(
"clearVision", config.clearVision);
90 nh_.
setParam(
"directSearchMode", config.directSearchMode);
91 nh_.
setParam(
"distanceFunc", config.distanceFunc);
93 nh_.
setParam(
"reorderPosesByNBV", config.reorderPosesByNBV);
94 nh_.
setParam(
"reorderPosesByTSP", config.reorderPosesByTSP);
96 nh_.
setParam(
"viewCenterPositionDistanceThreshold", config.viewCenterPositionDistanceThreshold);
98 nh_.
setParam(
"filterMinimumNumberOfDeletedNormals", config.filterMinimumNumberOfDeletedNormals);
99 nh_.
setParam(
"filterIsPositionAllowed", config.filterIsPositionAllowed);
100 nh_.
setParam(
"concatApproxEqualsPoses", config.concatApproxEqualsPoses);
102 nh_.
setParam(
"concatRobotPosePositionDistanceThreshold", config.concatRobotPosePositionDistanceThreshold);
103 nh_.
setParam(
"concatRobotPoseOrientationRadDistanceThreshold", config.concatRobotPoseOrientationRadDistanceThreshold);
105 nh_.
setParam(
"gridFilePath", config.gridFilePath);
106 nh_.
setParam(
"initializedGridFilePath", config.initializedGridFilePath);
107 nh_.
setParam(
"recordFilePath", config.recordFilePath);
118 feedback_(), result_(), directSearchHandlerPtr(), mDynamicReconfigServer(nh_) {
124 mDynamicReconfigServer.setCallback(f);
130 result_.remainingPTUPoses = directSearchHandlerPtr->getRemainingPTUPoses();
131 result_.remainingRobotPoses = directSearchHandlerPtr->getRemainingRobotPoses();
132 result_.remainingPosesDistances = directSearchHandlerPtr->getRemainingPosesDistances();
133 result_.isNoPoseLeft = directSearchHandlerPtr->getIsNoPoseLeft();
134 result_.isSameRobotPoseAsBefore = directSearchHandlerPtr->getIsSameRobotPoseAsBefore();
135 result_.arePosesFromDemonstrationLeft = directSearchHandlerPtr->getArePosesFromDemonstrationLeft();
137 result_.filteredSearchedObjectTypesAndIds = directSearchHandlerPtr->getActualFilteredSearchedObjectTypesAndIds();
139 PosePtr actualRobotPose = directSearchHandlerPtr->getActualRobotPosePtr();
140 if (actualRobotPose) {
141 result_.goalRobotPose = *actualRobotPose;
143 result_.goalRobotPose = geometry_msgs::Pose();
146 PosePtr actualCameraPose = directSearchHandlerPtr->getActualCameraPosePtr();
147 if (actualCameraPose) {
148 result_.goalCameraPose = *actualCameraPose;
150 result_.goalCameraPose = geometry_msgs::Pose();
153 PtuTuplePtr actualPTU = directSearchHandlerPtr->getActualPtuPtr();
155 result_.pan = actualPTU->getPan();
156 result_.tilt = actualPTU->getTilt();
166 void executeCB(
const asr_direct_search_manager::directSearchGoalConstPtr &
goal) {
168 boost::lock_guard<boost::mutex> guard(mtx_);
170 const std::string &
command = goal->command;
172 if (command ==
"Reset") {
173 success &= directSearchHandlerPtr->resetHandler();
174 }
else if(command ==
"BackToInitial") {
175 success &= directSearchHandlerPtr->backToInitial(goal->searchedObjectTypesAndIds);
176 }
else if(command ==
"GetGoalCameraPose") {
177 success &= directSearchHandlerPtr->getNextRobotState(goal->searchedObjectTypesAndIds);
196 int main(
int argc,
char** argv) {
197 ros::init(argc, argv,
"asr_direct_search_manager");
void checkParametersFromOtherNode()
int main(int argc, char **argv)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
std::string getName(void *handle)
actionlib::SimpleActionServer< asr_direct_search_manager::directSearchAction > as_
void setSucceeded(const Result &result=Result(), const std::string &text=std::string(""))
DirectSearchHandlerPtr directSearchHandlerPtr
ROSCPP_DECL void spin(Spinner &spinner)
asr_direct_search_manager::directSearchResult result_
static void resetInstance()
ROSLIB_DECL std::string command(const std::string &cmd)
asr_direct_search_manager::directSearchFeedback feedback_
#define ROS_DEBUG_STREAM(args)
void setAborted(const Result &result=Result(), const std::string &text=std::string(""))
#define ROS_INFO_STREAM(args)
dynamic_reconfigure::Server< asr_direct_search_manager::DynamicParametersConfig > mDynamicReconfigServer
boost::shared_ptr< DirectSearchHandler > DirectSearchHandlerPtr
bool getParam(const std::string &key, std::string &s) const
void executeCB(const asr_direct_search_manager::directSearchGoalConstPtr &goal)
void dynamicReconfigureCallback(asr_direct_search_manager::DynamicParametersConfig &config, uint32_t level)
void setParam(const std::string &key, const XmlRpc::XmlRpcValue &v) const