3 from bayesian_belief_networks.srv
import Query, QueryResponse
4 from bayesian_belief_networks.msg
import Result, Observation
14 rospy.loginfo(
'query = %s'%req.query)
15 for observation
in req.query:
16 kwds[observation.node] = observation.evidence
17 result = _bnn_object.query(**kwds)
18 rospy.loginfo(
'results = %s'%result)
21 for (node, value), prob
in result.items():
22 r = Result(node,value,prob)
24 res.results = sorted(res.results, key=
lambda x: x.node)
30 "call rospy.init_node() before build_ros_bbn() and call rospy.spin() after that" 31 _bnn_object = build_bbn(*args, **kwds)
32 rospy.Service(
'~query', Query, service_query)
def ros_build_bbn(args, kwds)