Skip to content

canf-map/libqrc

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LIBQRC

Qualcomm QRB ROS

a library to communicate between APPs and motor control board

Qualcomm Ubuntu Jazzy

πŸ‘‹ Overview

This library is used for Qualcomm-specific AMR.
libqrc is is a dynamic library designed to facilitate robust and efficient communication between applications and the Motor Control Board (MCB).
It serves as an abstraction layer, providing APIs for upper-layer applications, covering transport protocol management, message handling, and low-level device operationsa.

architecture

LIBQRC includes two components: QRC protocol and QRC user driver.
The QRC protocol, which is based on the TinyFrame protocol, is designed for upper-layer robotics applications, while the QRC user driver is responsible for invoking low-level drivers.
When upper-layer applications need to send data to the MCB, the QRC protocol encapsulates the data, which is then transmitted to the MCB via the QRC user driver. Similarly, data returned from the MCB is received by the QRC user driver and parsed by the QRC protocol.


πŸ”Ž Table of Contents


βš“ APIs

πŸ”Ή libqrc APIs

Please see libqrc/include/module/qrc_msg_management.h

simple example

#include "qrc_msg_management.h"
#include "client_control_msg.h"

int main(int argc, char ** argv)
{
    struct qrc_pipe_s * pipe_ = nullptr;
    char *data = "hello";
    size_t len = strlen(data);
    bool ack = true;

    init_qrc_management();  //initialize qrc procotol
    pipe_ = qrc_get_pipe(CLIENT_PIPE);  //get a new or exited pipe
    auto callback = [](struct qrc_pipe_s *, void * data, std::size_t, bool) {
        message_handle(data);   //user-defined
    };
    qrc_register_message_cb(pipe_, callback);   //register callback function of pipe
    qrc_write(pipe, (uint8_t *)data, len, ack); //write data with lock
}

πŸ”Ή libqrc-udriver APIs

Please see libqrc-udriver/include/qti_qrc_udriver.h

simple example

#include "qti_qrc_udriver.h"

int main(int argc, char ** argv)
{
    ssize_t num = -1;
    size_t length = 10;
    char * tx_buffer = (char *)malloc(length);
    memcpy(tx_buffer, "hello", 6);

    int fd = qrc_udriver_open();    //open tty device
    qrc_udriver_tcflsh(fd); //flush the input and output buffer of the tty device
    qrc_udriver_write(fd, tx_buffer, length);   //write data to tty device
    free(tx_buffer);
    qrc_udriver_close(fd);  //close tty device
}

🎯 Supported Targets

Development Hardware Hardware Overview Comment
Qualcomm Dragonwingβ„’ RB3 Gen2
Qualcomm Dragonwingβ„’ IQ-9075 EVK It will be available on Canonical Ubuntu-24.04-x05.
Dependent Hardware Hardware Overview Description
Motor Control Board This board needs to be plugged into the Development Hardware.

✨ Build from source code

Important

PREREQUISITES: The following steps need to be run on ROS Jazzy.
Reference Install ROS Jazzy to setup environment.
For Qualcomm Linux, please check out the Qualcomm Intelligent Robotics Product SDK documents.

Install dependencies:

sudo apt update
sudo apt install -y libgpiod-dev=1.6.3-1.1build1

Download the source code and build with colcon:

source /opt/ros/jazzy/setup.bash && \
mkdir -p ~/ros_ws/src && cd ~/ros_ws/src && \
git clone https://github.com/qualcomm-qrb-ros/libqrc.git && \
sudo cp libqrc/rules/99-qcom-qrc.rules /usr/lib/udev/rules.d/ && \
sudo udevadm control --reload-rules && sudo udevadm trigger && \
cd ~/ros_ws/ && \
colcon build

πŸš€ Usage

Important

PREREQUISITES:The Motor Control Board needs to be plugged into the Qualcomm device.

πŸ”Ή Application

For specific applications, please see qrb_ros_robot_base

πŸ”Ή Test the communication between the Qualcomm device and The MCB

πŸ”Œ Connecting to the MCB UART

You can access the UART interface of the MCB using one of the following methods:
Method 1: Direct Connection via PC/Server

  • Connect the UART port of the MCB directly to your PC or server using a serial cable.

Method 2: Connection via Qualcomm Device

  • Connect the UART port of the MCB to a Qualcomm device.

  • On the Qualcomm device, access the MCB UART interface with the following command:

      #Replace `ttyUSBx` with the actual device node assigned after connection.
      sudo microcom -s 115200 -p /dev/ttyUSBx

πŸ”Œ Execute the command

  # On the Motor Control Board
  uart_test_app

  # On the Qualcomm device
  cd ~/ros_ws/ && \
  source install/local_setup.bash && \
  qrc_udriver_test -s 10 -t 10

🀝 Contributing

Thanks for your interest in contributing to libqrc! Please read our Contributions Page for more information on contributing features or bug fixes. We look forward to your participation!


πŸ“œ License

Libqrc is licensed under the BSD-3-clause "New" or "Revised" License.

Check out the LICENSE for more details.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C 97.2%
  • CMake 2.8%