# Develop a robotic application

Source: [https://docs.qualcomm.com/doc/80-70015-265/topic/develop-your-first-application_6.html](https://docs.qualcomm.com/doc/80-70015-265/topic/develop-your-first-application_6.html)

The following example provides a general procedure for developing a ROS application
    using the QIRP SDK, using a ROS2 demo application on GitHub as an example.

## About this task

**Prerequisites:**
- **Required for all cases**
    Enable `SSH` in ‘Permissive’ mode with
              the steps mentioned in [Use SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/how_to.html#use-ssh).
- **Required when using the prebuilt package**
    - The prebuilt robotics image is flashed, see [Flash and install](https://docs.qualcomm.com/doc/80-70015-265/topic/flash-and-install_4_3.html).
    - The prebuilt QIRP SDK is downloaded.

**Steps:**

## Procedure

1. Set up the cross-compile environment.
        
cd <qirp_decompressed_workspace>/qirp-sdk
        source setup.sh
        Copy to clipboard
2. Fetch the project and write your own code.
    1. Fetch a project from GitHub.
            
git clone https://github.com/ros2/demos.git -b humble
            cd demos/demo_nodes_cpp
            vim src/topics/talker.cppCopy to clipboard
    2. Develop your own application. The following is a sample.
            
Change the `demo_nodes_cpp/src/topics/talker.cpp` msg data in
                line46, such as changing 'Hello world' to 'get message success'：

            46:msg_->data = "get message success " + std::to_string(count_++);
            Copy to clipboard
3. Compile the application.
        
export AMENT_PREFIX_PATH="${OECORE_TARGET_SYSROOT}/usr;${OECORE_NATIVE_SYSROOT}/usr"
        export PYTHONPATH=${PYTHONPATH}:${OECORE_TARGET_SYSROOT}/usr/lib/python3.10/site-packages
        colcon build --merge-install --cmake-args \
         -DPython3_NumPy_INCLUDE_DIR=${OECORE_TARGET_SYSROOT}/usr/lib/python3.10/site-packages/numpy/core/include \
         -DCMAKE_STAGING_PREFIX=$(pwd)/install \
         -DCMAKE_PREFIX_PATH=$(pwd)/install/share \
         -DBUILD_TESTING=OFF \
         --packages-up-to demo_nodes_cpp
        Copy to clipboard
4. Push the demo to the device.
        
cd demo_nodes_cpp/install
        tar -czvf demo_nodes_cpp.tar.gz lib share
        scp demo_nodes_cpp.tar.gz root@[ip-addr]:/opt/
        ssh root@[ip-addr] 
        (ssh) tar -zxf /opt/demo_nodes_cpp.tar.gz -C /opt/qcom/qirp-sdk/usr/Copy to clipboard
5. Run the demo application on the device.
        
(ssh) export HOME=/opt
        (ssh) source /usr/bin/ros_setup.sh && source /opt/qcom/qirp-sdk/qirp-setup.sh 
        (ssh shell 1) ros2 run demo_nodes_cpp talker
        (ssh shell 2) ros2 run demo_nodes_cpp listenerCopy to clipboard

Last Published: Oct 15, 2024

[Previous Topic
Flash and install](https://docs.qualcomm.com/bundle/publicresource/80-70015-265/topics/flash-and-install_4_3.md) [Next Topic
QIRP SDK sample applications](https://docs.qualcomm.com/bundle/publicresource/80-70015-265/topics/qirp-sdk-sample-applications_5.md)