User Tools

Site Tools


make_drc-hubo_wave_its_hands_non-whole_body_kinematics

This is an old revision of the document!


Make DRC-Hubo Wave Its Arms

Author: Santiago Ricoy

Email: ricoys1@unlv.nevada.edu

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

Programming

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.

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. 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.

  USER_COMMAND cmd;
  cmd.COMMAND_DATA.USER_COMMAND = 201;
  cmd.COMMAND_TARGET = ALNum_Tuto;
  pLAN->SendCommand(cmd);
  

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 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...";
          jCon->RefreshToCurrentReference();
          jCon->SetAllMotionOwner();
          _MoveMode = 2;
          sharedCMD->COMMAND[PODO_NO].USER_COMMAND = NO_ACT;
          }
          

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 _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?

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

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

There are four parameters:

First is the joint, then a degree, the time to make the change, and the movement mode.

The joint names are actually sets of numbers, but have been enumerated for convenience. That set can be found in “jointinformation.h”.

The task thread is a loop whose timing is more or less 0.05 seconds per cycle, so in our example if statements, you will find that we are timing in actual seconds.

make_drc-hubo_wave_its_hands_non-whole_body_kinematics.1470851593.txt.gz · Last modified: 2016/08/10 10:53 by santiagoricoy