Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rae_improv #12

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified scripts/build_all.sh
100755 → 100644
Empty file.
3 changes: 2 additions & 1 deletion scripts/build_all_static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ cp "$SDK_PACKAGE" "$TMP/unpack/"
cd "$TMP/unpack"
tar xvf spectacularAI_*.tar.gz
make PREFIX="$TMP/install" test
make install

cd "$ROOT"
./scripts/build_all.sh -DspectacularAI_DIR="$TMP/install/lib/cmake/spectacularAI"

INSTALL_DIR="spectacularai_ros2/install/spectacularai_ros2/"
# Strip the executable (just in case the CMake build failed to do that)
strip "$INSTALL_DIR/lib/libvislam.so"
strip "$INSTALL_DIR/lib/libspectacularai_ros2.so"

# Copy license/notice file form the SDK package
LICENSE_OUTPUT_DIR="$INSTALL_DIR"
Expand Down
Empty file modified scripts/download_and_build_static.sh
100755 → 100644
Empty file.
37 changes: 28 additions & 9 deletions spectacularai_ros2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -O2")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")

set(DYNAMIC_SAI_LIBRARY OFF CACHE STRING "Use dynamic Spectacular AI SDK")
set(DYNAMIC_SAI_LIBRARY ON )

set(PLUGIN_SRC
src/ros2_plugin.cpp)
Expand All @@ -25,23 +25,23 @@ find_package(message_filters REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)

find_package(depthai_ros_msgs REQUIRED) # Depth AI features

# add_executable(vislam ${PLUGIN_SRC})
add_library(vislam SHARED ${PLUGIN_SRC})
include_directories(include)
# add_executable(${PROJECT_NAME} ${PLUGIN_SRC})
add_library(${PROJECT_NAME} SHARED ${PLUGIN_SRC})

# Dynamic dependencies of the static library SDK variant
set(SAI_STATIC_MANUAL_LINK_LIBS z)
target_link_libraries(vislam PRIVATE spectacularAI::spectacularAI ${SAI_STATIC_MANUAL_LINK_LIBS})
target_link_libraries(${PROJECT_NAME} PRIVATE spectacularAI::spectacularAI ${SAI_STATIC_MANUAL_LINK_LIBS})
# Strip the output executable
set_target_properties(vislam PROPERTIES LINK_FLAGS -s)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS -s)

rclcpp_components_register_nodes(vislam "spectacularAI::ros2::Node")
rclcpp_components_register_nodes(${PROJECT_NAME} "spectacularAI::ros2::Node")

# ROS dependencies
ament_target_dependencies(vislam PUBLIC rclcpp rclcpp_components sensor_msgs nav_msgs tf2_geometry_msgs image_transport message_filters tf2 tf2_ros depthai_ros_msgs)
ament_target_dependencies(${PROJECT_NAME} PUBLIC spectacularAI rclcpp rclcpp_components sensor_msgs nav_msgs tf2_geometry_msgs image_transport message_filters tf2 tf2_ros depthai_ros_msgs)

install(
TARGETS vislam DESTINATION lib/
TARGETS ${PROJECT_NAME} DESTINATION lib/
RUNTIME DESTINATION lib/
ARCHIVE DESTINATION lib/
LIBRARY DESTINATION lib/
Expand All @@ -52,5 +52,24 @@ install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})
if (DYNAMIC_SAI_LIBRARY)
install(IMPORTED_RUNTIME_ARTIFACTS spectacularAI::spectacularAI)
endif()
ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET)

install(DIRECTORY include/
DESTINATION include/
)

install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Targets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include

)
install(EXPORT ${PROJECT_NAME}Targets
DESTINATION share/${PROJECT_NAME}/cmake)
ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})
ament_export_dependencies(${dependencies})

ament_package()
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ geometry_msgs::msg::TransformStamped poseToTransformStampped(spectacularAI::Pose
tf.transform.translation.x = pose.position.x;
tf.transform.translation.y = pose.position.y;
tf.transform.translation.z = pose.position.z;
tf.transform.rotation.x = pose.orientation.x;
tf.transform.rotation.y = pose.orientation.y;
tf.transform.rotation.x = 0;
tf.transform.rotation.y = 0;
tf.transform.rotation.z = pose.orientation.z;
tf.transform.rotation.w = pose.orientation.w;
return tf;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ class PoseHelper {
double deltaT = vioOutput->pose.time - lastTime;
odomPosition.x += vioOutput->velocity.x * deltaT;
odomPosition.y += vioOutput->velocity.y * deltaT;
odomPosition.z += vioOutput->velocity.z * deltaT;
odomPosition.z = 0;
}
lastTime = vioOutput->pose.time;

odomPose = spectacularAI::Pose {
.time = vioOutput->pose.time,
.position = odomPosition,
Expand Down
Loading