-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added scoring interface (topics and services)
- Loading branch information
Showing
15 changed files
with
216 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Changelog for package labrob_msgs | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
Forthcoming | ||
----------- | ||
* Added scoring interface (topics and services) | ||
* Contributors: fsuarez6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
cmake_minimum_required(VERSION 2.8.3) | ||
project(labrob_msgs) | ||
|
||
find_package(catkin REQUIRED COMPONENTS | ||
message_generation nav_msgs) | ||
|
||
add_service_files( | ||
FILES | ||
GetMapPercentage.srv | ||
) | ||
|
||
generate_messages(DEPENDENCIES nav_msgs std_msgs) | ||
|
||
catkin_package( | ||
CATKIN_DEPENDS | ||
message_runtime | ||
) | ||
|
||
|
||
include_directories( | ||
${catkin_INCLUDE_DIRS} | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0"?> | ||
<package> | ||
<name>labrob_msgs</name> | ||
<version>0.1.0</version> | ||
<description>The labrob_msgs package</description> | ||
|
||
<maintainer email="[email protected]">Francisco Suarez-Ruiz</maintainer> | ||
<license>BSD</license> | ||
|
||
<url type="website">http://www.romin.upm.es/wiki/</url> | ||
<url type="repository">https://github.com/fsuarez6/labrob</url> | ||
<author>Francisco Suarez-Ruiz</author> | ||
|
||
<buildtool_depend>catkin</buildtool_depend> | ||
<build_depend>nav_msgs</build_depend> | ||
<build_depend>message_generation</build_depend> | ||
|
||
<run_depend>nav_msgs</run_depend> | ||
<run_depend>message_runtime</run_depend> | ||
|
||
|
||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
nav_msgs/OccupancyGrid map | ||
--- | ||
float32 percentage_covered |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Changelog for package labrob_worlds | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
Forthcoming | ||
----------- | ||
* Added scoring interface (topics and services) | ||
* Contributors: fsuarez6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env python | ||
import rospy, math | ||
from labrob_msgs.srv import GetMapPercentage | ||
|
||
from nav_msgs.msg import OccupancyGrid | ||
|
||
class ChallengeMapServer: | ||
def __init__(self): | ||
rospy.init_node('challenge_map_server') | ||
|
||
# Initial values | ||
size_m2 = rospy.get_param('/map_size_m2', 400.0) | ||
resolution = rospy.get_param('/map_resolution', 0.05) | ||
self.size_map = size_m2/resolution | ||
|
||
# Advertise the service | ||
s = rospy.Service('get_percent_map_completed', GetMapPercentage, self.handle_map) | ||
|
||
rospy.loginfo('Challenge begun. Map size: %d squares' % int(self.size_map)); | ||
|
||
def handle_map(self, req): | ||
rospy.loginfo('Received map. Calculating Percentage Completed...'); | ||
|
||
n_squares_mapped = sum(1 for x in req.map.data if x >= 0) | ||
percentage = float(n_squares_mapped)/float(self.size_map) | ||
|
||
rospy.loginfo('Map Complete: '+str(100.0 * percentage)+'%') | ||
|
||
return percentage | ||
|
||
|
||
if __name__ == "__main__": | ||
ChallengeMapServer() | ||
rospy.spin() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env python | ||
|
||
from distutils.core import setup | ||
from catkin_pkg.python_setup import generate_distutils_setup | ||
|
||
# fetch values from package.xml | ||
setup_args = generate_distutils_setup( | ||
packages=['labrob_worlds'], | ||
package_dir={'': 'scripts'}) | ||
|
||
setup(**setup_args) |
Oops, something went wrong.