Skip to content

Commit bf97e7a

Browse files
Add files via upload
1 parent 3b5d281 commit bf97e7a

33 files changed

+909
-0
lines changed

CMakeLists.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
cmake_minimum_required(VERSION 3.0.2)
2+
project(grid_mapping)
3+
4+
## Find catkin and any catkin packages
5+
find_package(catkin REQUIRED COMPONENTS rospy std_msgs )
6+
7+
## Declare a catkin package
8+
catkin_package()
9+
10+
# Install python scripts
11+
catkin_install_python(PROGRAMS scripts/create_from_rosbag.py
12+
scripts/message_handler.py
13+
scripts/utils.py
14+
scripts/grid_map.py
15+
scripts/bresenham.py
16+
scripts/rtime_gmapping_node.py
17+
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
18+
)
19+
20+
## Build talker and listener
21+
include_directories(include ${catkin_INCLUDE_DIRS})

bagfiles/house.bag

22.8 MB
Binary file not shown.

bagfiles/stage_1.bag

1.15 MB
Binary file not shown.

bagfiles/stage_2.bag

2.5 MB
Binary file not shown.

bagfiles/stage_4.bag

6.1 MB
Binary file not shown.

bagfiles/world.bag

5.81 MB
Binary file not shown.

maps/house.png

345 KB
Loading

maps/house_compared.png

318 KB
Loading

maps/house_grid_map.png

80 KB
Loading

maps/house_grid_map_mle.png

75.7 KB
Loading

maps/stage_4.png

97 KB
Loading

maps/stage_4_compared.png

163 KB
Loading

maps/stage_4_grid_map.png

22 KB
Loading

maps/stage_4_grid_map_mle.png

15.5 KB
Loading

maps/world.png

62 KB
Loading

maps/world_compared.png

88.9 KB
Loading

maps/world_grid_map.png

48.5 KB
Loading

maps/world_grid_map_mle.png

46.7 KB
Loading

package.xml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?xml version="1.0"?>
2+
<package format="2">
3+
<name>grid_mapping</name>
4+
<version>0.0.0</version>
5+
<description>The grid_mapping package</description>
6+
7+
<!-- One maintainer tag required, multiple allowed, one person per tag -->
8+
<!-- Example: -->
9+
<!-- <maintainer email="[email protected]">Jane Doe</maintainer> -->
10+
<maintainer email="[email protected]">maestro</maintainer>
11+
12+
13+
<!-- One license tag required, multiple allowed, one license per tag -->
14+
<!-- Commonly used license strings: -->
15+
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
16+
<license>TODO</license>
17+
18+
19+
<!-- Url tags are optional, but multiple are allowed, one per tag -->
20+
<!-- Optional attribute type can be: website, bugtracker, or repository -->
21+
<!-- Example: -->
22+
<!-- <url type="website">http://wiki.ros.org/grid_mapping</url> -->
23+
24+
25+
<!-- Author tags are optional, multiple are allowed, one per tag -->
26+
<!-- Authors do not have to be maintainers, but could be -->
27+
<!-- Example: -->
28+
<!-- <author email="[email protected]">Jane Doe</author> -->
29+
30+
31+
<!-- The *depend tags are used to specify dependencies -->
32+
<!-- Dependencies can be catkin packages or system dependencies -->
33+
<!-- Examples: -->
34+
<!-- Use depend as a shortcut for packages that are both build and exec dependencies -->
35+
<!-- <depend>roscpp</depend> -->
36+
<!-- Note that this is equivalent to the following: -->
37+
<!-- <build_depend>roscpp</build_depend> -->
38+
<!-- <exec_depend>roscpp</exec_depend> -->
39+
<!-- Use build_depend for packages you need at compile time: -->
40+
<!-- <build_depend>message_generation</build_depend> -->
41+
<!-- Use build_export_depend for packages you need in order to build against this package: -->
42+
<!-- <build_export_depend>message_generation</build_export_depend> -->
43+
<!-- Use buildtool_depend for build tool packages: -->
44+
<!-- <buildtool_depend>catkin</buildtool_depend> -->
45+
<!-- Use exec_depend for packages you need at runtime: -->
46+
<!-- <exec_depend>message_runtime</exec_depend> -->
47+
<!-- Use test_depend for packages you need only for testing: -->
48+
<!-- <test_depend>gtest</test_depend> -->
49+
<!-- Use doc_depend for packages you need only for building documentation: -->
50+
<!-- <doc_depend>doxygen</doc_depend> -->
51+
<buildtool_depend>catkin</buildtool_depend>
52+
<build_depend>rospy</build_depend>
53+
<build_depend>std_msgs</build_depend>
54+
<build_export_depend>rospy</build_export_depend>
55+
<build_export_depend>std_msgs</build_export_depend>
56+
<exec_depend>rospy</exec_depend>
57+
<exec_depend>std_msgs</exec_depend>
58+
59+
60+
<!-- The export tag contains other, unspecified, tags -->
61+
<export>
62+
<!-- Other tools can request additional information be placed here -->
63+
64+
</export>
65+
</package>
Binary file not shown.
Binary file not shown.
Binary file not shown.
808 Bytes
Binary file not shown.
4.25 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
1.95 KB
Binary file not shown.

scripts/bresenham.py

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env python
2+
3+
import numpy as np
4+
5+
def bresenham(gridMap, x1, y1, x2, y2):
6+
"""
7+
Bresenham's line drawing algorithm - working for all 4 quadrants!
8+
"""
9+
10+
# Output pixels
11+
X_bres = []
12+
Y_bres = []
13+
14+
x = x1
15+
y = y1
16+
17+
delta_x = np.abs(x2 - x1)
18+
delta_y = np.abs(y2 - y1)
19+
20+
s_x = np.sign(x2 - x1)
21+
s_y = np.sign(y2 - y1)
22+
23+
if delta_y > delta_x:
24+
25+
delta_x, delta_y = delta_y, delta_x
26+
interchange = True
27+
28+
else:
29+
30+
interchange = False
31+
32+
A = 2 * delta_y
33+
B = 2 * (delta_y - delta_x)
34+
E = 2 * delta_y - delta_x
35+
36+
# mark output pixels
37+
X_bres.append(x)
38+
Y_bres.append(y)
39+
40+
# point (x2,y2) must not be included
41+
for i in range(1, delta_x):
42+
43+
if E < 0:
44+
45+
if interchange:
46+
47+
y += s_y
48+
49+
else:
50+
51+
x += s_x
52+
53+
E = E + A
54+
55+
else:
56+
57+
y += s_y
58+
x += s_x
59+
E = E + B
60+
61+
# mark output pixels
62+
X_bres.append(x)
63+
Y_bres.append(y)
64+
65+
return zip(X_bres, Y_bres)

0 commit comments

Comments
 (0)