in simulation_ws/src/aws_robomaker_simulation_common/nodes/route_manager.py [0:0]
def get_next(self):
"""
Get next goal.
Scan the map for a valid goal.
Convert to world coordinates and wraps as a Pose
to be consumed by route manager.
Args
----
Returns
-------
Pose:
{
'position': {
'x': double
'y': double
'z': double
}
'orientation': {
'x': double
'y': double
'z': double
'w': double
}
}
"""
z_world_floor = 0.
euler_orientation = [0., 0., 0.]
rospy.loginfo('Searching for a valid goal')
timeout_iter = 100
iteration = 0
while iteration < timeout_iter:
_x = random.randint(0, self.meta_data.width - 1)
_y = random.randint(0, self.meta_data.height - 1)
_row_id = self.ravel_index(_x, _y)
if self.occupancy_data.data[_row_id] == 0 and self.check_noise(
_x, _y, row_id=_row_id):
x_world, y_world = self.grid_to_world_2d(_x, _y)
rospy.loginfo('Valid goal found!')
return self._create_pos(
x_world, y_world, z_world_floor, *euler_orientation)
rospy.logerr('Could not find a valid goal in the world. Check that \
your occupancy map has Trinary value representation and is not \
visually noisy/incorrect')
return None