NODE kb_interface
See also
see also CLASS kb_tools
services for read/write on the rosplan kb
This node exposes, as ROS service, some important functionalities for performing the replanning.
Its role is mostly to hide the specificiy of some corrections on the knowledge base, due to the structure of the PDDL model in use for this project.
- Authors
Francesco Ganci
- Version
v1.0
Note
It supports the develop mode: waitkey, develop print
Defines
-
NODE_NAME
-
LOGSQUARE(str)
-
OUTLABEL
-
TLOG(msg)
-
TWARN(msg)
-
TERR(msg)
-
DEVELOP_MODE
-
DEVELOP_PRINT
-
WTLOG(msg)
-
WTWARN(msg)
-
WTERR(msg)
-
DEVELOP_WAIKEY
-
WAITKEY
-
SERVICE_REPLAN
-
SERVICE_UPDATE_GOAL
-
LANDMARK_REPLAN
-
LANDMARK_COLLECT
-
LANDMARK_SOLVE
Functions
-
void shut_msg(int sig)
-
int main(int argc, char *argv[])
-
class predicate_instance
representation of a predicate
This simple data structure is used for handling the predicates in a more convenient way.
- Todo:
this class should be better designed, or, even better, included into the currently available framework for the knowledge base.
-
class kb_interface : private kb_tools
Implementation of the node kb_interface as class.
The node provides a general service for replanning, as well as some utilities taking into account the particularities of the landmarks with respect to the structure of the PDDL model.
- Todo:
the node should read the waypoints from the PDDL model; currently, the waypoints are hardcoded in the constructor.
- Todo:
the topology of the problem can be better handled by this node.
Public Functions
-
inline kb_interface()
kb_interface node constructor
The constructor allocates the most relevant predicates of the PDDL model and their default values. These values are used when a landmark, or a replanning, is required by another node.
- Todo:
the node should read the waypoints from the PDDL model; currently, the waypoints are hardcoded in the constructor.
-
inline bool cbk_replan(std_srvs::Empty::Request &req, std_srvs::Empty::Response &res)
implementation of the replan service
the service first of all restores the most relelvand values of the PDDL model inside the ontology, then adjusts the informations regarding the topological localisation in a way such that the only place explored is the one where the robot is currently.
- Parameters
request – (empty)
response – (empty)
-
inline bool cbk_update_goal(robocluedo_rosplan_msgs::UpdateGoal::Request &req, robocluedo_rosplan_msgs::UpdateGoal::Response &res)
implementation of service for updating goals
Purpose of this service is to create the proper conditions in order to apply one of the three available landmarks: REPLAN, COLLECT and SOLVE.
“REPLAN” simply sets the “dirty” flags in a way such that the plan, when found, is going to start with the (replan ) PDDL action. The localisation is not affected, or at least not by this node.
“COLLECT” causes the node to look for a still unexplored waypoint. if all the waypoints have been explored, the node refuses the request, otherwise it sets the first available waypoint. The command doesn’t allow to decide which waypoint the robot can explore: the waypoint is choosen automatically by this node.
“SOLVE” only sets the “dirty” flags as the “REPLAN” landmark does, but in a way such that the system has to necessairly call the PDDL action (solve ?wp) after moved to the center of the arena.
- Attention
the request is rejected with no effect on the knowledge base if the requested landark is not applicable. It could happen for instance when the robot has explored every single waypoint.
Note
in any case, the goal is cancelled, hence a failure in applying one unapplicable landmark requires to set again one more landmark.
- Parameters
request – it communicates the landmark to set
response –
Private Members
-
ros::NodeHandle nh
-
std::vector<predicate_instance> init_pred
a list of init predicates
-
std::vector<predicate_instance> goal_pred
a list of goal predicates
-
std::vector<std::string> wps
list of waypoints