GSoC Weekly Update: Week 8
Week 8 :
Creation of agl-ros2-ydlidar feature template
-
Create agl-ros2-ydlidar feature template with addition of BBLAYER and CONF files.
# Change into AGL feature directory $ cd $AGL_TOP/master/meta-agl/templates/feature/ $ mkdir agl-ros2-ydlidar # Edit BBLAYER & CONF files $ vim agl-ros2-ydlidar/50_bblayers.conf.inc BBLAYERS =+ " \ ${METADIR}/external/meta-openembedded/meta-python \ ${METADIR}/external/meta-ros/meta-ros-common \ ${METADIR}/external/meta-ros/meta-ros-backports-gatesgarth \ ${METADIR}/external/meta-ros/meta-ros2 \ ${METADIR}/external/meta-ros/meta-ros2-foxy \ " $ vim agl-ros2-ydlidar/50_local.conf.inc #meta-ros2-ydlidar IMAGE_INSTALL_append = " packagegroup-ros-world-foxy"
Build master/x86: meta-ros + agl-image-weston + YDLIDAR support using agl-ros2-ydlidar feature
-
Kindly go through build process of AGL and building for x86 for detailed reference to setup and initialize AGL workspace.
# Clone the meta-ros layer, skip if already cloned $ cd $AGL_TOP/master/external $ git clone https://github.com/ros/meta-ros.git $ cd meta-ros $ git checkout -b dunfell # Setup build directory $ cd $AGL_TOP/master/ $ source meta-agl/scripts/aglsetup.sh -b build-x86-meta-ros-weston-agl-ros2-ydlidar agl-devel agl-ros2-ydlidar $ ln -sf $AGL_TOP/site.conf conf/ $ ls -alh conf/ # Edit the following conf files : $ vim conf/local.conf #add the following to the bottom, to save error logs for future debugging # local.conf INHERIT += "buildhistory" BUILDHISTORY_COMMIT = "1" # Build the image $ cd $AGL_TOP/master/build-x86-meta-ros-weston-agl-ros2-ydlidar/ $ source agl-init-build-env #if not sourced $ bitbake -p ros-core #build ros-core first, to check all layers are added. $ time bitbake agl-image-weston #wait for the build process to finish.
Run core-master/x86: meta-ros + agl-image-weston + YDLIDAR support using agl-ros2-ydlidar feature
-
Kindly use pre-built image agl-demo-core-qemux86-64, if you want to skip the building process.
-
Kindly go through using prebuilt x86 images for detailed reference to setup and initialize AGL workspace.
# gdrive : https://drive.google.com/drive/folders/1w_8XsVA3sSjk2K8rVSUbUKfRAWw71mQy?usp=sharing # Install the dependencies $ apt-get install qemu $ sudo apt install vinagre $ sudo apt install qemu-system-x86 # Copy image and kernel files $ cp ~/Downloads/agl-image-weston-qemux86-64.ext4 ./ $ cp ~/Downloads/bzImage ./ $ sync # Run $ vim startup.sh # attach YDLIDAR to the host system. #-device usb-host,hostbus=1,hostport=1, change accordingly to ydlidar usb port `lsusb -t` ( sleep 5 && vinagre --vnc-scale localhost ) > /tmp/vinagre.log 2>&1 & qemu-system-x86_64 -device virtio-net-pci,netdev=net0,mac=52:54:00:12:35:02 -netdev user,id=net0,hostfwd=tcp::2222-:22 \ -drive file=agl-image-weston-qemux86-64.ext4,if=virtio,format=raw -show-cursor -usb -usbdevice tablet -device virtio-rng-pci \ -device usb-host,hostbus=1,hostport=1 -vga virtio \ -vnc :0 -soundhw hda -machine q35 -cpu kvm64 -cpu qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt -enable-kvm \ -m 2048 -serial mon:vc -serial mon:stdio -serial null -kernel bzImage \ $ sudo ./startup.sh # Boots up qemu-system-x86_64: -usbdevice tablet: '-usbdevice' is deprecated, please use '-device usb-...' instead qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2] Automotive Grade Linux 11.91.0+snapshot qemux86-64 ttyS1 qemux86-64 login: root ## Run ROS. root@qemux86-64:~# source /usr/bin/ros_setup.sh root@qemux86-64:/# echo $LD_LIBRARY_PATH /usr/lib/x86_64-linux-gnu:/usr/lib ## Run YDLIDAR. root@qemux86-64:/# cd /usr/share/ydlidar_ros2_driver/ root@qemux86-64:/# vim params/ydlidar.yaml # Edit accordingly, for YDLIDAR X4 : ydlidar_ros2_driver_node: ros__parameters: port: /dev/ttyUSB0 frame_id: laser_frame ignore_array: "" baudrate: 128000 lidar_type: 1 device_type: 0 sample_rate: 5 abnormal_check_count: 4 resolution_fixed: true reversion: false inverted: true auto_reconnect: true isSingleChannel: false intensity: false support_motor_dtr: true angle_max: 180.0 angle_min: -180.0 range_max: 12.0 range_min: 0.1 frequency: 8.0 invalid_range_is_inf: false root@qemux86-64:/usr/share/ydlidar_ros2_driver# ros2 launch launch/ydlidar_launch.py # YDLIDAR starts spinning # In a new terminal, ssh into qemu : $ ssh -p 2222 root@localhost root@qemux86-64:~# source /usr/bin/ros_setup.sh root@qemux86-64:/# echo $LD_LIBRARY_PATH /usr/lib/x86_64-linux-gnu:/usr/lib root@qemux86-64:~# ros2 topic list -t /parameter_events [rcl_interfaces/msg/ParameterEvent] /rosout [rcl_interfaces/msg/Log] /scan [sensor_msgs/msg/LaserScan] /tf_static [tf2_msgs/msg/TFMessage] /ydlidar_ros2_driver_node/transition_event [lifecycle_msgs/msg/TransitionEvent] root@qemux86-64:~# ros2 topic echo /scan # View data stream # In either terminal root@qemux86-64:/# poweroff #else, runs in background