User Tools

Site Tools


Make DRC-Hubo Wave Its Arms

Author: Santiago Ricoy

Email: [email protected]

Date: Last modified on 08/10/2016

Keywords: wave, arms, hubo, Al, Podo,

This tutorial is a brief overview of the basic concepts necessary to link the GUI to an Al via the shared memory and execute a command.

I assume the reader understands:

  • Knows how to create a new Al
  • Has fundamental knowledge of C++
  • Can use Qt Creator

Items Necessary

  • DRC-Hubo Robot (if going to physically operate)
  • PODO Installation
  • Qt Creator


Open a session with your directory's PODOGUI project, PODOLauncher project, and ALPrograms project.

We'll be utilizing the ALTutorial/TutorialDialog combination for this specific tutorial. The steps would essentially be the same for any GUI/Al combination. After this tutorial, you should be able to transfer these methods to another Al.

GUI Side

First, go into the PODOGUI folder and open “TutorialDialog.ui”, and in the designer window, I've dragged a push button onto the dialog. On the right side of the screen is an option to change the object name, where I've changed it to “pb_WaveArms”. After editing your button and changing the name, right click the button. Click “Go to slot…” and choose “clicked()”.

This should take you to a method definition within “TutorialDialog.cpp”. Insert the code snippet below into the method. Choose a number above 100 (if you've gone through the Creating a new Al for PODO tutorial, you'll remember why) and set your USER_COMMAND element to that number. The COMMAND_TARGET for this Al is contained in ALNum_Tuto, so initialize the COMMAND_TARGET to that variable. Finally, the command is sent to shared memory.

  cmd.COMMAND_TARGET = ALNum_Tuto;

Note: If we have the same enumeration declaration in both our ALTutorial/main.cpp and TutorialDialog.cpp, as demonstrated in the Al creation tutorial, we could use the names chosen instead. That method is more easily read and explicit, but this way shows why we use that method.

Al Side

Go to the ALTutorial/main.cpp file, and scroll down until you are looking under the “Initialize RBCore comment”. This is where the connection between GUI and Al is made. Within the while loop found there will be a switch statement that takes “sharedCMD→COMMAND[PODO_NO].USER_COMMAND” as its argument. Add your own case as shown below. This is very similar to the command in the Al creation tutorial, but now we are changing an integer variable called _MoveMode. You must declare this variable globally toward the top of the file.

          FILE_LOG(logSUCCESS) << "Waving Arms...";
          _MoveMode = 2;

Executing the Command

If you scroll down and find the task thread, you'll find another while loop. Within this we will place another switch statement whose argument will be an integer variable that you should declare globally. I called it _MoveMode. _MoveMode will dictate which set of actions will be performed in the task thread. When _MoveMode is equal to 0, the loop will do nothing.

Here, when _MoveMode is 1, we'll be simply printing out some text, and when _MoveMode is 2, it performs our desired action. So how to go about it?

The SetMoveJoint Function

We're not using whole body kinematics, but very simple angle changes on joints. For that, the basic SetMoveJoint function is used from the jCon class.

For example: jCon→SetMoveJoint(RSR, -90.0, 2000.0, MOVE_ABSOLUTE);

There are four parameters:

First is the joint, then the reference degree, the time to make the change, and the movement mode. Commands for different joints can be executed at the same time.

The joint names are actually sets of numbers, but have been enumerated for convenience. That set can be found in “JointInformation.h” as seen above. Hubo's joint angle directions are decided via the right hand rule. The X-axis points forward, the Y-axis points left, and the Z-axis points upward. You can decide which direction is negative or positive by using the right hand rule on the axis that the joint aligns with (assuming the robot is in home position). Please keep in mind that too little time for a large movement can break a joint in DRC-Hubo. Lastly, your movement mode is either MOVE_ABSOLUTE (move to an absolute angle based on encoder pulses from the joint home position) or MOVE_RELATIVE (move to a certain angular distance from the current position).

As you can see, here, I've separated left and right arm movements for convenience. Your movements may be similar. For lots of commands like this, the CTRL+F command to replace numbers/movement modes quickly is useful.

The task thread is a loop whose timing is 0.005 seconds per cycle, so in our example if statements, you will find that we are timing in actual seconds. Therefore, each time our counter variable (which should be declared and initialized to 0 outside of the while loop) is incremented, it takes 0.005 seconds. So every 200 increments happens in one second. We do this because we want consecutive movements, so we have the computer wait until sending the next set of commands.

If all was done correctly, rebuid, and run the PODOLauncher. Open the Daemon and the GUI, connect the GUI to the Daemon. Open the ALTutorial process, and click your button. It should work!


  • There are several issues that could pop up during execution. The most common
  • There should be some functions already present in the task thread while loop. These work best at the end of the loop.
  • Be sure to place your counter variable initialization outside of the while loop, or you'll end up with some very…interesting results.
  • Your counter variable should be reset at the end of your movement for repeatability.
  • _MoveMode should alse be reset to 0 at the end of your movement.
  • This is a simple example using MOVE_ABSOLUTE, but in some cases you may want to use MOVE_RELATIVE. If your loop has any command redundancies in MOVE_RELATIVE, it could work in the simulator, but break the joint on the physical robot. So walk through your code first.
make_drc-hubo_wave_its_hands_non-whole_body_kinematics.txt · Last modified: 2016/08/30 19:11 by santiagoricoy