QTrobot Blocks reference
Basic blocks
Basic blocks are those that you can find in the Blocks
tab in QTrobot studio. These custom blocks are meant to program QTrobot basic functionalities such as speech, emotion, gestures etc. Moreover, there are also some custom control blocks which you can use to control the flow of your program and interact with Educator app.
Start block
This is a start block. Every program that you create MUST start with Start Block
and everything else should be connected to it is shown in the left picture bellow. If you don't connect block to the start block (as show in right picture) the game will not work. To use your custom audio or image you need to provide correct path to the folder you want to use in the Start Block. For example if you have your images saved in folder <your-username>/kids/toys/
you would need to enter into images path /kids/toys/
.
- path to Faces folder (optional)
- path to Audios folder (optional)
- path to Images folder (optional)
- default Language
Show, says and act block
- an emotion to show
- a text message to speak out by the robot
- a gesture to be played by the robot
To show a face (for example happy face), you can simply drag and drop the face into this block as shown here:
You can use this block to do multiple action at the same time. For example, to play a gesture and talk, you can write your text message and drag and drop a gesture into this block as shown here:
- Special characters: You can use some special characters such as exclamation mark in your text messages to change the intonation of the word. For example, if you write
Hello!
(with exclamation mark) QTrobot pronounces it with different intonation thanHello
. Take a look at Exclamations section of your language of choice for more tips and tricks. - vocal smileys: You can use some keywords to create some special sounds by QTrobot. There are called vocal smileys. For example
#LAUGH01#
makes QTrobot to laugh. Pay attention to the#
which surrounds the word. Take a look at Sounds section of your language of choice for more tips and tricks.
Show, plays and act block
This block can shows an emotion on QTrobot face, plays audio file and at the same time play a gesture by the robot. It has three inputs:
- an emotion to show
- a audio file to play
- a gesture to be played by the robot
To show a face (for example happy face), you can simply drag and drop the face into this block as shown here:
Repeat block
This block repeats the execution of the attached blocks.
For example to repeat 2 times clapping
gesture it would look like this:
Random block
This block will randomly preform one of the attached blocks.
With pressing on settings icon we can select how many choices we want to use.
In this example QTrobot will execute bye
or clapping
gesture:
Report block
This blocks adds report to the LuxAI data collection and analytics. Using Note for reporting, you can specify the note for the report field such as the question being asked by the QTrobot along with extra information such as Human assisted, QTrobot assisted or Tablet assisted. These extra information can become useful to evaluate whether the learner has received any help for answering that specific question.
Finally, you can specify whether the answer given by learner is Correct or Wrong.
Pause block
This block will pause preforming the program until you press continue.
There is another block, which pauses for selected time in seconds:
Select block
With this block we can control which sets of blocks will be preformed.
With this example, when we run this block we will get two options to select from on Educator
tablet:
If we choose happy
, QTrobot will show happy
face and preform hoora
gesture, but if we choose bye
, QTrobot will say Goodbye!
and preform bye
gesture.
Kid tablet blocks
Kid tablet blocks are those that you can find in the Kid Tablet
tab in QTrobot studio. These custom blocks are meant for showing images on the Learner
tablet.
Show clickable images block
This block will show clickable images on the Learner
tablet. When you want to show your image e.g. img-1.PNG
on Learner tablet, you will need to write the name of the image without file extension (e.g. .PNG
or .jpg
).
For example when one of the images is clicked we can preform some gestures:
Show unclickable images block
This block will show unclickable images on the Learner
tablet.
Show reference image block
This block will show one reference unclickable image on top and clickable images to choose below on the Learner
tablet.
LuxAI ROS Blocks
LuxAI ROS blocks are very flexible and powerful blocks to handle complex ROS messages and interact with other publishers, subscribers and services that you can find in the ROS
tab in QTrobot studio. These blocks enable developers to extend their application beyond the capabilities of blockly and add limitless functionalities to their programs.
Message object block
To provide a generic way to interact with ROS software, we need to handle every type of ROS messages and parameters of services. There are two different blocks in QTrobot studio: one creates generic message object and the other extracts field values from a message object.
The Create object block uses key-value pairs to construct ROS message and service parameters. Key is simply the name of an item in a message or parameter of a service. Value can be simple string, number, list or even another object. Following examples show how to use QTrobot Studio Create object block to represent some ROS messages and service parameters.
To extract specific value from an object, we can use Get element block. It extracts the value of a given key. Let's take a look at the following examples.
As you can see in the above examples, to get the value of an item, we simply need to specify its key in our Get element block.
ROS Publisher block
Let's see how we can publish a message using ROS Publisher block. Imagine we want to publish 'Hello QT!' message to /qt_robot/speech/say topic. We also know that the required message type is std_msgs/String. Therefore, we can use the ROS Publisher block as follows:
The aim of above example is to show how we can use ROS Publisher block to publish a simple string message. However for QTrobot speech interface, you need to use the dedicated 'QTrobot shows/says/acts' block!
ROS Subscriber block
Let's see how we can use our ROS Subscriber blocks. Imagine we want to read robots joint positions. First we read the a message from /qt_robot/joints/state topic and store it in a variable (e.g. JointsState). From sensor_msgs/JointState message format, we know that we need to extract the position value. Therefore, we can use Get element block to retrieve the value of position item from our message object. Now we have a list (e.g. JointsPosition) which contains the positions of all joints. From QTrobot documentation, we know that the head yaw position is the second item (list's index starts from zero) in the list; thus we can simply use standard list block to get the value of our desired item in the list (at index 1).
ROS Service call block
Let's see how we can use our ROS Service Call blocks. The following example shows how we can configure QTrobot to speak slower (e.g. 50% of its normal speed). The /qt_robot/speech/config is of type qt_robot_interface/speech_config and has few parameters such as speaking language and speed.