Skip to content

Commit 43fdd1f

Browse files
peci1mjcarroll
andauthored
Fix develspace build and launch in --link-devel builds (catkin tools) (#771)
* Fix develspace build and launch * Fix Common_TEST path comparison Signed-off-by: Michael Carroll <[email protected]> * Add statistics environment variable Signed-off-by: Michael Carroll <[email protected]> * Fix env scripts * Fix searching the path to preinstalled worlds in devel space Co-authored-by: Michael Carroll <[email protected]>
1 parent 6bd98e3 commit 43fdd1f

15 files changed

+86
-53
lines changed

ign_migration_scripts/CMakeLists.txt

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ find_package(catkin REQUIRED)
55

66
catkin_package()
77

8-
catkin_add_env_hooks(ign SHELLS bash
9-
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/env-hooks)
10-
catkin_add_env_hooks(ign SHELLS zsh
8+
catkin_add_env_hooks(29.ign_migration_scripts SHELLS bash zsh
119
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/env-hooks)
1210
install(DIRECTORY launch
1311
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Export Ignition environment variables
2+
3+
@[if INSTALLSPACE]@
4+
export IGN_LAUNCH_CONFIG_PATH=@(CMAKE_INSTALL_PREFIX)/@(CATKIN_PACKAGE_SHARE_DESTINATION)/launch
5+
export IGN_GAZEBO_RESOURCE_PATH=@(CMAKE_INSTALL_PREFIX)/@(CATKIN_PACKAGE_SHARE_DESTINATION)/worlds:${IGN_GAZEBO_RESOURCE_PATH}
6+
@[else]@
7+
export IGN_LAUNCH_CONFIG_PATH=@(CMAKE_CURRENT_SOURCE_DIR)/launch
8+
export IGN_GAZEBO_RESOURCE_PATH=@(CMAKE_CURRENT_SOURCE_DIR)/worlds:${IGN_GAZEBO_RESOURCE_PATH}
9+
@[end if]@
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Export Ignition environment variables
2+
3+
@[if INSTALLSPACE]@
4+
export IGN_LAUNCH_CONFIG_PATH=@(CMAKE_INSTALL_PREFIX)/@(CATKIN_PACKAGE_SHARE_DESTINATION)/launch
5+
export IGN_GAZEBO_RESOURCE_PATH=@(CMAKE_INSTALL_PREFIX)/@(CATKIN_PACKAGE_SHARE_DESTINATION)/worlds:${IGN_GAZEBO_RESOURCE_PATH}
6+
@[else]@
7+
export IGN_LAUNCH_CONFIG_PATH=@(CMAKE_CURRENT_SOURCE_DIR)/launch
8+
export IGN_GAZEBO_RESOURCE_PATH=@(CMAKE_CURRENT_SOURCE_DIR)/worlds:${IGN_GAZEBO_RESOURCE_PATH}
9+
@[end if]@

ign_migration_scripts/env-hooks/ign.bash.in

-6
This file was deleted.

ign_migration_scripts/env-hooks/ign.zsh.in

-6
This file was deleted.

subt_ign/CMakeLists.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ set (SUBT_VERSION_FULL
1515

1616
find_package(catkin REQUIRED
1717
COMPONENTS
18+
roslib
1819
rostest
1920
subt_rf_interface
2021
subt_communication_model
@@ -52,6 +53,7 @@ include_directories(
5253
include
5354
${catkin_INCLUDE_DIRS}
5455
${PROJECT_BINARY_DIR}/include
56+
${CATKIN_DEVEL_PREFIX}/include
5557
)
5658

5759
catkin_package(
@@ -61,6 +63,7 @@ catkin_package(
6163
subt_communication_broker
6264
INCLUDE_DIRS
6365
include
66+
${CATKIN_DEVEL_PREFIX}/include
6467
LIBRARIES
6568
SubtProtobuf
6669
CFG_EXTRAS
@@ -88,9 +91,7 @@ install(DIRECTORY ${CATKIN_DEVEL_PREFIX}/include/${PROJECT_NAME}/protobuf/
8891
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}/protobuf
8992
FILES_MATCHING PATTERN "*.h")
9093

91-
catkin_add_env_hooks(ign SHELLS bash
92-
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/env-hooks)
93-
catkin_add_env_hooks(ign SHELLS zsh
94+
catkin_add_env_hooks(30.subt_ign SHELLS bash zsh
9495
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/env-hooks)
9596

9697
add_library(SubtCommon
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Export Ignition environment variables
2+
3+
@[if INSTALLSPACE]@
4+
export IGN_LAUNCH_CONFIG_PATH=@(CMAKE_INSTALL_PREFIX)/@(CATKIN_PACKAGE_SHARE_DESTINATION)/launch
5+
export IGN_LAUNCH_PLUGIN_PATH=@(CMAKE_INSTALL_PREFIX)/@(CATKIN_PACKAGE_LIB_DESTINATION):${IGN_LAUNCH_PLUGIN_PATH}
6+
export IGN_GAZEBO_RESOURCE_PATH=@(CMAKE_INSTALL_PREFIX)/@(CATKIN_PACKAGE_SHARE_DESTINATION)/worlds:${IGN_GAZEBO_RESOURCE_PATH}
7+
export SUBT_IMAGES_PATH=@(CMAKE_INSTALL_PREFIX)/@(CATKIN_PACKAGE_SHARE_DESTINATION)/images
8+
@[else]@
9+
export IGN_LAUNCH_CONFIG_PATH=@(CMAKE_CURRENT_SOURCE_DIR)/launch
10+
export IGN_LAUNCH_PLUGIN_PATH=@(CATKIN_DEVEL_PREFIX)/@(CATKIN_PACKAGE_LIB_DESTINATION):${IGN_LAUNCH_PLUGIN_PATH}
11+
export IGN_GAZEBO_RESOURCE_PATH=@(CMAKE_CURRENT_SOURCE_DIR)/worlds:${IGN_GAZEBO_RESOURCE_PATH}
12+
export SUBT_IMAGES_PATH=@(CMAKE_CURRENT_SOURCE_DIR)/images
13+
@[end if]@
14+
15+
export IGN_TRANSPORT_TOPIC_STATISTICS=1

subt_ign/env-hooks/30.subt_ign.zsh.em

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Export Ignition environment variables
2+
3+
@[if INSTALLSPACE]@
4+
export IGN_LAUNCH_CONFIG_PATH=@(CMAKE_INSTALL_PREFIX)/@(CATKIN_PACKAGE_SHARE_DESTINATION)/launch
5+
export IGN_LAUNCH_PLUGIN_PATH=@(CMAKE_INSTALL_PREFIX)/@(CATKIN_PACKAGE_LIB_DESTINATION)
6+
export IGN_GAZEBO_RESOURCE_PATH=@(CMAKE_INSTALL_PREFIX)/@(CATKIN_PACKAGE_SHARE_DESTINATION)/worlds
7+
export SUBT_IMAGES_PATH=@(CMAKE_INSTALL_PREFIX)/@(CATKIN_PACKAGE_SHARE_DESTINATION)/images
8+
export IGN_TRANSPORT_TOPIC_STATISTICS=1
9+
@[else]@
10+
export IGN_LAUNCH_CONFIG_PATH=@(CMAKE_CURRENT_SOURCE_DIR)/launch
11+
export IGN_LAUNCH_PLUGIN_PATH=@(CATKIN_DEVEL_PREFIX)/@(CATKIN_PACKAGE_LIB_DESTINATION)
12+
export IGN_GAZEBO_RESOURCE_PATH=@(CMAKE_CURRENT_SOURCE_DIR)/worlds
13+
export SUBT_IMAGES_PATH=@(CMAKE_CURRENT_SOURCE_DIR)/images
14+
export IGN_TRANSPORT_TOPIC_STATISTICS=1
15+
@[end if]@

subt_ign/env-hooks/ign.bash.in

-7
This file was deleted.

subt_ign/env-hooks/ign.zsh.in

-7
This file was deleted.

subt_ign/include/subt_ign/Config.hh.in

-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,4 @@
2020

2121
/* Config.hh. Generated by CMake for @PROJECT_NAME@. */
2222

23-
/* Directory where the world files are installed */
24-
#define SUBT_INSTALL_WORLD_DIR "${CMAKE_INSTALL_PREFIX}/share/subt_ign/worlds"
25-
2623
#endif

subt_ign/package.xml

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<depend>libccd-dev</depend>
2323
<depend>libfcl-dev</depend>
2424
<depend>rosbag</depend>
25+
<depend>roslib</depend>
2526

2627
<test_depend>rostest</test_depend>
2728
</package>

subt_ign/src/Common.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <subt_ign/Common.hh>
1919
#include <subt_ign/Config.hh>
2020
#include <ignition/common/Util.hh>
21+
#include <ros/package.h>
2122

2223
namespace subt
2324
{
@@ -99,7 +100,8 @@ bool FullWorldPath(const std::string &_worldName,
99100
return false;
100101
}
101102

102-
std::string worldsDirectory = SUBT_INSTALL_WORLD_DIR;
103+
std::string worldsDirectory = ignition::common::joinPaths(
104+
ros::package::getPath("subt_ign"), "worlds");
103105

104106
const std::string tunnelPrefix = "tunnel_circuit_";
105107
const std::string urbanPrefix = "urban_circuit_";

subt_ign/src/ConnectionValidatorPrivate.cc

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,16 @@
3131
#include <subt_ign/Config.hh>
3232
#include <subt_ign/SimpleDOTParser.hh>
3333

34+
#include <ros/package.h>
35+
3436
using namespace subt;
3537
using namespace ignition;
3638

3739
/////////////////////////////////////////////////
3840
bool ConnectionValidatorPrivate::Load(const std::string &_worldName)
3941
{
40-
std::string worldsDirectory = SUBT_INSTALL_WORLD_DIR;
42+
std::string worldsDirectory = ignition::common::joinPaths(
43+
ros::package::getPath("subt_ign"), "worlds");
4144

4245
std::string fullPath;
4346
subt::FullWorldPath(_worldName, fullPath);

subt_ign/test/Common_TEST.cc

+25-16
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,21 @@
1717

1818
#include <gtest/gtest.h>
1919

20+
#include <ignition/common/Filesystem.hh>
21+
22+
#include <subt_ign/Config.hh>
2023
#include <subt_ign/Common.hh>
2124
#include <subt_ign/CommonTypes.hh>
2225

26+
#include <ros/package.h>
27+
2328
/////////////////////////////////////////////////
2429
TEST(subt_ign_Common, ArtifactTypes){
2530
// Tests to make sure all of our types are consistent
2631
//
2732
// It is expected that these tests will fail when artifacts
2833
// are added or removed, and should be adjusted as such.
29-
auto num_artifacts = static_cast<uint32_t>(subt::ArtifactType::Count);
34+
auto num_artifacts = static_cast<uint32_t>(subt::ArtifactType::Count);
3035
ASSERT_EQ(14u, num_artifacts);
3136
ASSERT_EQ(num_artifacts, subt::kArtifactNames.size());
3237
ASSERT_EQ(num_artifacts, subt::kArtifactTypes.size());
@@ -138,27 +143,31 @@ TEST(subt_ign_Common, StringFromArtifact) {
138143
/////////////////////////////////////////////////
139144
TEST(subt_ign_Common, FullWorldPath) {
140145
std::vector<std::pair<std::string, std::string>> expected = {
141-
{"simple_cave_01", "/simple_cave_01"},
142-
{"cave_qual", "/cave_qual"},
143-
{"cave_circuit_practice_01", "/cave_circuit_practice_01"},
144-
{"cave_circuit_01", "/cave_circuit/01/cave_circuit_01"},
145-
146-
{"simple_tunnel_02", "/simple_tunnel_02"},
147-
{"tunnel_circuit_practice_02", "/tunnel_circuit_practice_02"},
148-
{"tunnel_qual_ign", "/tunnel_qual_ign"},
149-
{"tunnel_circuit_02", "/tunnel_circuit/02/tunnel_circuit_02"},
150-
151-
{"simple_urban_03", "/simple_urban_03"},
152-
{"urban_circuit_practice_03", "/urban_circuit_practice_03"},
153-
{"urban_qual", "/urban_qual"},
154-
{"urban_circuit_03", "/urban_circuit/03/urban_circuit_03"},
146+
{"simple_cave_01", "simple_cave_01"},
147+
{"cave_qual", "cave_qual"},
148+
{"cave_circuit_practice_01", "cave_circuit_practice_01"},
149+
{"cave_circuit_01", "cave_circuit/01/cave_circuit_01"},
150+
151+
{"simple_tunnel_02", "simple_tunnel_02"},
152+
{"tunnel_circuit_practice_02", "tunnel_circuit_practice_02"},
153+
{"tunnel_qual_ign", "tunnel_qual_ign"},
154+
{"tunnel_circuit_02", "tunnel_circuit/02/tunnel_circuit_02"},
155+
156+
{"simple_urban_03", "simple_urban_03"},
157+
{"urban_circuit_practice_03", "urban_circuit_practice_03"},
158+
{"urban_qual", "urban_qual"},
159+
{"urban_circuit_03", "urban_circuit/03/urban_circuit_03"},
155160
};
156161

162+
std::string worldsDirectory = ignition::common::joinPaths(
163+
ros::package::getPath("subt_ign"), "worlds");
157164
for (const auto &[input, expected_out] : expected)
158165
{
159166
std::string worldPath;
160167
EXPECT_TRUE(subt::FullWorldPath(input, worldPath));
161-
EXPECT_EQ(expected_out, worldPath);
168+
EXPECT_EQ(
169+
ignition::common::joinPaths(worldsDirectory, expected_out),
170+
worldPath);
162171
}
163172

164173
{

0 commit comments

Comments
 (0)