Skip to main content
Version: QTrobot V2

Quick start with coding on QTrobot

This document guides you towards quick start coding on the QTrobot using programming languages. If you are looking for graphical programming, please take a look at Quick start with QTrobot studio.

1. Understanding QTrobot architecture​

QTrobot is a high-end research platform with powerful computers and state-of-the-art hardware such as 3D camera and far-field microphone array. It comes with two computers: i) QTRP, a Raspberry Pi based computer to control the main hardware and ii) QTPC, an Intel® NUC i5/i7 PC to provide more computational power and to accelerate software development cycle. Both computers run on Ubuntu/Debian Linux operating systems and leverage ROS to offer easy-to-use yet very flexible software architecture. QTrobot's hardware is easily extendable via USB-C and USB adaptors, for example, to connect external monitor, keyboard and mouse. QTrobot also provides a rich set of APIs for several programing languages such as C++, Python and JavaScript.

qtrobot

Internal Setup​

As it is shown in the following diagram, QTrobot consists of two computers, one in the QTrobot head (QTRP) and the other in the body (QTPC), which are internally connected via ethernet cable. All of the QTrobot devices such as display, speakers, microphone and motors are connected to QTRP except the 3D Camera which is connected directly to QTPC. The Wi-Fi of the QTRP is used to create the QTrobot hotspot with the same SSID as the robot’s serial number (e.g. QTRD000101).

architecture

Both computers are configured to interact in one ROS environment. Upon starting the QTrobot, QTRP runs the roscore and initializes the ROS environment. It also turn on QTPC via wake-on-lan when the ROS environment is up. You will also find two USB port at the back of the QTrobot. One of the is attached to QTRP and the second one (USB-C) is connected to QTPC. This USB-C port can be used to connect keyboard,mouse and monitor via a USB-C extension hub to QTPC.

Notice

QTPC is already configured to work with roscore which is running on QTRP and you can access all QTrobot ROS services ands topics.

2. Prepare your setup​

There are few ways of developing code for QTrobot. We strongly recommend you to start developing directly on QTrobot's integrated QTPC. As it is shown in the following picture, you need to prepare:

  a keyboard,
  a mouse,
  and a monitor with HDMI cable.

rdsetup

Step 1. Turn on QTrobot​

To power the QTrobot on, simply connect the QTrobot's power supply1.This triggers the power on process and your QTrobot becomes ready less than a minute. After powering on, you can see the QTrobot face is on and the motors are in their home position. If the QTrobot is already connected to the power supply simply push the power button to turn on the QTrobot.

Step 2. Connect keyboard/mouse and monitor to QTPC​

Connect keyboard, mouse and HDMI Monitor to your USB-C extension then plug it in the USB-C port at the back of QTrobot.

Step 3. Wait for QTPC to boot​

After you turned on your QTrobot it will need some time until your QTPC turns on, because QTRP will turn on QTPC after ROS environment is up. You will see the Ubuntu desktop of QTPC and you can use in the same way you use a standard desktop for development.

QTPC
Powering off QTrobot

To power off the QTrobot simply press the power button on the back of the QTrobot. This will turn off both QTRP and QTPC. Wait enough for QTrobot to turn off before unplugging it from power supply: a blue screen shows up immediately goes off.

Now you should be all settled and ready for coding. However, in most cases you need to have access to the internet. So let's follow the next section to connect your QTrobot to your home/office router and the Internet.

3. Connect QTrobot to a home network and Internet​

To have access to the internet from all machines (as it is demonstrated in the following diagram_, the Wi-Fi of QTRP should be connected to your home router. The internet from the home router, is shared to all other machines (including QTPC) via QTRP. The green arrows shows the direction and how internet shared between QTRP and QTPC.

Therefore, you need to connect the QTRP to your home router's Wi-Fi. To do that do the following steps:

Step 1. Access QTRP via ssh​

From the Ubuntu desktop of QTPC, open a terminal and access QTRP via ssh:

ssh developer@192.168.100.1
# or ssh developer@QTRP

For the password use qtrobot.

Step 2. Configure qt_wlan0_client service​

First, edit the /etc/wpa_supplicant/wpa_supplicant-wlan0.conf file to update ssid and psk accordingly.

cd /etc/wpa_supplicant
sudo nano wpa_supplicant-wlan0.conf

set the ssid (your router ssid) and psk (your router passphrase) of your home router setup:

country=LU
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid="<your router SSID>"
psk="<your router passphrase>"
}

Next, restart the qt_wlan0_client service:

sudo systemctl restart qt_wlan0_client.service
Warning
  • Pay attention that the values for ssid and psk are wrapped with double quotation marks!
  • Pay attention to the <TAB> before ssid and psk!
  • Do not create or change any other files related to wpa_supplicant or systemd network! this may break your QTrobot network setup!
  • Ensure that you are modifying the wpa_supplicant-wlan0.conf file and NOT wpa_supplicant.conf

Step 3. Test and make it permanent​

After following the above steps, your QTrobot should be connected to your home/office network and have access to the Internet (i.e. you should be able to ping www.google.com for example).

ping www.google.com

Disable the qt_wlan0_ap service and enable the qt_wlan0_client service to keep QTrobot internet configuration permanent:

sudo systemctl enable qt_wlan0_client.service
sudo systemctl disable qt_wlan0_ap.service

You are all settled! QTRP gets internet connection from your router and will automatically share it with QTPC and any other devices connected to QTrobot Wi-FI hotspot.

Troubleshooting
  • Check if QTrobot is connected to your home/office network. Run the following command on QTRP via ssh: sudo wpa_cli -i wlan0 status. You should see wpa_state=COMPLETED and the correct ssid is reported.
  • Double check that you have entered correct values for ssid and psk in /etc/wpa_supplicant/wpa_supplicant-wlan0.conf!
  • See the status of the qt_wlan0_client service for any typo or misformatted lines in /etc/wpa_supplicant/wpa_supplicant-wlan0.conf. To do that, run the following command on QTRP: sudo systemctl status qt_wlan0_client.service this should shows that the service is running and active. If not, follow the error messages reported by the service.
  • If you are connected to your home/office network (by checking the previous command) but still does not have access to the internet (e.g. cannot ping google), please double check that your home/office network providing any internet connection!
Additional Networking information

For more informations about QTrobot's networking and to learn how to re-enable QTrobot's hotspot, please check Computation and networking.


4. Optional ways of working with QTrobot​

Step 1. Setup your ROS environment​

Notice

For this steps you will need ROS installed on your computer. If you don't have it please follow this installation instructions

  1. Install QTrobot ROS headers files on your laptop

    Clone QTrobot Software repository.

    cd ~/
    git clone https://github.com/luxai-qtrobot/software.git

    Copy the headers folder or make a link in your Catkin source workspace:

    cd ~/catkin_ws/src
    ln -s ~/software/headers ./

    Build the messages in your Catkin worksapce

    cd ~/catkin_ws
    catkin_make
    ```

  2. Configure ROS environment for QTrobot

    Connect to the QTrobot Wi-Fi hotspot. Then open a terminal on your laptop and run the following command:

    ifconfig

    Write down or copy IP address that is written of WiFi inet (e.g. 192.168.4.25)

    wifi0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 192.168.4.25 netmask 255.255.255.0 broadcast 10.42.0.255
    ...

    Edit ~/.bash_aliases on your laptop/PC and add following lines. Change ROS_IP to your IP from last step.

    source /opt/ros/noetic/setup.bash
    source ~/catkin_ws/devel/setup.bash

    ## QTrobot
    export ROS_IP=<your PC IP address> # e.g. 192.168.4.25
    export ROS_MASTER_URI=http://<your QTrobot serial>:11311 # e.g. http://QTRD000100.local:1131

    To apply this configuration run this command:

    source ~/.bash_aliases

Step 2. Test your setup​

Last step is to connect to the QTrobot Wi-Fi hotspot and test your ROS environment. One option is to list all ROS topics that are running on QTRobot:

rostopic list

If everything is working you should see output similar to this one.

/rosout    
/qt_robot/audio/play
/qt_robot/behavior/talkAudio
/qt_robot/emotion/show
/qt_robot/gesture/play
/qt_robot/head_position/command
/qt_robot/joints/state
...

or call some of the QTrobot ROS interfaces:

rosservice call /qt_robot/speech/say "message: 'Hello.'"

You will hear QTrobot say Hello.

Note

IF you encounter any issue for calling rosservice from your laptop such as delayed response, just add the following line to the /etc/hosts file on your laptop:

192.168.4.1  <your QTrobot serial>  # e.g. QTRD000100.local 
All done 😉

Congratulation. You are all settled and ready to start programming with QTrobot. Now you can follow plenty of exciting Tutorials.


  1. Only use the provided power supply with your QTrobot.↩
  2. Windows users can use Putty (www.putty.org)↩