Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion opennav_coverage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ ament_target_dependencies(${library_name}
${dependencies}
)

target_link_libraries(${library_name} Fields2Cover)
target_link_libraries(${library_name}
Fields2Cover
gdal)


add_executable(${executable_name}
src/main.cpp
Expand Down
2 changes: 1 addition & 1 deletion opennav_coverage_demo/launch/coverage_demo_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def generate_launch_description():
arguments=[
'-entity', 'tb3',
'-file', sdf,
'-x', '5.0', '-y', '5.0', '-z', '0.10',
'-x', '0.5', '-y', '10.0', '-z', '0.10',
'-R', '0.0', '-P', '0.0', '-Y', '0.0'])

# start the visualization
Expand Down
18 changes: 15 additions & 3 deletions opennav_coverage_demo/opennav_coverage_demo/demo_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def toPolygon(self, field):
poly.points.append(pt)
return poly

def navigateCoverage(self, field):
def navigateCoverage(self, field, obstacle):
"""Send a `NavToPose` action request."""
print("Waiting for 'NavigateCompleteCoverage' action server")
while not self.coverage_client.wait_for_server(timeout_sec=1.0):
Expand All @@ -68,6 +68,10 @@ def navigateCoverage(self, field):
goal_msg.frame_id = 'map'
goal_msg.polygons.append(self.toPolygon(field))

if len(obstacle)>0:
for obs in obstacle:
goal_msg.polygons.append(self.toPolygon(obs))

print('Navigating to with field of size: ' + str(len(field)) + '...')
send_goal_future = self.coverage_client.send_goal_async(goal_msg,
self._feedbackCallback)
Expand Down Expand Up @@ -146,8 +150,16 @@ def main():
navigator.startup()

# Some example field
field = [[5.0, 5.0], [5.0, 15.0], [15.0, 15.0], [10.0, 5.0], [5.0, 5.0]]
navigator.navigateCoverage(field)
# field = [[5.0, 5.0], [5.0, 15.0], [15.0, 15.0], [10.0, 5.0], [5.0, 5.0]]
# obstacle = [
# [[10.0, 10.0], [10.0, 13.0], [13.0, 13.0], [13.0, 10.0], [10.0, 10.0]],
# [[8.0,8.0],[8.0,9.0],[9.0,9.0],[9.0,9.0], [8.0,8.0]]
# ]
field = [[2.9, 20.5], [2.3, 18.8], [2.2, 17.4], [1.9, 15.6], [1.4, 13.7], [1.0, 12.1], [0.0, 10.8], [0.5, 10.0], [1.5, 9.8], [2.5, 9.6], [3.5, 9.2], [4.1, 8.1], [4.0, 7.0], [3.9, 6.0], [4.3, 5.8], [5.2, 6.0], [6.6, 5.8], [8.2, 5.7], [9.8, 5.5], [11.5, 5.3], [13.0, 5.0], [14.2, 5.2], [14.1, 6.1], [14.3, 7.5], [14.8, 8.6], [15.9, 9.0], [16.9, 8.5], [17.7, 8.1], [18.2, 7.1], [18.1, 6.0], [18.2, 4.8], [19.0, 4.0], [20.3, 3.5], [21.9, 3.3], [23.6, 3.3], [25.3, 3.0], [27.1, 2.7], [29.0, 2.6], [30.9, 2.5], [32.8, 2.2], [34.7, 2.0], [36.8, 1.7], [38.8, 1.4], [40.8, 1.3], [42.9, 1.2], [44.9, 0.9], [47.0, 0.7], [49.2, 0.5], [51.2, 0.3], [53.1, 0.1], [54.8, 0.5], [56.0, 1.5], [56.6, 2.9], [58.1, 3.9], [59.6, 3.6], [60.3, 2.6], [60.4, 1.3], [60.9, 0.8], [62.6, 0.7], [64.5, 0.3], [66.3, 0.0], [67.9, 0.0], [68.6, 0.5], [68.7, 2.1], [68.9, 4.1], [69.6, 6.0], [71.1, 6.4], [71.8, 6.9], [71.7, 8.3], [71.5, 10.2], [71.9, 11.9], [72.1, 13.6], [71.7, 14.2], [70.5, 14.6], [69.8, 15.8], [69.5, 16.8], [68.7, 17.5], [67.2, 17.4], [65.2, 17.2], [63.9, 16.9], [63.2, 15.5], [62.7, 13.6], [61.4, 12.0], [59.6, 11.0], [57.6, 10.7], [55.6, 10.9], [53.6, 11.1], [51.7, 11.2], [49.7, 11.3], [47.7, 11.5], [45.8, 12.0], [44.7, 13.6], [44.7, 15.3], [44.7, 17.1], [43.8, 17.9], [42.0, 18.0], [40.1, 18.1], [37.8, 18.3], [35.7, 18.6], [34.0, 18.8], [33.4, 18.3], [33.2, 16.6], [32.6, 14.8], [30.8, 13.6], [28.7, 13.3], [26.7, 13.6], [24.7, 14.2], [22.7, 14.6], [20.8, 14.7], [18.8, 14.7], [17.2, 15.6], [15.9, 16.6], [15.1, 18.0], [14.7, 19.6], [14.6, 21.2], [14.3, 22.6], [13.5, 24.3], [13.4, 26.4], [13.3, 28.2], [12.3, 29.0], [10.4, 29.5], [8.3, 29.7], [6.1, 29.6], [4.2, 29.5], [2.8, 29.1], [2.6, 27.7], [2.5, 25.8], [2.4, 24.0], [2.2, 22.3], [2.9, 20.5]]

obstacle = [[[36.7, 6.2], [36.7, 6.2], [36.8, 6.2], [38.0, 5.9], [39.5, 5.7], [41.0, 5.5], [42.5, 5.3], [43.9, 5.1], [44.6, 5.3], [44.8, 6.3], [44.8, 7.7], [44.9, 9.1], [44.8, 10.4], [43.9, 11.1], [42.5, 11.5], [40.8, 12.0], [39.2, 12.2], [37.7, 12.2], [36.7, 11.8], [36.1, 10.5], [35.8, 9.2], [35.7, 7.6], [35.9, 6.4], [36.4, 6.2], [36.7, 6.2]]]

navigator.navigateCoverage(field, obstacle)

i = 0
while not navigator.isTaskComplete():
Expand Down
3 changes: 2 additions & 1 deletion opennav_row_coverage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ ament_target_dependencies(${library_name}
#and grab the vendored TINYXML2_LIBRARY too
target_link_libraries(${library_name}
Fields2Cover
tinyxml2::tinyxml2)
tinyxml2::tinyxml2
gdal)

add_executable(${executable_name}
src/main.cpp
Expand Down