diff --git a/.docker_utils/Dockerfile.f1tenth_arm b/.docker_utils/Dockerfile.f1tenth_arm index bbcaf844..9081867a 100644 --- a/.docker_utils/Dockerfile.f1tenth_arm +++ b/.docker_utils/Dockerfile.f1tenth_arm @@ -424,6 +424,10 @@ RUN source source_ros2.sh && \ RUN source source_ros2.sh && \ make livox-driver +########## Build fusion-engine-driver, ntrip_client, and p1_tools for PointOneNav GPS ######### +RUN source source_ros2.sh && \ + make pointonenav + ########### ADD CUSTOM FUNCTIONS ########### WORKDIR /home/scripts/ COPY scripts/bashrc.sh ./bashrc.sh @@ -432,4 +436,4 @@ RUN ["/bin/bash", "-c", "echo '. /home/scripts/bashrc.sh' >> /root/.bashrc"] WORKDIR $WORKSPACE RUN echo export WORKSPACE=$WORKSPACE >> /root/.bashrc # RUN echo 'export LD_PRELOAD=/usr/local/lib/python3.8/dist-packages/sklearn/__check_build/../../scikit_learn.libs/libgomp-d22c30c5.so.1.0.0' >> ~/.bashrc -ENTRYPOINT ["/bin/bash"] \ No newline at end of file +ENTRYPOINT ["/bin/bash"] diff --git a/.docker_utils/README.md b/.docker_utils/README.md new file mode 100644 index 00000000..87c7d18b --- /dev/null +++ b/.docker_utils/README.md @@ -0,0 +1,4 @@ +I added at the very bottom right after the LIVOX scripts, the scripts necessary for PointOneNav + +On one terminal, ros2 launch ntrip_client ntrip_client_launch.py host:=polaris.pointonenav.com port:=2101 mountpoint:=POLARIS ntrip_version:=v2 authenticate:=true username:=gbUv1nO2 password:=zZLxzLpJ +On another terminal, ros2 run fusion-engine-driver fusion_engine_ros_driver --ros-args -p connection_type:=tty -p tty_port:=/dev/ttyUSB1 diff --git a/Makefile b/Makefile index 910515ea..eaf0c236 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ .ONESHELL: SHELL := /bin/bash .DEFAULT_GOAL := build - .PHONY: build build: colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release @@ -37,6 +36,11 @@ livox-driver: vcs import < repos/livox.repos ./scripts/livox_driver.sh +.PHONY: pointonenav +pointonenav: + vcs import < repos/pon.repos + ./scripts/pon.sh + .PHONY: racer racer: vcs import < repos/common.repos diff --git a/repos/common.repos b/repos/common.repos index b56be44b..11693df2 100644 --- a/repos/common.repos +++ b/repos/common.repos @@ -17,3 +17,8 @@ repositories: type: git url: https://github.com/Triton-AI/multi_cam_oak_lite.git version: master + #GPS + src/external/sensors/gps: + type: git + url: + version: master diff --git a/repos/pon.repos b/repos/pon.repos new file mode 100644 index 00000000..1d54770d --- /dev/null +++ b/repos/pon.repos @@ -0,0 +1,14 @@ +repositories: + src/external/sensors/gps/pointonenav: + type: git + url: https://github.com/Triton-AI/ros2-fusion-engine-driver.git + version: main + src/external/sensors/gps/pointonenav/ntrip_client: + type: git + url: https://github.com/LORD-MicroStrain/ntrip_client + version: ros2 + src/external/sensors/gps/pointonenav/quectel: + type: git + url: https://github.com/UCSD-ECEMAE-148/quectel.git + version: main + diff --git a/repos/sim.repos b/repos/sim.repos index c79bd249..0063cb29 100644 --- a/repos/sim.repos +++ b/repos/sim.repos @@ -6,4 +6,4 @@ repositories: src/external/f1tenth_sim/f1tenth_gym_ros: type: git url: https://github.com/Triton-AI/f1tenth_gym_ros.git - version: main \ No newline at end of file + version: main diff --git a/scripts/pon.sh b/scripts/pon.sh new file mode 100755 index 00000000..73455154 --- /dev/null +++ b/scripts/pon.sh @@ -0,0 +1,100 @@ +#!/bin/bash + +# All documentations related are as follows +# https://github.com/PointOneNav/p1-host-tools +# https://github.com/PointOneNav/ros2-fusion-engine-driver/tree/main?tab=readme-ov-file#requirements +# Property of Triton AI @ UCSD, Kevin Shin + +# Check for C++11 or later +if g++ -std=c++11 -E -x c++ - /dev/null; then + echo "C++11 or later: Installed" +else + echo "C++11 or later: Not installed" +fi + +# Check for CMake 3.x +if command -v cmake >/dev/null 2>&1; then + cmake_version=$(cmake --version | head -n1 | awk '{print $3}') + if [[ $cmake_version == 3.* ]]; then + echo "CMake 3.x: Installed (version $cmake_version)" + else + echo "CMake 3.x: Not installed (found version $cmake_version)" + fi +else + echo "CMake 3.x: Not installed" +fi + +# Check for GCC or Clang +if command -v gcc >/dev/null 2>&1; then + echo "GCC: Installed ($(gcc --version | head -n1))" +elif command -v clang >/dev/null 2>&1; then + echo "Clang: Installed ($(clang --version | head -n1))" +else + echo "Neither GCC nor Clang is installed" +fi + +# Check for ROS 2 Foxy +if [ -f /opt/ros/foxy/setup.bash ]; then + echo "ROS 2 Foxy: Installed" +else + echo "ROS 2 Foxy: Not installed" +fi + + +# Install missing packages +install_package() { + echo "Installing $1..." + sudo apt-get update + sudo apt-get install -y $1 +} + +check_package() { + if dpkg -s $1 >/dev/null 2>&1; then + return 0 + else + return 1 + fi +} + +packages=("ros-foxy-gps-msgs" "ros-foxy-nmea-msgs" "ros-foxy-mavros-msgs" "ros-foxy-rtcm-msgs") +all_installed=true + +for package in "${packages[@]}"; do + if ! dpkg -s $package >/dev/null 2>&1; then + install_package $package + else + echo "$package is already installed." + fi + + if ! check_package $package; then + all_installed=false + fi +done + +POINTONENAV=/home/jetson/projects/robocar/src/external/sensors/gps/pointonenav +# Configurations +if $all_installed; then + echo "All required ROS2 Foxy packages are installed. Proceeding with FusionEngine and NTRIPClient installation." + cd $POINTONENAV/p1-host-tools/ + python3 -m venv p1_tools_venv + source p1_tools_venv/bin/activate + pip3 install -r requirements.txt + bin/config_tool.py apply uart2_message_rate fe ROSPoseMessage 100ms + bin/config_tool.py apply uart2_message_rate fe ROSGPSFixMessage 100ms + bin/config_tool.py apply uart2_message_rate fe ROSIMUMessage 100ms + bin/config_tool.py save + deactivate + + cd $POINTONENAV/fusion-engine-driver/ + rosdep install -i --from-path ./ --rosdistro foxy -y + colcon build --packages-select fusion-engine-driver + source install/local_setup.bash + + cd $POINTONENAV/ntrip_client/ + colcon build --packages-select ntrip_client + source install/local_setup.bash + + echo "FusionEngine and NTRIPClient configured and available as ROS2 packages." +else + echo "Some required ROS2 Foxy packages are missing. Please install them before proceeding" +fi