owned this note changed 2 months ago
Published Linked with GitHub

Husky setting in ROS melodic

tags: husky

ROS install Husky

setup

cd ~/catkin_ws/src ***% comment your catkin workspace name here is mine is (catkin_ws)*** git clone https://github.com/husky/husky.git git checkout melodic-devel cd .. catkin_make sudo apt-get install ros-melodic-gazebo-ros-pkgs ros-melodic-gazebo-ros-control sudo apt-get install ros-melodic-multimaster-launch sudo apt-get install ros-melodic-lms1xx rosdep install --from-path src --ignore-src catkin_make source devel/setup.bash rosrun husky_bringup install

setting priority for port

sudo chmod 777 /dev/ttyUSB0 sudo usermod -a -G dialout [username]

Joystick setting

port

  • /dev/input/js0
  • test the joystick :
    • jstest /dev/input/js0
  • modify husky/husky_control/config/teleop_ps4.yaml and replace line 13 dev: /dev/input/ds4x as dev: /dev/input/js0

control

  • modify husky/husky_base/launch/base.launch and replace line 29 /dev/prolific as dev/ttyUSB0
  • roslaunch husky_base base.launch
  • hold LB/RB on joystick and push left analog stick control the velocity and turn rate.

PX4 imu setting

Install Mavros

sudo apt-get install ros-melodic-mavros ros-melodic-mavros-extras screen openssh-server git # 如果出現:GeographicLib exception: File not readable... sudo /opt/ros/melodic/lib/mavros/install_geographiclib_datasets.sh # about serial port problem sudo usermod -a -G tty "USER_name" ex: sudo usermod -a -G tty ncrl sudo usermod -a -G dialout "USER_name" # 更改為fcu_url:="/dev/ttyACM0:921600" sudo gedit /opt/ros/melodic/share/mavros/launch/px4.launch # 配合Qground的parameter裡的baud rate也需要改 # 如果出現:FCU: DeviceError:serial:open: Permission denied chmod 777 /dev/ttyACM0 # test roslaunch mavros px4.launch # 確認是否回傳 IMU detected 和 /mavros/imu/data_raw # 如果沒有回傳就斷開 pixhawk 的 type C 並重新接上

px4相關設參考:https://hackmd.io/TNvNXB9sQoilNvrLHINYDw

Lidar Velodyne VLP16 setting

使用網路線連接lidar與電腦
新增網路:
Address:192.168.1.100
Netmask:255.255.255.0
Gateway:0.0.0.0

設定後開啟瀏覽器輸入網址:192.168.1.201

install ROS dependencies and VLP-16 driver

sudo apt-get install ros-VERSION-velodyne cd ~/catkin_ws/src/ && git clone https://github.com/ros-drivers/velodyne.git rosdep install --from-paths src --ignore-src --rosdistro melodic -y cd ~/catkin_ws/ && catkin_make

Viewing the data

roslaunch velodyne_pointcloud VLP16_points.launch #check rostopic 是否有點雲資料 rostopic echo /velodyne_points #view the data in rviz rosrun rviz rviz -f velodyne

rviz設定

  1. In the "displays" panel, click "Add", then select "Point Cloud2", then press "OK".
  2. In the "Topic" field of the new "Point Cloud2" tab, enter "/velodyne_points".

    參考連結:http://wiki.ros.org/velodyne/Tutorials/Getting Started with the Velodyne VLP16

install NCRL_lio

Prerequisites

1.ceres
2.PCL

安裝ceres

注意
須下載1.14.0版本,可在官方github切換版本。
官網:http://ceres-solver.org/installation.html

git clone https://ceres-solver.googlesource.com/ceres-solver git checkout 1.14.0 # CMake sudo apt-get install cmake # google-glog + gflags sudo apt-get install libgoogle-glog-dev libgflags-dev # BLAS & LAPACK sudo apt-get install libatlas-base-dev # Eigen3 sudo apt-get install libeigen3-dev # SuiteSparse and CXSparse (optional) sudo apt-get install libsuitesparse-dev mkdir ceres-bin cd ceres-bin cmake ../ceres-solver make -j3 sudo make test # Optionally install Ceres, it can also be exported using CMake which # allows Ceres to be used without requiring installation, see the documentation # for the EXPORT_BUILD_DIR option for more information. sudo make install

安裝PCL

注意
須下載1.8.1版本以上,可在官方github切換版本。

git clone https://github.com/PointCloudLibrary/pcl.git git checkout pcl-1.8.1 #安裝以下第三方程式 sudo apt-get update sudo apt-get install git build-essential linux-libc-dev sudo apt-get install cmake cmake-gui sudo apt-get install libusb-1.0-0-dev libusb-dev libudev-dev sudo apt-get install mpi-default-dev openmpi-bin openmpi-common sudo apt-get install libflann1.8 libflann-dev sudo apt-get install libeigen3-dev sudo apt-get install libboost-all-dev sudo apt-get install libvtk6-dev sudo apt-get install libqhull* libgtest-dev sudo apt-get install freeglut3-dev pkg-config sudo apt-get install libxmu-dev libxi-dev sudo apt-get install mono-complete sudo apt-get install qt-sdk openjdk-8-jdk openjdk-8-jre sudo apt-get install libflann-dev #進行編譯 cd pcl mkdir release cd release cmake -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_PREFIX=/usr \ -DBUILD_GPU=ON-DBUILD_apps=ON -DBUILD_examples=ON \ -DCMAKE_INSTALL_PREFIX=/usr .. make -j6 sudo make install

install ncrl_lio

cd catkin_ws/src git clone https://github.com/SLAM-NCRL/ncrl_lio.git catkin_make
  • 修改ncrl_lio/config/run.yaml 將31到33行參數,修改內容為IMU到Lidar的x,y,z距離
  • 修改ncrl_lio/launch/run.launch 將第6行<param name="use_sim_time" value="true"/> 更改為<param name="use_sim_time" value="false"/>

Testing

#開啟手把控制 roslaunch husky_base base.launch #打開px4 IMU roslaunch mavros px4.launch #打開 Lidar roslaunch velodyne_pointcloud VLP16_points.launch #開啟ncrl_lio roslaunch ncrl_lio run.launch
  • 須確認行進路徑與rviz上顯示路徑的是否正確
Select a repo