Final Assignment  1.0
Research Track part 1 - Assignment 2 - RobEng A.A. 2020/2021
/position_defined

Services Back to services

SERVICE - /position_defined

Provided by:

Used by:

Semantic

The user can select only a position among the ones pre-defined in the node points_manager.py.

The server simply checks if the given point is contained or not in that set of targers.

See also
points_manager.py which are the allowed positions

Service code

SRV file

# service file name 'position_defined.srv'
# the position you want to check
geometry_msgs/Point position
---
# is it in the set?
bool defined

Set-up (Python)

from final_assignment.srv import position_defined, position_definedRequest, position_definedResponse
## === CLIENT SIDE
## name of the service 'position_defined'
name_position_defined = "/position_defined"
## call-point of the service 'position_defined'
srv_position_defined = None
# service 'position_defined'
rospy.loginfo( " [%s] getting service %s ...", node_name, name_position_defined )
rospy.wait_for_service( name_position_defined )
srv_position_defined = rospy.ServiceProxy( name_position_defined, position_defined )
rospy.loginfo( " [%s] service %s ... OK", node_name, name_position_defined )

How to use the service (Python)

Non blocking request. It cannot fail.

req = position_definedRequest( )
# req.position = Point(x, y, z)
res = srv_position_defined( req )
# res.defined