# Generate and install slam-gmapping IPKs

Manually generate the slam-gmapping IPK files and install to the device.

**Generation**

**Steps:**

1. Create a folder named `slam-gmapping` in `<workspace>/layers/meta-qcom-robotics/recipes`. Then, write two recipes in the `slam-gmapping`folder: `openslam-gmapping.bb` and `slam-gmapping.bb`.

    openslam-gmapping.bb sample code:

inherit ros_distro_humble
        inherit ros_component
        
        DESCRIPTION = "Openslam gmapping"
        LICENSE = "CreativeCommons-by-nc-sa-2.0"
        LIC_FILES_CHKSUM = "file://package.xml;beginline=8;endline=8;md5=d566ef916e9dedc494f5f793a6690ba5"
        
        DEPENDS += "ament-cmake-native ament-cmake"
        ROS_BRANCH ?= "branch=eloquent-devel"
        SRC_URI = "git://github.com/Project-MANAS/slam_gmapping.git;${ROS_BRANCH};protocol=https"
        SRCREV = "771cfc7eae454aecb4e83c22a0b88656f2880c6c"
        S = "${WORKDIR}/git/openslam_gmapping"
        
        ROS_BUILD_TYPE = "ament_cmake"
        
        inherit ros_${ROS_BUILD_TYPE} robotics-package
        
        FILES:${PN}:prepend = "${datadir}/openslam_gmapping"
        FILES:${PN} += "${libdir}/*"

        INSANE_SKIP:${PN} += "installed-vs-shipped"
        Copy to clipboard

    slam-gmapping.bb sample code:

inherit ros_distro_humble
        inherit ros_component
        
        DESCRIPTION = "Slam gmapping"
        LICENSE          = "Qualcomm-Technologies-Inc.-Proprietary"
        LIC_FILES_CHKSUM = "file://package.xml;beginline=13;endline=13;md5=d566ef916e9dedc494f5f793a6690ba5"
        
        DEPENDS += " \
            ament-cmake-native \
            ament-cmake \
            std-msgs \
            nav-msgs \
            tf2 \
            tf2-ros \
            tf2-geometry-msgs \
            message-filters \
            rclcpp \
            sensor-msgs \
            visualization-msgs \
            openslam-gmapping \
        "
        
        CXXFLAGS += "-Wno-format-security"
        
        ROS_BRANCH ?= "branch=eloquent-devel"
        SRC_URI = "git://github.com/Project-MANAS/slam_gmapping.git;${ROS_BRANCH};protocol=https"
        SRCREV = "771cfc7eae454aecb4e83c22a0b88656f2880c6c"
        S = "${WORKDIR}/git/slam_gmapping"
        
        ROS_BUILD_TYPE = "ament_cmake"
        
        inherit ros_${ROS_BUILD_TYPE} robotics-package
        
        FILES:${PN}:prepend = "${datadir}/slam_gmapping"
        FILES:${PN} += "${libdir}/*"

        INSANE_SKIP:${PN} += "installed-vs-shipped"
        Copy to clipboard
2. Use the Yocto mechanism to compile the two recipes. The compilation generates the IPKs in the relative build directory.

cd <workspace>
        MACHINE=qcs6490-rb3gen2-vision-kit DISTRO=qcom-robotics-ros2-humble QCOM_SELECTED_BSP=custom source setup-robotics-environment build-qcs6490-custom
        bitbake openslam-gmapping -c do_package_write_ipk
        bitbake slam-gmapping -c do_package_write_ipk
        Copy to clipboard

    The following IPKs `<slam-gmapping.ipks>` are generated:

    - `<workspace>/build-qcs6490-custom/tmp-glibc/deploy/ipk/qcm6490/openslam-gmapping_1.0-r0_qcm6490.ipk`
    - `<workspace>/build-qcs6490-custom/tmp-glibc/deploy/ipk/qcm6490/slam-gmapping_1.0-r0_qcm6490.ipk`

**Installation**

**Steps:**

1. Install the IPK files to the device.

scp <slam_gmapping.ipks> root@[ip-addr]:/opt/
        ssh root@[ip-addr]
        (ssh) mount -o remount,rw /usr
        (ssh) cd /opt/
        (ssh) opkg install --force-reinstall --force-overwrite --force-depends *.ipk
        Copy to clipboard
2. In the `/usr/share/slam_gmapping/launch` folder of your device, modify the `slam_gmapping.launch.py` as follows. Then the `slam_gmapping` node can run properly.

from launch import LaunchDescription
        from launch.substitutions import EnvironmentVariable
        import launch.actions
        import launch_ros.actions
        
        def generate_launch_description():
            use_sim_time = launch.substitutions.LaunchConfiguration('use_sim_time', default='false')
            return LaunchDescription([
                launch_ros.actions.Node(
                    package='slam_gmapping', executable='slam_gmapping', output='screen', parameters=[{'use_sim_time':use_sim_time}]),
            ])
        Copy to clipboard

Last Published: Dec 30, 2024

Previous Topic
 
Set up the runtime environment for samples Next Topic

Install Rviz2