Skip to content

Commit

Permalink
fix(conan bugs for glog)
Browse files Browse the repository at this point in the history
  • Loading branch information
ai-winter committed Dec 21, 2024
1 parent f50af14 commit e0c0457
Show file tree
Hide file tree
Showing 11 changed files with 205 additions and 61 deletions.
8 changes: 8 additions & 0 deletions 3rd/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ class ExampleRecipe(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps", "CMakeToolchain", "cmake_find_package", "cmake"

def configure(self):
self.options["ceres-solver"].shared = True
self.options["ceres-solver"].use_glog = True
self.options["glog"].shared = True
self.options["glog"].with_threads = True
self.options["gflags"].shared = True

def requirements(self):
self.requires("osqp/0.6.3")
self.requires("ceres-solver/1.14.0")

def layout(self):
cmake_layout(self)
40 changes: 38 additions & 2 deletions 3rd/conaninfo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
arch=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux

[requires]
ceres-solver/1.Y.Z
osqp/0.6.3

[options]
Expand All @@ -16,16 +17,51 @@
arch=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux

[full_requires]
ceres-solver/1.14.0:7195fd60b8544268e80a4a2edca60ab3e55f8aa9
eigen/3.4.0:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
gflags/2.2.2:88539f002769027b252fd7a108dc2f1fa9529154
glog/0.6.0:a9d362b17f05cef8580ca68487c6299654e427f6
libunwind/1.8.0:33c616363345eda1477f22cf41ff3cd6c49db049
osqp/0.6.3:6af9cc7cb931c5ad942174fd7838eb655717c709
xz_utils/5.4.5:6af9cc7cb931c5ad942174fd7838eb655717c709
zlib/1.3.1:6af9cc7cb931c5ad942174fd7838eb655717c709

[full_options]
ceres-solver:shared=True
ceres-solver:use_CXX11=False
ceres-solver:use_CXX11_threads=False
ceres-solver:use_TBB=False
ceres-solver:use_custom_blas=True
ceres-solver:use_eigen_sparse=True
ceres-solver:use_gflags=deprecated
ceres-solver:use_glog=True
ceres-solver:use_schur_specializations=True
eigen:MPL2_only=False
gflags:namespace=gflags
gflags:nothreads=True
gflags:shared=True
glog:shared=True
glog:with_gflags=True
glog:with_threads=True
glog:with_unwind=True
libunwind:coredump=True
libunwind:fPIC=True
libunwind:minidebuginfo=True
libunwind:ptrace=True
libunwind:setjmp=True
libunwind:shared=False
libunwind:zlibdebuginfo=True
osqp:fPIC=True
osqp:shared=False
xz_utils:fPIC=True
xz_utils:shared=False
zlib:fPIC=True
zlib:shared=False

[recipe_hash]

Expand Down
44 changes: 42 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,44 @@
#!/bin/bash

add_path_to_bashrc() {
local TARGET_PATH="$1"
local ENV_PATH_NAME="$2"

if [ -z "$TARGET_PATH" ]; then
echo "Please provide the target_path."
return 1
fi

if echo "$$ENV_PATH_NAME" | grep -q "$TARGET_PATH"; then
echo "$TARGET_PATH exists in $$ENV_PATH_NAME."
else
if grep -q "export $ENV_PATH_NAME=.*$TARGET_PATH" ~/.bashrc; then
echo "$TARGET_PATH has been set."
else
echo "export $ENV_PATH_NAME=\$$ENV_PATH_NAME:$TARGET_PATH" >> ~/.bashrc
echo "$TARGET_PATH is set."
fi
fi
}

process_3rd_library() {
local list=("$@")
for item in "${list[@]}"; do
sub_dirs=$(find "$HOME/.conan/data/$item/" -mindepth 1 -maxdepth 1 -type d)
for sub_item in $sub_dirs; do
sub_packages=$(find "$sub_item/_/_/package" -mindepth 1 -maxdepth 1 -type d)
for sub_pack in $sub_packages; do
export LIBRARY_PATH=$LIBRARY_PATH:"$sub_pack/lib"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$sub_pack/lib"
add_path_to_bashrc "$sub_pack/lib" "LD_LIBRARY_PATH"
add_path_to_bashrc "$sub_pack/lib" "LIBRARY_PATH"
done
done
done
}

cd ../3rd
./conan_install.sh # option for osqp
conan install . --output-folder=build --build=missing -s compiler.libcxx=libstdc++11
process_3rd_library "gflags" "glog" "ceres-solver"
cd ../
catkin_make
catkin_make
27 changes: 10 additions & 17 deletions src/core/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
cmake_minimum_required(VERSION 3.0.2)
project(common)

# set(CMAKE_CXX_STANDARD 11)
get_filename_component(PROJECT_ROOT_DIR ${CMAKE_SOURCE_DIR} DIRECTORY)
include(${PROJECT_ROOT_DIR}/3rd/conanbuildinfo.cmake)
conan_basic_setup()

find_package(Eigen3 REQUIRED)

find_package(catkin REQUIRED COMPONENTS
roscpp
costmap_2d
)

catkin_package(
Expand All @@ -20,14 +24,12 @@ include_directories(
${EIGEN3_INCLUDE_DIR}
)

# file(GLOB math_src_fils src/math/*.cc)
file(GLOB util_src_files src/util/*.cpp)
file(GLOB math_src_files_cpp src/math/*.cpp)
file(GLOB geometry_src_files src/geometry/*.cpp)
file(GLOB safety_corridor_src_files src/safety_corridor/*.cpp)

add_library(${PROJECT_NAME}
# ${math_src_fils}
${util_src_files}
${math_src_files_cpp}
${geometry_src_files}
Expand All @@ -39,24 +41,15 @@ add_dependencies(${PROJECT_NAME}
${catkin_EXPORTED_TARGETS}
)

target_include_directories(${PROJECT_NAME} PUBLIC
${CONAN_INCLUDE_DIRS}
)

target_link_libraries(${PROJECT_NAME}
${catkin_LIBRARIES}
glog
gflags
protobuf
${CONAN_LIBS}
)

# add_definitions("-Wall -g")
# find_package(Python3 COMPONENTS Development NumPy)
# add_executable(convex_safety_corridor_test test/convex_safety_corridor_test.cpp)
# target_link_libraries(convex_safety_corridor_test
# ${catkin_LIBRARIES}
# ${GTEST_LIBRARIES}
# Python3::Python
# Python3::NumPy
# ${PROJECT_NAME}
# )

# install
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
Expand Down
21 changes: 10 additions & 11 deletions src/plugins/dynamic_rviz_config/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
cmake_minimum_required(VERSION 3.0.2)
project(dynamic_rviz_config)
# find_package(catkin REQUIRED COMPONENTS
# roscpp
# rospy
# )
find_package(catkin REQUIRED COMPONENTS
rospy
)

# catkin_package(
# CATKIN_DEPENDS urdf xacro
# )
catkin_package(
CATKIN_DEPENDS urdf xacro
)

# catkin_install_python(PROGRAMS
# scripts/rviz_generate.py
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )
catkin_install_python(PROGRAMS
scripts/rviz_generate.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
9 changes: 3 additions & 6 deletions src/plugins/dynamic_rviz_config/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@
<author email="913982779@qq.com">Winter</author>

<buildtool_depend>catkin</buildtool_depend>
<!-- <build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>

<run_depend>roscpp</run_depend>
<run_depend>rospy</run_depend>
<run_depend>urdf</run_depend>
<run_depend>xacro</run_depend> -->
<depend>rospy</depend>
<depend>urdf</depend>
<depend>xacro</depend>

</package>
6 changes: 4 additions & 2 deletions src/sim_env/launch/config.launch
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
<include file="$(find sim_env)/launch/include/robots/start_robots.launch.xml" />

<!-- open rviz for visualization -->
<node pkg="dynamic_rviz_config" type="rviz_generate.py" name="rosapp_rviz" args="$(arg robot_number)" output="screen" if="$(eval arg('rviz_file') == '')" />
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find sim_env)/rviz/$(arg rviz_file)" unless="$(eval arg('rviz_file') == '')" />
<node pkg="dynamic_rviz_config" type="rviz_generate.py" name="rosapp_rviz" args="$(arg robot_number)" output="screen"
if="$(eval arg('rviz_file') == '')" />
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find sim_env)/rviz/$(arg rviz_file)"
unless="$(eval arg('rviz_file') == '')" />
</launch>
2 changes: 1 addition & 1 deletion src/sim_env/launch/include/robots/start_robots.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<arg name="agent_number" default="1" />
<arg name="agent_id" default="1" />
<arg name="robot1_type" value="turtlebot3_waffle" />
<arg name="robot1_global_planner" value="rrt" />
<arg name="robot1_global_planner" value="rrt_star" />
<arg name="robot1_local_planner" value="lqr" />
<arg name="robot1_x_pos" value="0.0" />
<arg name="robot1_y_pos" value="0.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/sim_env/launch/main.launch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<launch>
<arg name="world_parameter" value="warehouse" />
<arg name="world_parameter" value="warehouse_with_pedestrians" />
<include file="$(find sim_env)/launch/config.launch">
<arg name="world" value="$(arg world_parameter)" />
<arg name="map" value="warehouse" />
Expand Down
103 changes: 86 additions & 17 deletions src/sim_env/rviz/cache.rviz
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,84 @@ Visualization Manager:
- Class: rviz/TF
Enabled: false
Name: TF
- Class: rviz/RobotModel
- Class: rviz/Group
Displays:
- Class: rviz/RobotModel
Enabled: true
Name: RobotModel
Robot Description: robot1/robot_description
TF Prefix: robot1
- Class: rviz/Image
Enabled: false
Name: Image1
Topic: /robot1/camera/rgb/image_raw
- Alpha: 1
Class: rviz/LaserScan
Color: 255; 0; 0
Color Transformer: FlatColor
Enabled: true
Name: LaserScan1
Size (m): 0.03
Style: Spheres
Topic: /robot1/scan
- Class: rviz/Path
Color: 32; 74; 135
Enabled: true
Name: Path
Enabled: true
Name: RobotModel
Robot Description: robot_description
- Class: rviz/Image
Enabled: false
Name: Image
Topic: /camera/rgb/image_raw
- Alpha: 1
Class: rviz/LaserScan
Color: 255; 0; 0
Color Transformer: FlatColor
Name: Robot1
- Class: rviz/Group
Displays:
- Class: rviz/RobotModel
Enabled: true
Name: RobotModel
Robot Description: robot2/robot_description
TF Prefix: robot2
- Class: rviz/Image
Enabled: false
Name: Image2
Topic: /robot2/camera/rgb/image_raw
- Alpha: 1
Class: rviz/LaserScan
Color: 255; 0; 0
Color Transformer: FlatColor
Enabled: true
Name: LaserScan2
Size (m): 0.03
Style: Spheres
Topic: /robot2/scan
- Class: rviz/Path
Color: 32; 74; 135
Enabled: true
Name: Path
Enabled: true
Name: Robot2
- Class: rviz/Group
Displays:
- Class: rviz/RobotModel
Enabled: true
Name: RobotModel
Robot Description: robot3/robot_description
TF Prefix: robot3
- Class: rviz/Image
Enabled: false
Name: Image3
Topic: /robot3/camera/rgb/image_raw
- Alpha: 1
Class: rviz/LaserScan
Color: 255; 0; 0
Color Transformer: FlatColor
Enabled: true
Name: LaserScan3
Size (m): 0.03
Style: Spheres
Topic: /robot3/scan
- Class: rviz/Path
Color: 32; 74; 135
Enabled: true
Name: Path
Enabled: true
Name: LaserScan
Size (m): 0.03
Style: Spheres
Topic: /scan
Name: Robot3
Global Options:
Fixed Frame: map
Tools:
Expand All @@ -42,6 +103,14 @@ Visualization Manager:
- Class: rviz/Measure
- Class: rviz/PublishPoint
- Class: rviz/SetInitialPose
Topic: /initialpose
Topic: /robot1/initialpose
- Class: rviz/SetGoal
Topic: /robot1/move_base_simple/goal
- Class: rviz/SetInitialPose
Topic: /robot2/initialpose
- Class: rviz/SetGoal
Topic: /robot2/move_base_simple/goal
- Class: rviz/SetInitialPose
Topic: /robot3/initialpose
- Class: rviz/SetGoal
Topic: /move_base_simple/goal
Topic: /robot3/move_base_simple/goal
Loading

0 comments on commit e0c0457

Please sign in to comment.