Skip to content

Commit

Permalink
Added CRAS packages (#422)
Browse files Browse the repository at this point in the history
* Added CRAS packages.

* Rebuild geometric_shapes

* Temporarily fix build of cras_cpp_common until the fix is upstreamed.

* Disable magnetometer_compass on aarch64.
  • Loading branch information
peci1 authored Oct 24, 2023
1 parent 72a8f7e commit 60c7f22
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 0 deletions.
4 changes: 4 additions & 0 deletions conda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ cython:
conda: [cython]
doxygen:
conda: [doxygen, graphviz]
draco:
conda: [draco]
eigen:
conda: [eigen]
emacs:
Expand Down Expand Up @@ -760,6 +762,8 @@ python3-pymongo:
conda: [pymongo]
python3-pyproj:
conda: [pyproj]
python3-pysnmp:
conda: [pysnmp]
python3-pytest:
conda: [pytest]
python3-pytest-cov:
Expand Down
51 changes: 51 additions & 0 deletions patch/ros-noetic-cras-cpp-common.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
diff --git a/cras_cpp_common/CMakeLists.txt b/cras_cpp_common/CMakeLists.txt
index b8e1640..876da61 100644
--- a/cras_cpp_common/CMakeLists.txt
+++ b/cras_cpp_common/CMakeLists.txt
@@ -225,12 +225,45 @@ add_library(cras_log_utils src/log_utils.cpp src/log_utils/memory.cpp src/log_ut
target_link_libraries(cras_log_utils
PUBLIC cras_string_utils ${catkin_LIBRARIES} PRIVATE cras_time_utils)

+# Detect compiler SIMD support. We'll need it for cras_tf2_sensor_msgs target.
+include(CheckCXXCompilerFlag)
+unset(COMPILER_SUPPORTS_MARCH_X86_V3 CACHE)
+unset(COMPILER_SUPPORTS_MARCH_X86_V2 CACHE)
+unset(COMPILER_SUPPORTS_MARCH_ARMV8 CACHE)
+unset(COMPILER_SUPPORTS_MARCH_ARMV7 CACHE)
+unset(COMPILER_SUPPORTS_MARCH_NATIVE CACHE)
+set(X86_V2_FLAGS -msse4 -msse3)
+set(X86_V3_FLAGS -mavx2 -mavx -mfma)
+list(APPEND X86_V3_FLAGS ${X86_V2_FLAGS})
+CHECK_CXX_COMPILER_FLAG("-march=x86-64 ${X86_V3_FLAGS}" COMPILER_SUPPORTS_MARCH_X86_V3)
+CHECK_CXX_COMPILER_FLAG("-march=x86-64 ${X86_V2_FLAGS}" COMPILER_SUPPORTS_MARCH_X86_V2)
+CHECK_CXX_COMPILER_FLAG("-march=armv8-a" COMPILER_SUPPORTS_MARCH_ARMV8)
+CHECK_CXX_COMPILER_FLAG("-march=armv7-a+neon" COMPILER_SUPPORTS_MARCH_ARMV7)
+CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
+
add_library(cras_tf2_sensor_msgs src/tf2_sensor_msgs.cpp)
add_dependencies(cras_tf2_sensor_msgs ${catkin_EXPORTED_TARGETS})
-target_compile_options(cras_tf2_sensor_msgs PRIVATE -march=native)
target_link_libraries(cras_tf2_sensor_msgs
PUBLIC ${catkin_LIBRARIES}
PRIVATE cras_cloud cras_string_utils Eigen3::Eigen)
+# The pointcloud processing loop really needs SIMD. We enable it conservatively.
+# ROS buildfarm should pick up x86-64-v3 for x86 builds, armv7 for armhf builds and armv8 for arm64 builds.
+if (COMPILER_SUPPORTS_MARCH_X86_V3)
+ target_compile_options(cras_tf2_sensor_msgs PRIVATE -march=x86-64 ${X86_V3_FLAGS})
+ message("cras_tf2_sensor_msgs uses x86-64-v3 SIMD")
+elseif (COMPILER_SUPPORTS_MARCH_X86_V2)
+ target_compile_options(cras_tf2_sensor_msgs PRIVATE -march=x86-64 ${X86_V2_FLAGS})
+ message("cras_tf2_sensor_msgs uses x86-64-v2 SIMD")
+elseif (COMPILER_SUPPORTS_MARCH_ARMV7)
+ target_compile_options(cras_tf2_sensor_msgs PRIVATE -march=armv7-a+neon)
+ message("cras_tf2_sensor_msgs uses armv7-a+simd SIMD")
+elseif (COMPILER_SUPPORTS_MARCH_ARMV8)
+ target_compile_options(cras_tf2_sensor_msgs PRIVATE -march=armv8-a)
+ message("cras_tf2_sensor_msgs uses armv8-a SIMD")
+elseif (COMPILER_SUPPORTS_MARCH_NATIVE)
+ target_compile_options(cras_tf2_sensor_msgs PRIVATE -march=native)
+ message("cras_tf2_sensor_msgs uses native SIMD")
+endif()

add_library(cras_type_utils src/type_utils.cpp)
target_link_libraries(cras_type_utils
4 changes: 4 additions & 0 deletions robostack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ cython:
robostack: [cython]
doxygen:
robostack: [doxygen, graphviz]
draco:
robostack: [draco]
eigen:
robostack: [eigen]
emacs:
Expand Down Expand Up @@ -743,6 +745,8 @@ python3-pymongo:
robostack: [pymongo]
python3-pyproj:
robostack: [pyproj]
python3-pysnmp:
robostack: [pysnmp]
python3-pytest:
robostack: [pytest]
python3-pytest-cov:
Expand Down
29 changes: 29 additions & 0 deletions vinca_linux_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,35 @@ skip_existing:
- https://conda.anaconda.org/robostack-staging/

packages_select_by_deps:
- cras_cpp_common # maintainer peci1
- cras_py_common # maintainer peci1
- cras_docs_common # maintainer peci1
- cras_topic_tools # maintainer peci1
- image_transport_codecs # maintainer peci1
- point_cloud_transport # maintainer peci1
- point_cloud_transport_plugins # maintainer peci1
- draco_point_cloud_transport # maintainer peci1
- sensor_filters # maintainer peci1
- cras_relative_positional_controller # maintainer peci1
- cras_msgs # maintainer peci1
- compass_msgs # maintainer peci1
- magnetometer_compass # maintainer peci1
- electronic_io_msgs # maintainer peci1
- electronic_io # maintainer peci1
- point_cloud_color # maintainer peci1
- rosmsg_cpp # maintainer peci1
- snmp_ros # maintainer peci1
- robot_body_filter # maintainer peci1
- static_transform_mux # maintainer peci1
- tf_remapper_cpp # maintainer peci1
- roslint # maintainer peci1
- tf2_server # maintainer peci1
- rosbash_params # maintainer peci1
- dynamic_robot_state_publisher # maintainer peci1
- tf2_client # maintainer peci1
- tf_static_publisher # maintainer peci1
- movie_publisher # maintainer peci1
- geometric_shapes
- teleop-twist-keyboard
- rosserial-client
- rosserial-arduino
Expand Down
29 changes: 29 additions & 0 deletions vinca_linux_aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,35 @@ skip_existing:
- https://conda.anaconda.org/robostack-staging/

packages_select_by_deps:
- cras_cpp_common # maintainer peci1
- cras_py_common # maintainer peci1
- cras_docs_common # maintainer peci1
- cras_topic_tools # maintainer peci1
- image_transport_codecs # maintainer peci1
- point_cloud_transport # maintainer peci1
- point_cloud_transport_plugins # maintainer peci1
- draco_point_cloud_transport # maintainer peci1
- sensor_filters # maintainer peci1
- cras_relative_positional_controller # maintainer peci1
- cras_msgs # maintainer peci1
- compass_msgs # maintainer peci1
# does not work on aarch64 (yet) # - magnetometer_compass # maintainer peci1
- electronic_io_msgs # maintainer peci1
- electronic_io # maintainer peci1
- point_cloud_color # maintainer peci1
- rosmsg_cpp # maintainer peci1
- snmp_ros # maintainer peci1
- robot_body_filter # maintainer peci1
- static_transform_mux # maintainer peci1
- tf_remapper_cpp # maintainer peci1
- roslint # maintainer peci1
- tf2_server # maintainer peci1
- rosbash_params # maintainer peci1
- dynamic_robot_state_publisher # maintainer peci1
- tf2_client # maintainer peci1
- tf_static_publisher # maintainer peci1
- movie_publisher # maintainer peci1
- geometric_shapes
- actionlib
- foxglove_bridge
- ros-babel-fish
Expand Down

0 comments on commit 60c7f22

Please sign in to comment.