Skip to content

Commit

Permalink
Merge pull request #112 from linorobot/sensor_update
Browse files Browse the repository at this point in the history
Sensor update
  • Loading branch information
grassjelly committed Feb 21, 2024
2 parents ed5da3b + 939be7d commit 25d1e4a
Show file tree
Hide file tree
Showing 20 changed files with 507 additions and 308 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ robot_type:
- `mecanum` - Mecanum drive robot.

laser_sensor:
- `rplidar` - [RP LIDAR A1](https://www.slamtec.com/en/Lidar/A1)
- `ldlidar` - [LD06 LIDAR](https://www.inno-maker.com/product/lidar-ld06/)
- `a1` - [RPLIDAR A1](https://www.slamtec.com/en/Lidar/A1)
- `a2` - [RPLIDAR A2](https://www.slamtec.ai/product/slamtec-rplidar-a2/)
- `a3` - [RPLIDAR A3](https://www.slamtec.ai/product/slamtec-rplidar-a3/)
- `s1` - [RPLIDAR S1](https://www.slamtec.com/en/Lidar/S1)
- `s2` - [RPLIDAR S2](https://www.slamtec.com/en/Lidar/S2)
- `s3` - [RPLIDAR S3](https://www.slamtec.com/en/Lidar/S3)
- `c1` - [RPLIDAR A3](https://www.slamtec.ai/product/slamtec-rplidar-a3/)
- `ld06` - [LD06 LIDAR](https://www.ldrobot.com/ProductDetails?sensor_name=STL-06P)
- `ld19` - [LD19/LD300 LIDAR](https://www.ldrobot.com/ProductDetails?sensor_name=STL-19P)
- `stl27l` - [STL27L LIDAR](https://www.ldrobot.com/ProductDetails?sensor_name=STL-27L)
Expand Down
26 changes: 11 additions & 15 deletions ROBOT_INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,6 @@ If it's your first time using ROS2 and haven't created your ROS2 workspace yet,
source install/setup.bash

#### 1.2 Install LIDAR ROS2 drivers:
RPLIDAR:

sudo apt install -y ros-$ROS_DISTRO-rplidar-ros
cd /tmp
wget https://raw.githubusercontent.com/allenh1/rplidar_ros/ros2/scripts/rplidar.rules
sudo cp rplidar.rules /etc/udev/rules.d/

LDLIDAR:

cd <your_ws>
git clone https://github.com/linorobot/ldlidar src/ldlidar
sudo cp src/ldlidar/ldlidar.rules /etc/udev/rules.d/
colcon build
source <your_ws>/install/setup.bash

YDLIDAR:

cd /tmp
Expand Down Expand Up @@ -54,6 +39,17 @@ LD06 LD19 STL27L:
git clone https://github.com/hippo5329/ldlidar_stl_ros2.git src/ldlidar_stl_ros2
colcon build
source <your_ws>/install/setup.bash
cd /tmp
wget https://raw.githubusercontent.com/linorobot/ldlidar/ros2/ldlidar.rules
sudo cp ldlidar.rules /etc/udev/rules.d

RPLIDAR (A1 A2 A3 C1 S1 S2 S3):

cd <your_ws>
git clone https://github.com/Slamtec/sllidar_ros2.git
colcon build
source <your_ws>/install/setup.bash
sudo cp sllidar_ros2/scripts/rplidar.rules /etc/udev/rules.d

#### 1.3 Install depth sensor drivers:
Intel RealSense:
Expand Down
18 changes: 18 additions & 0 deletions docker/.cyclonedds.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" ?>
<CycloneDDS xmlns="https://cdds.io/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://cdds.io/config https://raw.githubusercontent.com/eclipse-cyclonedds/cyclonedds/master/etc/cyclonedds.xsd">
<Domain id="any">
<General>
<Interfaces>
<NetworkInterface name="lo"/>
</Interfaces>
<AllowMulticast>false</AllowMulticast>
</General>
<Discovery>
<ParticipantIndex>auto</ParticipantIndex>
<Peers>
<Peer Address="127.0.0.1"/>
</Peers>
<MaxAutoParticipantIndex>120</MaxAutoParticipantIndex>
</Discovery>
</Domain>
</CycloneDDS>
3 changes: 3 additions & 0 deletions docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ RUNTIME=

UBUNTU_VER=22.04
USE_ROS_DISTRO=humble

RMW=cyclonedds
# RMW=fastrtps
19 changes: 19 additions & 0 deletions docker/.fastrtps.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<dds>
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles" >
<transport_descriptors>
<transport_descriptor>
<transport_id>custom_udpv4_transport</transport_id>
<type>UDPv4</type>
</transport_descriptor>
</transport_descriptors>
<participant profile_name="no_shm_participant_profile" is_default_profile="true">
<rtps>
<useBuiltinTransports>false</useBuiltinTransports>
<userTransports>
<transport_id>custom_udpv4_transport</transport_id>
</userTransports>
</rtps>
</participant>
</profiles>
</dds>
13 changes: 12 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ ARG USE_ROS_DISTRO=
ARG UBUNTU_VER=
ARG RUNTIME=
ARG DEPLOY=
ARG RMW=

FROM --platform=$BUILDPLATFORM ros:${USE_ROS_DISTRO}-ros-base as ros2
SHELL ["/bin/bash", "-c"]
Expand Down Expand Up @@ -112,7 +113,17 @@ ENV QT_X11_NO_MITSHM=1
from ros2${RUNTIME} as common
SHELL ["/bin/bash", "-c"]

RUN wget -O /root/.shm_off.xml https://raw.githubusercontent.com/eProsima/Fast-DDS/107ea8d64942102696840cd7d3e4cf93fa7a143e/examples/cpp/dds/AdvancedConfigurationExample/shm_off.xml
ARG RMW=
RUN if [ "${RMW}" == "cyclonedds" ]; then \
apt-get update && apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \
&& rm -rf /var/lib/apt/lists/* ; \
fi

COPY docker/.${RMW}.xml /root
ENV RMW_IMPLEMENTATION=rmw_${RMW}_cpp
ENV CYCLONEDDS_URI=/root/.cyclonedds.xml
ENV FASTRTPS_DEFAULT_PROFILES_FILE=/root/.fastrtps.xml

RUN mkdir -p /root/linorobot2_ws/src/linorobot2
RUN mkdir -p /root/preinstall/base \
Expand Down
19 changes: 19 additions & 0 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ services:
- ROBOT_BASE=${ROBOT_BASE}
- LASER_SENSOR=${LASER_SENSOR}
- DEPTH_SENSOR=${DEPTH_SENSOR}
- RMW=${RMW}
target: base

dev:
Expand Down Expand Up @@ -63,13 +64,31 @@ services:
ros2 launch linorobot2_navigation slam.launch.py
rviz:=false
slam-sim:
container_name: slam-sim
extends: dev
command: >
ros2 launch linorobot2_navigation slam.launch.py
rviz:=true
sim:=true
navigate:
container_name: navigate
extends: dev
command: >
ros2 launch linorobot2_navigation navigation.launch.py
map:=/root/linorobot2_ws/src/linorobot2/linorobot2_navigation/maps/playground.yaml
rviz:=false
sim:=false
navigate-sim:
container_name: navigate-sim
extends: dev
command: >
ros2 launch linorobot2_navigation navigation.launch.py
map:=/root/linorobot2_ws/src/linorobot2/linorobot2_navigation/maps/playground.yaml
rviz:=true
sim:=true
save-map:
container_name: save-map
Expand Down
1 change: 0 additions & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@

source /opt/ros/rosdistro/setup.bash
source /root/linorobot2_ws/install/setup.bash
export FASTRTPS_DEFAULT_PROFILES_FILE=/root/.shm_off.xml

$@
50 changes: 36 additions & 14 deletions docker/install_sensors.bash
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ WORKSPACE="/root/linorobot2_ws"

ROBOT_TYPE_ARRAY=(2wd 4wd mecanum)
DEPTH_SENSOR_ARRAY=(realsense zed zedm zed2 zed2i oakd oakdlite oakdpro)
LASER_SENSOR_ARRAY=(rplidar ldlidar ydlidar xv11 ld06 ld19 stl27l)
LASER_SENSOR_ARRAY=(ydlidar xv11 ld06 ld19 stl27l a1 a2 a3 c1 s1 s2 s3)
LASER_SENSOR_ARRAY+=(${DEPTH_SENSOR_ARRAY[@]})

if [ -z "$LASER_SENSOR" ]
Expand Down Expand Up @@ -59,19 +59,6 @@ function install_xv11 {
source $WORKSPACE/install/setup.bash
}

function install_rplidar {
sudo apt-get install -y ros-$ROS_DISTRO-rplidar-ros
cd /tmp
wget https://raw.githubusercontent.com/allenh1/rplidar_ros/ros2/scripts/rplidar.rules
}

function install_ldlidar {
cd $WORKSPACE
git clone https://github.com/linorobot/ldlidar src/ldlidar
colcon build
source $WORKSPACE/install/setup.bash
}

function install_ydlidar {
cd /tmp
git clone https://github.com/YDLIDAR/YDLidar-SDK.git
Expand Down Expand Up @@ -106,6 +93,41 @@ function install_stl27l {
install_ldlidar_stl_ros2
}

function install_sllidar_ros2 {
cd $WORKSPACE
git clone https://github.com/Slamtec/sllidar_ros2.git
colcon build
source $WORKSPACE/install/setup.bash
}

function install_a1 {
install_sllidar_ros2
}

function install_a2 {
install_sllidar_ros2
}

function install_a3 {
install_sllidar_ros2
}

function install_c1 {
install_sllidar_ros2
}

function install_s1 {
install_sllidar_ros2
}

function install_s2 {
install_sllidar_ros2
}

function install_s3 {
install_sllidar_ros2
}

function install_realsense {
sudo apt-get install -y ros-$ROS_DISTRO-realsense2-camera
cd /tmp
Expand Down
14 changes: 14 additions & 0 deletions docker/sim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: linorobot2-sim-demo
on_project_start: export DISPLAY=:200
on_project_exit:
- docker compose down
tmux_options: -f $HOME/.config/tmuxinator/eztmux/.tmux.conf
windows:
- main:
panes:
- docker compose up kasmvnc
- docker compose up gazebo
- docker compose up navigate-sim

- # This is not limited to this line only
- # You can add as much panes as you want.
78 changes: 51 additions & 27 deletions install_linorobot2.bash
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ WORKSPACE="$HOME/linorobot2_ws"

ROBOT_TYPE_ARRAY=(2wd 4wd mecanum)
DEPTH_SENSOR_ARRAY=(realsense zed zedm zed2 zed2i oakd oakdlite oakdpro)
LASER_SENSOR_ARRAY=(rplidar ldlidar ydlidar xv11 ld06 ld19 stl27l)
LASER_SENSOR_ARRAY=(ydlidar xv11 ld06 ld19 stl27l a1 a2 a3 c1 s1 s2 s3)
LASER_SENSOR_ARRAY+=(${DEPTH_SENSOR_ARRAY[@]})

if [ -z "$LASER_SENSOR" ]
Expand Down Expand Up @@ -58,18 +58,21 @@ function install_xv11 {
source $WORKSPACE/install/setup.bash
}

function install_rplidar {
sudo apt install -y ros-$ROS_DISTRO-rplidar-ros
function install_ydlidar {
cd /tmp
wget https://raw.githubusercontent.com/allenh1/rplidar_ros/ros2/scripts/rplidar.rules
sudo cp rplidar.rules /etc/udev/rules.d/
}

function install_ldlidar {
git clone https://github.com/YDLIDAR/YDLidar-SDK.git
mkdir YDLidar-SDK/build
cd YDLidar-SDK/build
cmake ..
make
sudo make install
cd $WORKSPACE
git clone https://github.com/linorobot/ldlidar src/ldlidar
sudo cp src/ldlidar/ldlidar.rules /etc/udev/rules.d/
colcon build
git clone https://github.com/YDLIDAR/ydlidar_ros2_driver src/ydlidar_ros2_driver
chmod 0777 src/ydlidar_ros2_driver/startup/*
sudo echo 'KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE:="0666", GROUP:="dialout", SYMLINK+="ydlidar"' >/etc/udev/rules.d/ydlidar.rules
sudo echo 'KERNEL=="ttyACM*", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE:="0666", GROUP:="dialout", SYMLINK+="ydlidar"' >/etc/udev/rules.d/ydlidar-V2.rules
sudo echo 'KERNEL=="ttyUSB*", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", MODE:="0666", GROUP:="dialout", SYMLINK+="ydlidar"' >/etc/udev/rules.d/ydlidar-2303.rules
colcon build --symlink-install
source $WORKSPACE/install/setup.bash
}

Expand All @@ -78,6 +81,9 @@ function install_ldlidar_stl_ros2 {
git clone https://github.com/hippo5329/ldlidar_stl_ros2.git src/ldlidar_stl_ros2
colcon build
source $WORKSPACE/install/setup.bash
cd /tmp
wget https://raw.githubusercontent.com/linorobot/ldlidar/ros2/ldlidar.rules
sudo cp ldlidar.rules /etc/udev/rules.d
}

function install_ld06 {
Expand All @@ -92,22 +98,40 @@ function install_stl27l {
install_ldlidar_stl_ros2
}

function install_ydlidar {
cd /tmp
git clone https://github.com/YDLIDAR/YDLidar-SDK.git
mkdir YDLidar-SDK/build
cd YDLidar-SDK/build
cmake ..
make
sudo make install
function install_sllidar_ros2 {
cd $WORKSPACE
git clone https://github.com/YDLIDAR/ydlidar_ros2_driver src/ydlidar_ros2_driver
chmod 0777 src/ydlidar_ros2_driver/startup/*
sudo echo 'KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE:="0666", GROUP:="dialout", SYMLINK+="ydlidar"' >/etc/udev/rules.d/ydlidar.rules
sudo echo 'KERNEL=="ttyACM*", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE:="0666", GROUP:="dialout", SYMLINK+="ydlidar"' >/etc/udev/rules.d/ydlidar-V2.rules
sudo echo 'KERNEL=="ttyUSB*", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", MODE:="0666", GROUP:="dialout", SYMLINK+="ydlidar"' >/etc/udev/rules.d/ydlidar-2303.rules
colcon build --symlink-install
git clone https://github.com/Slamtec/sllidar_ros2.git
colcon build
source $WORKSPACE/install/setup.bash
sudo cp sllidar_ros2/scripts/rplidar.rules /etc/udev/rules.d
}

function install_a1 {
install_sllidar_ros2
}

function install_a2 {
install_sllidar_ros2
}

function install_a3 {
install_sllidar_ros2
}

function install_c1 {
install_sllidar_ros2
}

function install_s1 {
install_sllidar_ros2
}

function install_s2 {
install_sllidar_ros2
}

function install_s3 {
install_sllidar_ros2
}

function install_realsense {
Expand Down Expand Up @@ -190,8 +214,8 @@ if [ "$*" == "" ]
then
echo "No arguments provided"
echo
echo "Example: $ bash install_linorobot2.bash 2wd rplidar"
echo "Example: $ bash install_linorobot2.bash 2wd rplidar realsense"
echo "Example: $ bash install_linorobot2.bash 2wd a1"
echo "Example: $ bash install_linorobot2.bash 2wd a1 realsense"
echo "Example: $ bash install_linorobot2.bash 2wd - realsense"
echo "Example: $ bash install_linorobot2.bash 2wd"

Expand Down
Loading

0 comments on commit 25d1e4a

Please sign in to comment.