Project -- Slam with Lidar + IMU + encoder === #### Refer to: https://zhuanlan.zhihu.com/p/415830550 Description --- ##### Our system combined with two wheel encoders, imu with 6 DoF and a 2D lidar. First we apply a kalman filter on imu and encoder odometry, and combined this result with lidar mapping using gmapping algorithm. Components --- ##### Raspberry Pi 4B: Combine all sensor data, include some sensors preprocessed on Pi pico. ##### Pi Pico: Read and process encoder data in higher speed compared to RPi, receive control from RPi. ##### Sensors: 2D lidar, encoders, imu ##### Circuit components: motor driver, DC-DC convertor, switch Raspberry Pi ROS setup === ##### Boot the image file into sd card by dd. You can check progressing rate: $ sudo killall -29 dd ##### Recover apt-update $ sudo apt-get -y update --allow-releaseinfo-change #### As for initial setup, the usr is pi, and the password is raspberry. #### Refer to: http://sar-lab.net/teaching/ros-images-for-raspberry-pi/ Start VNC screen --- $ sudo systemctl start lightdm $ sudo touch ~/system_start.sh $ sudo echo "sudo systemctl start lightdm" >> /home/pi/system_start.sh #### Add line /home/pi/system_start.sh to file "/etc/rc.local" before "exit 0". $ chomod +x /home/pi/system_start.sh #### Now it can run when you boot. Keyboard tool --- $ pip install git+https://github.com/li-rupert/getkey@adding-osx-tests Setup ROS --- #### Refer to: https://ithelp.ithome.com.tw/articles/10203126 $ mkdir catkin_ws $ cd catkin_ws $ catkin_make $ echo "source /home/user/catkin_ws/devel/setup.bash" >> ~/.bashrc #### If we want to make the package specifically. $ catkin_make --only-pkg-with-deps <target_package> #### And remember to change back the setting. $ catkin_make -DCATKIN_WHITELIST_PACKAGES="" #### Or you can done by this. $ catkin_make --pkg <my_package_name> Setup Wire Communication --- ### i2c #### Refer to: https://blog.gtwang.org/iot/raspberry-pi-mpu6050-six-axis-gyro-accelerometer-1/ ##### First raspi-config i2c. Then test by follow. $ sudo apt-get install i2c-tools $ sudo i2cdetect -y 1 $ sudo modprobe i2c-dev $ sudo chmod 666 /dev/i2c-* ##### You should be able to see your device in one of the addresses. ##### Install C++ library for i2c. $ sudo apt-get install libi2c-dev ##### See also example for mpu6050: https://github.com/richardghirst/PiBits.git Setup RPlidar --- #### Refer to: https://www.ncnynl.com/archives/201611/1100.html $ cd catkin_ws/src $ git clone https://github.com/ncnynl/rplidar_ros.git ##### Plug in USB port and check permission, and enable permission. $ ls -l /dev |grep ttyUSB $ sudo chmod 666 /dev/ttyUSB0 ##### Set catkin_make. $ cd ~/catkin_ws $ catkin_make ##### Test code in rviz. $ roslaunch rplidar_ros view_rplidar.launch ROS ekf package --- #### Refer to: https://blog.csdn.net/qcxyliyong/article/details/103708496 #### Install orocos-bfl $ cd ~/ $ mkdir /source_code_ws $ cd /source_code_ws $ git clone https://github.com/jyLeo/orocos-bfl.git $ cd orocos-bfl $ mkdir build $ cd build $ export CMAKE_INCLUDE_PATH=/home/pi/source_code_ws/orocos-bfl/path/to/installed/library/include $ export CMAKE_LIBRARY_PATH=/home/pi/source_code_ws/orocos-bfl/path/to/installed/library/lib $ cmake .. $ make $ sudo make install #### Install robot_pose_ekf $ cd ~/catkin_ws/src $ git clone https://github.com/ros-planning/robot_pose_ekf.git $ cd .. $ catkin_make #### Reference: ##### Wheel odometry: https://wiki.ros.org/navigation/Tutorials/RobotSetup/Odom GMapping --- #### Refer to: http://wiki.ros.org/gmapping?distro=jade #### and: https://automaticaddison.com/how-to-set-up-the-ros-navigation-stack-on-a-robot/ #### and: https://www.796t.com/content/1552905625.html $ sudo apt-get install libbullet-dev $ sudo apt-get install libsdl1.2-dev #### Some need melodic devel. If you get the wrong devel version, there may be some package missing. $ cd catkin_ws/src $ git clone https://github.com/ros-perception/openslam_gmapping.git $ git clone https://github.com/ros-perception/slam_gmapping.git $ git clone --single-branch --branch melodic-dev https://github.com/ros-planning/navigation.git $ git clone --single-branch --branch melodic-dev https://github.com/ros/geometry2.git $ git clone https://github.com/ros-planning/navigation_msgs.git $ cd .. $ catkin_make #### Refer to: https://pse.is/474yav #### GMapping explanation: https://www.guyuehome.com/14967 ROS tf --- #### The tf tree composed of frame and it's child frame, a frame can have only one mother frame, but multiple child frames. #### Save tf tree as pdf file. $ rosrun tf view_frames Pi Pico Setup ===