User-defined Motions 2 : Task Code

Prerequisite : Adjustment using the Gyro Sensor, User-defined Motions 1 : Create Motion
Code to execute user-defined motions will be added to the task code used in  the "Adjustment using the Gyro Sensor" section.  The motion file is from the " User-defined Motions 1 : Create Motion” section.  Review the two sections before getting started.

 

[ Learning Goal ]

Write task code to execute user-defined motions.

Let’s learn how to run the motion added on " User-defined Motions 1 : Create Motion " with the RC-100.

  • Motion File : BIO_PRM_UserMotionExam_KR.mtn
  • Task Code : BIO_PRM_UserMotionExam_KR.tsk

 

[ STEP 1 ]

 Task Code Overview

  • Code to execute user-defined motions has been added to the task code written in "Adjusting using the Gyro Sensor."
    1. Set  "WalkCommand"  as 0 to make the robot stop.
    2. If the motion added by the user does not require the gyro sensor to maintain posture, you must turn off the gyro sensor adjustment to prevent motion variation due to the offset. Set the "UseGyro" variable as FALSE.  Then call the "EXITPageWaitMotion" function and wait for the robot to come to a complete stop.
    3. The “Getting Up” motions added in motion pages 27 and 28 can be played just once. Thus, execute the motion, and wait for the motion to finish before executing another motion.
    4. The “Block Ball” motions added in motion page 14 and 16 are endlessly repeating motions. Thus, in order to end the motion, an EXIT page is needed.  Using the "WAIT WHILE" command so that if the button is not pressed and held, the "EXITPageWaitMotion" function will execute the EXIT to end the motion.
      (Click here to see more information on the “Motion Page” parameter.)
    5. After the user's motion ends, set the "UseGyro" variable back to TRUE to restore gyro adjustment.