-
Notifications
You must be signed in to change notification settings - Fork 0
Add livox docker jazzy #2
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8e7cc0d
Added docker
delihus 1d41ca5
Added jazzy | changed base package to fork
delihus a775b21
Jazzy version work with cyclonedds
delihus 5fe77d8
Added name of dockerhub repo
delihus d2cadb3
Added jazzy
delihus 544b23a
Update demo/.env
delihus b8bb16a
rviz: subscribe proper topic
husarafal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
name: Build/Publish ROS Docker Image | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
build_type: | ||
description: Is it a "development" or a "stable" release? | ||
required: true | ||
default: development | ||
type: choice | ||
options: | ||
- development | ||
- stable | ||
target_distro: | ||
description: In case of "stable" release specify the ROS distro of the existing docker image (eg. | ||
humble) | ||
type: string | ||
default: ardent | ||
target_release: | ||
description: In case of "stable" release specify the version of the existing docker image (eg. | ||
1.0.12) | ||
type: string | ||
default: 0.0.0 | ||
target_date: | ||
description: In case of "stable" release specify the date of the existing docker image in format | ||
YYYYMMDD (eg. 20220124) | ||
type: string | ||
default: '20131206' | ||
repository_dispatch: | ||
types: [rebuild] | ||
pull_request: | ||
types: | ||
- closed | ||
- opened | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ros_distro: [humble, jazzy] | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build Docker Image | ||
uses: husarion-ci/ros-docker-img-action@v0.4 | ||
with: | ||
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} | ||
repo_name: livox-lidar | ||
main_branch_name: ros2 | ||
build_type: ${{ inputs.build_type }} | ||
ros_distro: ${{ matrix.ros_distro }} | ||
platforms: linux/amd64, linux/arm64 | ||
# variables important only for stable release | ||
target_distro: ${{ inputs.target_distro }} | ||
target_release: ${{ inputs.target_release }} | ||
target_date: ${{ inputs.target_date }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-merge-conflict | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-xml | ||
- id: check-added-large-files | ||
- id: check-ast | ||
- id: check-json | ||
- id: name-tests-test | ||
files: ^.*\/test\/.*$ | ||
args: [--pytest-test-first] | ||
|
||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.2.6 | ||
hooks: | ||
- id: codespell | ||
entry: codespell * | ||
|
||
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt | ||
rev: 0.2.3 | ||
hooks: | ||
- id: yamlfmt | ||
files: ^(?!.*compose).*$ | ||
args: [--mapping, '2', --sequence, '4', --offset, '2', --width, '100'] | ||
|
||
|
||
- repo: https://github.com/psf/black | ||
rev: 23.12.0 | ||
hooks: | ||
- id: black | ||
args: [--line-length=99] | ||
|
||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 6.1.0 | ||
hooks: | ||
- id: flake8 | ||
args: ['--ignore=E501,W503'] # ignore too long line and line break before binary operator, | ||
# black checks it | ||
|
||
# Docs - RestructuredText hooks | ||
- repo: https://github.com/PyCQA/doc8 | ||
rev: v1.1.1 | ||
hooks: | ||
- id: doc8 | ||
args: [--max-line-length=100, --ignore=D001] | ||
exclude: ^.*\/CHANGELOG\.rst/.*$ | ||
|
||
- repo: https://github.com/pre-commit/mirrors-clang-format | ||
rev: v17.0.6 | ||
hooks: | ||
- id: clang-format |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Define build stage for creating ROS packages | ||
ARG ROS_DISTRO=jazzy | ||
ARG PREFIX= | ||
|
||
# =========================== package builder =============================== | ||
FROM husarnet/ros:$ROS_DISTRO-ros-base AS pkg-builder | ||
|
||
WORKDIR /ros2_ws | ||
|
||
# Setup workspace | ||
RUN git clone https://github.com/tu-darmstadt-ros-pkg/livox_ros_driver2 -b $ROS_DISTRO /ros2_ws/src/livox_ros_driver2 && \ | ||
git clone https://github.com/tu-darmstadt-ros-pkg/Livox-SDK2 -b $ROS_DISTRO /ros2_ws/src/livox_sdk2 && \ | ||
apt-get update -y && \ | ||
rosdep update --rosdistro $ROS_DISTRO && \ | ||
rosdep install --from-paths src --ignore-src -y | ||
|
||
|
||
# Optional: Create healthcheck package | ||
RUN cd src/ && \ | ||
source /opt/ros/$ROS_DISTRO/setup.bash && \ | ||
ros2 pkg create healthcheck_pkg --build-type ament_cmake --dependencies rclcpp sensor_msgs && \ | ||
sed -i '/find_package(sensor_msgs REQUIRED)/a \ | ||
add_executable(healthcheck_node src/healthcheck.cpp)\n \ | ||
ament_target_dependencies(healthcheck_node rclcpp sensor_msgs)\n \ | ||
install(TARGETS healthcheck_node DESTINATION lib/${PROJECT_NAME})' \ | ||
/ros2_ws/src/healthcheck_pkg/CMakeLists.txt | ||
COPY ./husarion_utils/healthcheck.cpp /ros2_ws/src/healthcheck_pkg/src/ | ||
|
||
# Build | ||
RUN source /opt/ros/$ROS_DISTRO/setup.bash && \ | ||
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release && \ | ||
echo $(cat /ros2_ws/src/livox_ros_driver2/package.xml | grep '<version>' | sed -r 's/.*<version>([0-9]+.[0-9]+.[0-9]+)<\/version>/\1/g') > /version.txt && \ | ||
rm -rf build log | ||
|
||
RUN apt update -y && \ | ||
apt-get install -y ros-$ROS_DISTRO-nav2-common && \ | ||
apt-get clean && \ | ||
rm -rf src && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY ./husarion_utils /husarion_utils | ||
|
||
HEALTHCHECK --interval=2s --timeout=1s --start-period=20s --retries=1 \ | ||
CMD ["/husarion_utils/healthcheck.sh"] | ||
|
||
|
||
# Ensure LIDAR stops spinning on container shutdown | ||
STOPSIGNAL SIGINT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,52 @@ | ||
# livox-docker | ||
Docker images for Livox LIDARs | ||
<h1 align="center"> | ||
Docker Images for Livox LIDARs | ||
</h1> | ||
|
||
The repository includes a GitHub Actions workflow that automatically deploys built Docker images to the [husarion/livox-docker](https://hub.docker.com/r/husarion/livox) Docker Hub repositories. This process is based on the fork of [tu-darmstadt-ros-pkg/livox_ros_driver2](https://github.com/tu-darmstadt-ros-pkg/livox_ros_driver2) repository. | ||
|
||
[](https://github.com/husarion/livox-docker/actions/workflows//ros-docker-image.yaml) | ||
|
||
|
||
## Prepare Environment | ||
|
||
1. Plugin the Device | ||
|
||
Connect the device to the power supply and plug the ethernet cable to your PC or Husarion UGV router. | ||
|
||
2. Check connection | ||
|
||
Read the serial number of a Livox MID360 and remember last 2 numbers. These numbers are the part of its ip `192.168.1.1xx`. | ||
|
||
To check the connection use the `ping` command: | ||
```bash | ||
ping 192.168.1.1xx | ||
``` | ||
|
||
## Demo | ||
|
||
|
||
1. Clone the Repository | ||
|
||
```bash | ||
git clone https://github.com/husarion/livox-docker.git | ||
cd livox-docker/demo | ||
``` | ||
|
||
2. Set the Appropriate IP | ||
In [configuration](./demo/MID360_config.json) `lidar_config` > `ip` in the 28th line set this ip. | ||
|
||
Your SBC should have ip `192.168.1.50`. For Husarion UGV SBC you can add to the ethernet interface configuration additional IP. | ||
In file `/etc/netplan/01-network-manager-all.yaml` add to `addresses` `- 192.168.1.50/24`. | ||
|
||
3. Activate the Device | ||
|
||
```bash | ||
docker compose up livox | ||
``` | ||
|
||
4. Launch Visualization | ||
|
||
```bash | ||
xhost local:root | ||
docker compose up rviz | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# ======================================= | ||
# Namespace config | ||
# ======================================= | ||
# To use multimle devices on multible robot you have to specify following field | ||
delihus marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
# Uncomment to add robot namespace | ||
# ROBOT_NAMESPACE=robot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"lidar_summary_info": { | ||
"lidar_type": 8 | ||
}, | ||
"MID360": { | ||
"lidar_net_info": { | ||
"cmd_data_port": 56100, | ||
"push_msg_port": 56200, | ||
"point_data_port": 56300, | ||
"imu_data_port": 56400, | ||
"log_data_port": 56500 | ||
}, | ||
"host_net_info": { | ||
"cmd_data_ip": "192.168.1.50", | ||
"cmd_data_port": 56101, | ||
"push_msg_ip": "192.168.1.50", | ||
"push_msg_port": 56201, | ||
"point_data_ip": "192.168.1.50", | ||
"point_data_port": 56301, | ||
"imu_data_ip": "192.168.1.50", | ||
"imu_data_port": 56401, | ||
"log_data_ip": "192.168.1.50", | ||
"log_data_port": 56501 | ||
} | ||
}, | ||
"lidar_configs": [ | ||
{ | ||
"ip": "192.168.1.160", | ||
"pcl_data_type": 1, | ||
"pattern_mode": 0, | ||
"frame_id": "<frame_id>", | ||
"extrinsic_parameter": { | ||
"roll": 0.0, | ||
"pitch": 0.0, | ||
"yaw": 0.0, | ||
"x": 0, | ||
"y": 0, | ||
"z": 0 | ||
} | ||
} | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
x-common-config: | ||
&common-config | ||
network_mode: host | ||
ipc: host | ||
env_file: .env | ||
|
||
services: | ||
livox: | ||
# image: husarion/livox-lidar:jazzy | ||
build: | ||
context: .. | ||
dockerfile: Dockerfile | ||
<<: *common-config | ||
volumes: | ||
- ./MID360_config.json:/ros2_ws/install/livox_ros_driver2/share/livox_ros_driver2/config/MID360_config.json | ||
environment: | ||
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp | ||
command: > | ||
ros2 launch /husarion_utils/livox.launch.py | ||
|
||
rviz: | ||
image: husarion/rviz2:humble | ||
<<: *common-config | ||
volumes: | ||
- /tmp/.X11-unix:/tmp/.X11-unix:rw | ||
- ./default.rviz:/root/.rviz2/default.rviz | ||
- ./rviz.launch.py:/ros2_ws/rviz.launch.py | ||
environment: | ||
- DISPLAY=${DISPLAY:?err} | ||
- LIBGL_ALWAYS_SOFTWARE=1 | ||
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp | ||
command: > | ||
ros2 launch rviz.launch.py |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.