Skip to content

Commit 2e172e1

Browse files
committed
Improved ROS package structure.
1 parent 40b49d9 commit 2e172e1

25 files changed

+242
-329
lines changed

CMakeLists.txt

Lines changed: 71 additions & 200 deletions
Original file line numberDiff line numberDiff line change
@@ -1,226 +1,97 @@
1-
cmake_minimum_required(VERSION 3.0.2)
1+
cmake_minimum_required(VERSION 3.16.3)
22
project(cuzk_tools)
3-
#a
4-
## Compile as C++11, supported in ROS Kinetic and newer
5-
# add_compile_options(-std=c++11)
63

7-
## Find catkin macros and libraries
8-
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
9-
## is used, also find other catkin packages
104
find_package(catkin REQUIRED COMPONENTS
11-
rospy
12-
sensor_msgs
13-
geometry_msgs
145
geographic_msgs
15-
std_msgs
16-
visualization_msgs
6+
geometry_msgs
177
jsk_recognition_msgs
188
message_generation
9+
sensor_msgs
10+
std_msgs
11+
visualization_msgs
1912
)
2013

21-
## System dependencies are found with CMake's conventions
22-
# find_package(Boost REQUIRED COMPONENTS system)
23-
14+
catkin_python_setup()
2415

25-
## Uncomment this if the package has a setup.py. This macro ensures
26-
## modules and global scripts declared therein get installed
27-
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
28-
# catkin_python_setup()
29-
30-
################################################
31-
## Declare ROS messages, services and actions ##
32-
################################################
33-
34-
## To declare and build messages, services or actions from within this
35-
## package, follow these steps:
36-
## * Let MSG_DEP_SET be the set of packages whose message types you use in
37-
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
38-
## * In the file package.xml:
39-
## * add a build_depend tag for "message_generation"
40-
## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET
41-
## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
42-
## but can be declared for certainty nonetheless:
43-
## * add a exec_depend tag for "message_runtime"
44-
## * In this file (CMakeLists.txt):
45-
## * add "message_generation" and every package in MSG_DEP_SET to
46-
## find_package(catkin REQUIRED COMPONENTS ...)
47-
## * add "message_runtime" and every package in MSG_DEP_SET to
48-
## catkin_package(CATKIN_DEPENDS ...)
49-
## * uncomment the add_*_files sections below as needed
50-
## and list every .msg/.srv/.action file to be processed
51-
## * uncomment the generate_messages entry below
52-
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
53-
54-
## Generate messages in the 'msg' folder
55-
add_message_files(
56-
FILES
57-
Polygons.msg
58-
LineString.msg
59-
LineStringArray.msg
60-
OrtoImage.msg
61-
PointArray.msg
62-
Topography.msg
63-
TopographyCategory.msg
16+
add_message_files(FILES
17+
LineString.msg
18+
LineStringArray.msg
19+
OrtoImage.msg
20+
PointArray.msg
21+
Polygons.msg
22+
Topography.msg
23+
TopographyCategory.msg
6424
)
6525

66-
## Generate services in the 'srv' folder
67-
add_service_files(
68-
FILES
69-
ElevationGet.srv
70-
ElevationPublish.srv
71-
GetTopography.srv
72-
MarkerGet.srv
73-
PointElevationGet.srv
74-
GeoPointElevationGet.srv
75-
ElevationSetTF.srv
76-
)
77-
78-
## Generate actions in the 'action' folder
79-
# add_action_files(
80-
# FILES
81-
# Action1.action
82-
# Action2.action
83-
# )
84-
85-
## Generate added messages and services with any dependencies listed here
86-
generate_messages(
87-
DEPENDENCIES
88-
sensor_msgs
89-
std_msgs
90-
visualization_msgs
91-
geometry_msgs
92-
geographic_msgs
93-
jsk_recognition_msgs
26+
add_service_files(FILES
27+
ElevationGet.srv
28+
ElevationPublish.srv
29+
ElevationSetTF.srv
30+
GeoPointElevationGet.srv
31+
GetTopography.srv
32+
MarkerGet.srv
33+
PointElevationGet.srv
9434
)
9535

96-
################################################
97-
## Declare ROS dynamic reconfigure parameters ##
98-
################################################
99-
100-
## To declare and build dynamic reconfigure parameters within this
101-
## package, follow these steps:
102-
## * In the file package.xml:
103-
## * add a build_depend and a exec_depend tag for "dynamic_reconfigure"
104-
## * In this file (CMakeLists.txt):
105-
## * add "dynamic_reconfigure" to
106-
## find_package(catkin REQUIRED COMPONENTS ...)
107-
## * uncomment the "generate_dynamic_reconfigure_options" section below
108-
## and list every .cfg file to be processed
109-
110-
## Generate dynamic reconfigure parameters in the 'cfg' folder
111-
# generate_dynamic_reconfigure_options(
112-
# cfg/DynReconf1.cfg
113-
# cfg/DynReconf2.cfg
114-
# )
36+
generate_messages(DEPENDENCIES
37+
geographic_msgs
38+
geometry_msgs
39+
jsk_recognition_msgs
40+
sensor_msgs
41+
std_msgs
42+
visualization_msgs
43+
)
11544

116-
###################################
117-
## catkin specific configuration ##
118-
###################################
119-
## The catkin_package macro generates cmake config files for your package
120-
## Declare things to be passed to dependent projects
121-
## INCLUDE_DIRS: uncomment this if your package contains header files
122-
## LIBRARIES: libraries you create in this project that dependent projects also need
123-
## CATKIN_DEPENDS: catkin_packages dependent projects also need
124-
## DEPENDS: system dependencies of this project that dependent projects also need
12545
catkin_package(
126-
# INCLUDE_DIRS include
127-
# LIBRARIES elevation
128-
# CATKIN_DEPENDS rospy sensor_msgs std_msgs
129-
# DEPENDS system_lib
46+
CATKIN_DEPENDS
47+
geographic_msgs
48+
geometry_msgs
49+
jsk_recognition_msgs
50+
message_runtime
51+
sensor_msgs
52+
std_msgs
53+
visualization_msgs
13054
)
13155

132-
###########
133-
## Build ##
134-
###########
135-
136-
## Specify additional locations of header files
137-
## Your package locations should be listed before other locations
138-
include_directories(
139-
# include
140-
${catkin_INCLUDE_DIRS}
56+
catkin_install_python(PROGRAMS
57+
nodes/elevation
58+
nodes/gpkg_parser
59+
nodes/marker_pub
60+
nodes/orto2mesh
61+
nodes/pcd2mesh
62+
nodes/pose_elevation_srv
63+
nodes/pose_elevation_tf
64+
nodes/topography
65+
nodes/viz_map
66+
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
14167
)
14268

143-
## Declare a C++ library
144-
# add_library(${PROJECT_NAME}
145-
# src/${PROJECT_NAME}/elevation.cpp
146-
# )
147-
148-
## Add cmake target dependencies of the library
149-
## as an example, code may need to be generated before libraries
150-
## either from message generation or dynamic reconfigure
151-
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
152-
153-
## Declare a C++ executable
154-
## With catkin_make all packages are built within a single CMake context
155-
## The recommended prefix ensures that target names across packages don't collide
156-
# add_executable(${PROJECT_NAME}_node src/elevation_node.cpp)
157-
158-
## Rename C++ executable without prefix
159-
## The above recommended prefix causes long target names, the following renames the
160-
## target back to the shorter version for ease of user use
161-
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
162-
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")
163-
164-
## Add cmake target dependencies of the executable
165-
## same as for the library above
166-
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
167-
168-
## Specify libraries to link a library or executable target against
169-
# target_link_libraries(${PROJECT_NAME}_node
170-
# ${catkin_LIBRARIES}
171-
# )
172-
173-
#############
174-
## Install ##
175-
#############
176-
177-
# all install targets should use catkin DESTINATION variables
178-
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
179-
180-
## Mark executable scripts (Python etc.) for installation
181-
## in contrast to setup.py, you can choose the destination
182-
# catkin_install_python(PROGRAMS
183-
# scripts/my_python_script
184-
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
185-
# )
69+
install(DIRECTORY
70+
config/
71+
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/config
72+
)
18673

187-
## Mark executables for installation
188-
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html
189-
# install(TARGETS ${PROJECT_NAME}_node
190-
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
191-
# )
74+
install(DIRECTORY
75+
launch/
76+
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
77+
)
19278

193-
## Mark libraries for installation
194-
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
195-
# install(TARGETS ${PROJECT_NAME}
196-
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
197-
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
198-
# RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
199-
# )
79+
install(DIRECTORY
80+
rviz/
81+
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/rviz
82+
)
20083

201-
## Mark cpp header files for installation
202-
# install(DIRECTORY include/${PROJECT_NAME}/
203-
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
204-
# FILES_MATCHING PATTERN "*.h"
205-
# PATTERN ".svn" EXCLUDE
206-
# )
84+
if (CATKIN_ENABLE_TESTING)
85+
find_package(roslint REQUIRED)
86+
find_package(roslaunch REQUIRED)
20787

208-
## Mark other files for installation (e.g. launch and bag files, etc.)
209-
# install(FILES
210-
# # myfile1
211-
# # myfile2
212-
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
213-
# )
88+
roslint_custom(catkin_lint "-W2" .)
21489

215-
#############
216-
## Testing ##
217-
#############
90+
# Run roslint on Python sources
91+
# file(GLOB_RECURSE python_files nodes/*.py src/${PROJECT_NAME}/*.py setup.py)
92+
# roslint_python("${python_files}")
21893

219-
## Add gtest based cpp test target and link libraries
220-
# catkin_add_gtest(${PROJECT_NAME}-test test/test_elevation.cpp)
221-
# if(TARGET ${PROJECT_NAME}-test)
222-
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
223-
# endif()
94+
roslint_add_test()
22495

225-
## Add folders to be run by python nosetests
226-
# catkin_add_nosetests(test)
96+
roslaunch_add_file_check(launch IGNORE_UNSET_ARGS)
97+
endif()

README.md

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The latter is also used in the elevation service provided by this node.
5656
`roslaunch cuzk_tools elevation.launch`
5757

5858
2. Call the elevation service:
59-
```
59+
```bash
6060
rosservice call /elevation_publish "point: {x: 14.0, y: 50.0, z: 0.0}
6161
radius: {data: 300.0}
6262
sjtsk: {data: false}
@@ -72,7 +72,7 @@ where **x** is the **longitude** (!!!), **y** is the **latitude** (!!!) in WGS84
7272

7373
#### Example Service Calls
7474

75-
```
75+
```bash
7676
rosservice call /elevation_get "point: {x: 14.0, y: 50.0, z: 0.0}
7777
radius: {data: 400.0}
7878
sjtsk: {data: false}
@@ -81,7 +81,7 @@ rosservice call /elevation_get "point: {x: 14.0, y: 50.0, z: 0.0}
8181
wgs: {data: false}"
8282
```
8383

84-
```
84+
```bash
8585
rosservice call /elevation_publish "point: {x: 14.0, y: 50.0, z: 0.0}
8686
radius: {data: 400.0}
8787
sjtsk: {data: false}
@@ -90,7 +90,7 @@ rosservice call /elevation_publish "point: {x: 14.0, y: 50.0, z: 0.0}
9090
wgs: {data: true}"
9191
```
9292

93-
```
93+
```bash
9494
rosservice call /geopoint_elevation_get "point:
9595
latitude: 50.0
9696
longitude: 14.0
@@ -99,7 +99,7 @@ frame:
9999
data: 'wgs'"
100100
```
101101

102-
```
102+
```bash
103103
rosservice call /point_elevation_get "point:
104104
x: 21.0
105105
y: 42.0
@@ -108,7 +108,7 @@ frame:
108108
data: 'utm_local'"
109109
```
110110

111-
```
111+
```bash
112112
rosservice call /set_elevation_tf "frame:
113113
data: 'base_link'"
114114
```
@@ -134,7 +134,8 @@ The data is stored in a single file, containing the entirety of Czechia (with th
134134
6. Launch `roslaunch cuzk_tools topography.launch`
135135

136136
7. Call topography service:
137-
```rosservice call /topography "point:
137+
```bash
138+
rosservice call /topography "point:
138139
x: 14.0
139140
y: 50.0
140141
z: 0.0
@@ -153,6 +154,28 @@ As with the elevation node, the input point is in WGS coordinates (x=long (!!!),
153154

154155
If you are looking to combine both visualizations (i.e. elevation & ortofoto mesh with topography markers) you can run `elev_topo.launch`. You then call the `elevation_publish` and `topography` services as indicated above and both visualizations should appear in rviz.
155156

157+
Example commands:
158+
159+
```bash
160+
rosservice call /topography "point:
161+
x: 16.9610800
162+
y: 49.3802000
163+
z: 0.0
164+
radius:
165+
data: 500.0
166+
frame:
167+
data: 'utm_local'"
168+
169+
rosservice call /elevation_publish "point: {x: 16.9610800, y: 49.380200, z: 500.0}
170+
radius: {data: 500.0}
171+
sjtsk: {data: false}
172+
utm: {data: false}
173+
utm_local: {data: true}
174+
wgs: {data: false}"
175+
176+
rosrun tf2_ros static_transform_publisher 0 0 0 0 0 0 base_link_fake base_link
177+
```
178+
156179
### Remarks
157180
- The topography node produces a GeographicMap for the ZABAGED data. It should be relatively simple to use a different GeographicMap source together with the visualization (e.g. OSM data). The categories that I use with ZABAGED (I reduce their 139 categories to 11 custom ones) should overlap well with OSM.
158181

0 commit comments

Comments
 (0)