Motion Builder Tutorial
Motion Builder Tutorial
2008.07.07
RoboBuilder
MotionBuilder Tutorial
2/57
<CONTENT>
1. Before beginning 1.1. 1.2. 1.3. 1.4. 1.5. 2. Document purpose Things to prepare What are project file, motion file, scene, frame, transition time? Screen Layout Caution for input language 3 3 3 3 4 5 6 6 7 9 11 13 15 15 17 17 18 20 20 29 34 37 37 41 41 48 48 51 51 51 52 54 54 54 54
Handling example motion files 2.1. 2.2. 2.3. 2.4. 2.5. Open an example project file Running an example motion file Modifying an example motion file Saving an example motion file in another name Transferring a motion file to the robot
3.
Handling downloaded motion files 3.1. 3.2. 3.3. Downloading a motion file from the Internet Transferring a motion file to the robot Modifying a motion file
4. 5.
Uploading a motion file to the Internet Creating a new motion file 5.1. 5.2. 5.3. Example programming A Example programming B Changing the speed of a motion
6.
7.
Using the wheel mode of wCK module 7.1. Adding a turning shield to HUNOs arm
8.
9.
Using advanced features 9.1. 9.2. 9.3. Advanced use of frame and transition time Advanced use of torque Advanced use of control gains
10. C programming with a RoboBuilder motion file 10.1. 10.2. 10.3. Material included Caution Work flow
MotionBuilder Tutorial
3/57
1. Before beginning
This document explains how to use MotionBuilder the motion building tool for RoboBuilder.
1.3. What are project file, motion file, scene, frame, transition time?
1) Project file(*.prj) : A project file contains the information such as the robots type and more. It is used to manage multiple motion files of a robot efficiently. Therefore, one project file includes one or more motion files.
MotionBuilder Tutorial
4/57
2) Motion file(*.rbm) : A motion file contains the complete data to execute its movement. One motion file consists of multiple scenes. 3) Scene : A scene is a smaller motion unit that constitutes a complete motion file. A scene consists of start position and destination position. Except the first scene, the start position of a scene is the destination position of its previous scene. When a scene is executed, the frame data is generated automatically according to the predefiend number of frames and delivered to each actuator modules. 4) Frame : A frame is the smallest motion unit that constitutes a scene. Each frame can be considered as the still image that is actually sent to robot actuators. The more frames you defien, the smoother the motion becomes. One scene can have from 1 up to 100 frames. 5) Transition Time : Transition time is the time duration that is taken to execute a scene. Transition time is closely related with the number of frames. It can have value from 20msec up to 6000msec. The minimum transition time that can be allocated for a frame is 20msec. e.g) If scene A has 10 frames, the transition time can be selected from 200 up to 60000.
MotionBuilder Tutorial
5/57
MotionBuilder Tutorial
6/57
3)
MotionBuilder Tutorial
7/57
3) Click ScanPort and it will automatically search for COM port available and connect to RoboBuilder. ( caution : A PC that frequently uses virtual port such as Bluetooth Dongle may fail or take longer time to search for COM port. In this case, choose the ComPort manually and click OpenPort.)
Usual causes of the failure are as follow. a. When the PC cable is unplugged b. When the driver for USB-to-RS232 converter is not installed correctly
MotionBuilder Tutorial 4) Click Motion List button and select a motion file in the Motion Management window. For example, double click HunoDemo_Punch to open the file.
8/57
5) Click Select All button to select all scenes of the motion file.
6) Click Test button. The button turns to Stop and the motion is executed.
7) As soon as the motion finished, the Stop button turns to Return. Click Return button. The button returns to Test and the HUNO returns to its initial position. If you selected only one scene, the HUNO returns to the start position of the scene.
MotionBuilder Tutorial
9/57
4) Click Test button. The robot moves to the destination position of the scene.
5) Lets modify the destination position of the Scene_2. There are three different methods to do this as below. method a. Use the jog dial pad in the Robot Configuration area method b. Change the value in the wCK Module Control Detail area method c. Use Teaching Method (posture capture)
10/57
6) Adjust the dial pad of ID[11], ID[14] in the Robot Configuration area. Lets try to make the robot open its arms wide.
7) Click Return button to have the robot move back to start position. Click Test button to see how the modified scene works. Do you see the motion changed? 8) Click Return button to have the robot move back to start position. Click Select All button to select all scenes and click Test button. The robot show all scenes so that you can see how the small modification affect the whole motion file.
before
after
MotionBuilder Tutorial
11/57
3) Change the Motion Name HunoDemo_Punch as my_punch and click OK button. You can see the name has been changed to my_punch in the Motion File information area.
4) Click Save button to save the change. If successfully saved, you can check the new file my_punch.rbm has been created.
MotionBuilder Tutorial
12/57
before save
after save
In case there is a communication problem between the PC and the RBC control box, MotionBuilder fails to save the new file and an error message pops up as below. In this case, please check the connection status.
5) Click Motion List button. You can see now the file name is changed.
MotionBuilder Tutorial
13/57
3) Click Open button then the file transfer begins. When the file transfer is completed, a message appears as below.
MotionBuilder Tutorial
14/57
The usual causes of the failure are as below. a. when the PC cable is not correctly connected : double check the PC cable is firmly plugged in the COM port and the RBC control box. b. when the motion file is too big or the memory space is not big enough c. when the file was damaged or it is not a motion file(*.rbm) 4) Repeat 2)~3) to transfer the next file my_punch.rbm. 5) When you finish the transfer of the two files, remove the PC cable from RBC control box. Direct the remote controller to the top of the robots head and press the red button [basic posture]. Then press button number 1 to see if the robot show the motion of HunoDemo_Punch.rbm..
Whenever RoboBuilder is turned on, you need to press the red button of the remote controller first before you press any other button to run any motion. 6) If you press button number 2, the robot will show the motion of my_punch.rbm..
MotionBuilder Tutorial
15/57
2) Register the serial number of your robot at the homepage (http://www.robobuilder.net/mypage/index.asp?mode=product). The serial number is printed on a bar code that is attached on to the bottom of each RBC control box.
MotionBuilder Tutorial
16/57
3) Go to Robot File Sharing of the homepage (http://www.robobuilder.net/community/board_index.asp?cmd=list) and select a file you want to download.
4) Click Download button and choose Save button to save the file on your hard disk.
If you have more than one serial numbers registered, you can choose the serial number you want to use for this file download.
If the serial number you used here doesnt match with the actual serial number fo the RBC control box you will use to run the motion file, the file will not work .
MotionBuilder Tutorial
17/57
MotionBuilder Tutorial
18/57
6) Choose the robot file(*.rbm) that you want to upload. Fill in other option and be sure to upload the movie (*.avi, *.wmv, *.flv, .. etc). Click Post button to finish wrting.
MotionBuilder Tutorial
19/57
7) You can see now the file is posted at Robot File Sharing.
MotionBuilder Tutorial
20/57
5.1. Example programming A: The robot holds up the arms. And then open the arms wide and close again. ( method a, b)
Now lets build a motion that the robot holds up the arms and then open the arms wide and close again using method a and method b. 1) First, run MotionBuilder and click New button to open a new project file.
2) Set the Project Name as test1 and click Browse button to save the project file. Select Creator Huno for Robot Platform and click OK. The screen will look as below.
MotionBuilder Tutorial
21/57
Go to step 6) in case you choose a standard plaftorm such as HUNO, DINO, DOGY. It is recommended that users dont change the Config options. 3) If you chose a non-standard robot platform (Creator Others) in step 2), click Config button. The Config window appears as below.
4) Click Add wCK and the Add Motor window appears so that you can input the wCK information for the project. Add as many wCK modules as the actual number of the wCK modules of the robot.
The input options are as below. wCK ID : Each wCK module has its own ID so that the controller can send commands to the wCK with a specific ID. This ID should match with the actual ID of the robot. <wCK ID picture>
MotionBuilder Tutorial -
22/57
Min Limit, Max Limit : The minimum and maximum rotational position of the wCK module. The actuator can not move to a higher position than Max Limit or move to a lower position than Min Limit. Init Position : The initial position of the wCK module. This decides the start position of the first scene of a motion file. In many cases of creating or modifying a motion, the motion starts with a particular posture and ends with that same posture. Therefore, setting this Init Position well helps to make a scene that returns to the start posture easily. PGain, DGain, IGain : This option sets the P, D, I gains that robot modules use during operation. The values are used only in operation.
5) If you finish adding the wCK modules, click Set Config button and then click Close button. As you can see below, wCK information has now been added in the Robot Configuration area and the wCK module Control Detail area.
6) Click New Motion button to create a new motion. Input the options carefully and click OK button to finish.
The input options are as below. Motion Name : The name of the motion, which is also used as the name of the motion file. File Path : The directory path where the motion is save. The path is by default same with the directory set in step 2). This path doesnt need to be changed. Motion Configurations : This option sets the P, D, I gains and check if you will use the external port or not.
MotionBuilder Tutorial
23/57
In case of a robot whose wCK modules have LEDs built in such as 5720T kit, users can control the LED lights by checking this option. Author, Email Address, Serial Code : This option is not to be used with current version v1.3.
7) The window appears so that you can input the scene properties. Input the options and click OK button to finish.
The input options are as below. Scene Name : The name of the scene. Number of Frame : The number of the frames of the scene, which ranges from 1 to 100. Transition Time [ms] : The excution time of the scene, which ranges from 20 to 6000.
As you can see in the screen, the motion name is changed and the first scene is added now.
8) Connect com port as described in chapter 2.2 3). COM port connection can be done in any step of 1)~8).
MotionBuilder Tutorial
24/57
The Disp. Value in the center of the screen is set zero(0) as shown above. This means that the disposition is zero, which means the start position and destination position is currently same. 9) Lets make the robot hold up the arms by dragging the jog dial of ID10 and ID13 in the Robot Configuration area.
You can see the D. Pos and Disp. Of the ID10 and ID13 are changed now. If you click the Restore button while you are modifying the destination position of a scene, the Disp. turns to zero and the robot moves to the start position. 10) Click New Scene button and add the second scene as explained in step 7). Use key or the mouse to choose the added second scene.
MotionBuilder Tutorial
25/57
You can see the Disp. Values of the second scene are all set to zero. 11) Lets make the robot put the arms to the side by dragging the jog dial of ID11 and ID14 in the Robot Configuration area.
12) Follow step 10~11) and add the third scene. Lets type in the Disp. Value directly for ID11 and ID14 to make the robot bend the arms inside to the center. Double click the Disp. of the ID 11 Disp. and the text key in window opens.
MotionBuilder Tutorial
26/57
13) The scenes made until now are as below. Scene_0 : Hole up the arms, 30 frames, 1 second Scene_1 : Strech the arms to the sides, 30 frames, 1 second Scene_2 : Bend the arms inside to the center, 30 frames, 1 second In summary, the robot will hold up the arms and strech out the arms to the side and then bend the arms inside to the center of the chest. 14) Now lets make the robot strech and bend the arms one more time. Since the same motion is repeated, you can use copy and paste the previous scenes. Drag the mouse and select Scene_2 and Scene_3. Right click the mouse.
MotionBuilder Tutorial
27/57
Choose Copy here. 15) Select the empty line below Scene_3 and right click the mouse to choose Paste/Insert.
MotionBuilder Tutorial
28/57
16) Add the last scene by following the step 11~12). The scene name is Scene_6.
17) It is helpful for the robot to move stably that you set the last scene ends with the initial posture. Click Scene_6 and right click the mouse to choose InitPos.
MotionBuilder Tutorial As seen below, the destination position of the Scene_6 is initial posture.
29/57
When you save the file, the RBC control box has to be connected and the com port is open. It fails to save the file if the communication between PC and RBC has a problem. 19) Lets test the created motion. Click Select All button and click Test button.
1) Follow chapter 5.1 1~8) and create a motion named bend_knee. Connect the com port..
MotionBuilder Tutorial
30/57
As seen above, the Disp. Of all wCK modules are set to zero. 2) Click Get Pos button and this window appears.
In this window, you select the wCK modules that you want to adjust. When the robot bend its knees, the robot will fall back if it bend only the knees. Therefore, select the six IDs so that it can flexibly bend its ankles and hip joints together. 3) If you click Close button, you can see the selected six wCK modules are loose so that you can adjust its posture with hands. Touch and adjust the robot so that it bend its knees and stand straight upward. Then click Catpure and you will see the data changed as shown below.
MotionBuilder Tutorial
31/57
Caution : In case communication error occurs during the Capture (unplugged cable, control box power off etc), the MotionBuilder may not work properly. If the program window expands press Alt+F4 to close the program. Check the communication status and try again. 4) Click New Scene button and add a scene. Use key or the mouse to choose the added second scene.
5) Lets capture the robot when it straighten the knees. Click Get Pos button and select the same six IDs( 1, 2, 3, 6, 7, 8). Touch and adjust the robot to make it straightent the knees and stand straight upward. Click Capture button then you will see the data changed as shown below.
MotionBuilder Tutorial
32/57
6) Now two scenes have been completed(bending the knees, straightening the knees). Now lets copy and paste the two scenes so that the robot can repeat the knee bending motion. As explained in chapter 5.1 14~15) copy and paste the Scene_0 and Scene_1.
MotionBuilder Tutorial
33/57
7) Lets add the last scene of initial posture. As explained in chapter 5.1 16~17) click New Scene button to add a new scene. Right click the mouse and choose InitPos.
8) Click Save button and save the created motion bend_knee.rbm. If you click Save All button, the test1.prj and bend_knee.rbm are all saved. 9) Lets test the created motion. Click Select All button and click Test button.
MotionBuilder Tutorial
34/57
The data for bend_knee.rbm appear. Connect RoboBuilder to PC and open the com port.
3) You can see the frame 30, Transition time 1000ms in the scene editing are.
MotionBuilder Tutorial
35/57
The scenes property window appears. Input 25 for the Number of Frame and 500 for the Transition Time and click OK. The frame ranges from 1 up to 100 and the minimum transition time per frame is 20ms. Therefore, the transition time is affected by frame number and ranges from 20 up to 6000ms. (refer to chapter 1.3 for detail) If the Number of Frame is 30, the Transition Time should be more than 600 (30 x 20 = 600). Therefore you can not change it to 500 without changing the Transition Time first.
5) As shown in the screen below, the frames and transition times for all scens are changed to 25 and 500 respectively.
MotionBuilder Tutorial
36/57
6) Lets test the changed motion. Click Select All button and click Test button. You can see the motion is faster now.
MotionBuilder Tutorial
37/57
1) Run MotionBuilder and click Open button to open the project test1.prj. 2) Click New Motion button.
Set the Motion Name as merge1 and click OK button. If the new scene window appears, leave the default values and click OK and then connect com port.
MotionBuilder Tutorial 4) Click Motion List button and double click move_arm1.
38/57
5) Click Select All button and select all scenes of the move_arm1.rbm. Right click the mouse and choose Copy.
Click the second line and right click the moush to choose Paste-Insert.
MotionBuilder Tutorial 8) Click Motion List button and double click bend_knee.
39/57
9) Click Select All to select all scenes of bend_knee.rbm. Right click and choose Copy.
Click the next line of the last scene of merge1.rbm. Right click the mouse to choose Paste-Insert.
MotionBuilder Tutorial
40/57
11) Click Save button to save merge1.rbm. 12) Lets test the merged motion. Click Select All button to select all scenes and click Test buttion. You can see the move_arm1.rbm and bend_knee.rbm are merged now.
MotionBuilder Tutorial
41/57
3) A new project for non-standard robot need to be created in order to use the wheel mode. Click New button.
MotionBuilder Tutorial
42/57
4) Set the Project Name as huno_wheel1 and click Browse button to set the save path. Choose Creator Others for Robot Platform and click OK to finish.
Standard platform robots(HUNO, DINO, DOGY) dont support the 360 degree wheel mode. 5) As explained in chapter 5.1 3~5), add 16 IDs in the Config window.
6) Click Save All button to save huno_wheel1.prj. 7) Because the robot is not a standard platform, the initial posture need to be defined. Click Init Pos button to set the initial positions of wCK modules.
MotionBuilder Tutorial
43/57
All initial positions are set to 127 now. But this should be changed because it is not appropriate for HUNO. There are two methods to change the initial position as below. method a. Double click the Int_Position of each ID or use jog dial pad method b. Call up the initial posotion file (*.mip) 8) As the robots structure is almost same with HUNO, lets call up the initial position file fo HUNO. First, Click Close to close the Set Initial Postion window. Click Open button to open HunoDemo.prj. Click Init Pos button and the Set Initial Postion window appears.
MotionBuilder Tutorial 9) Click Open button to open the project file huno_wheel1.prj. 10) Click Init Pos button and Set Initial Position appears. Click Load from File button and choose huno.mip file that you saved earlier.
44/57
Now you can see the initial positions are changed and set with the values of HUNO. Click Set Initial Position button so that the values are applied for the project. Click Close button. 11) Now lets begin to program a motion. Click New Motion button and set the Motion Name as huno_rotation1. Click OK button to close the window. Click OK button for the New Scene window. Connect COM port. 12) You can click Test button to test the intitial posture of the first scene.
13) You can see the left arm is not very natural because of the modification. Lets change the initial posture. Click Init Pos button to see Set Initial Position window. Choose ID 10 and change the Init_Position value to 89 by using the jog dial pad or double clicking the value.
MotionBuilder Tutorial
45/57
Click Set Initial Position button so that the change is applied for the project. Click Close button to finish. 14) Although the initial posture is changed, the start posture of the first scene remains unchanged.
If you delete the first scene and make new scene, the changed initial posture is applied. Click Delete button and the Scene_0 is deleted. Click New Scene button and click OK for the New Scene window.
Now you can see the initial posture of the first scene has been changed.
MotionBuilder Tutorial
46/57
15) Lets try turning the wCK ID12 clockwise in Scene_0. If you double click the Torq of ID12 in the wCK module Control Detail area, a small pop up appears as below.
Choose Wheel-CW .
In 360 degree wheel mode, the start position and destination position is used for speed. It ranges from 0(stop) up to 15(max speed). Double click the start position or destination position and input 15.
16) Because there is only one scene now, the ID12 will turn endlessly. Therefore, lets add another scene to make it stop. Click New Scene button and click OK for the New Scene window. You can see the newly added Scene_1 is not in wheel mode but in position control mode with torque level2.
17) In this setting, ID12 will move to position 79 instead of stopping the turning. Lets change like this.
MotionBuilder Tutorial
47/57
18) Lets try the motion. Click Select All button to select all scenes and click Test button. You can see the shield turns clockwise for one second and stops.
MotionBuilder Tutorial
48/57
Set the Motion Name as heart_led Check the Enable External Port in order to control the external port where the LEDs are connected. Click OK button. Click OK for the New Scene window. Connect COM port. 3) Lets contro the LED of ID10 in Scene_0. Double click Port of ID10 then a small pop up appears.
MotionBuilder Tutorial
49/57
4) Click New Scene button to add Scene_1. If you click Scene_1, you can see the Port of ID10 is P0:0(OFF).
5) In order to repeat the LED lighting two more times, select Scene_0 and Scene_1. Right click the mouse and choose Copy.
6) Click the next line of Scene_1, and right click the mouse to choose Paste-Insert.
7) Repeat 5~6).
MotionBuilder Tutorial
50/57
8) Lets try the motion. Click Select All button to select all scenes and click Test button. You can see the heart beats three times.
MotionBuilder Tutorial
51/57
MotionBuilder Tutorial
52/57
3) If you increase torque, wCK module use more energy and result in faster response time and higher rotation force. On the other hand, if you decrease torque, wCK module use less energy and result in slower resonse time and lower rotation force. 4) Generally spealing, higher torque is used for scenes that require fast and strong movement, and lower torque is used for scenes that require slow and smooth movement.
MotionBuilder Tutorial
53/57
4) P gain is Proportional Gain coefficient. This gain is applied to the output after being multiplied by the control error. Therefore, the higher the P gain is, the stronger the motor output becomes. But the maximum output of the motor is limited, too much P gain doesnt necessarily generate higher power. Generally from 20 to 40 is recommended for P gain. 5) D gain is Differential Gain coefficient. This gain is applied to the output after being multiplied by the change rate of the control error. Therefore, it affects the overshooting of the output. Generally two times the P gain is recommended for D gain. 6) I gain is Integral Gain coefficient. This gain is applied to the output after being multiplied by the integral of the control error. Therefore, it has an effect of compensating the integral error. In case that I gain is high, the system regist to a strong external force, which may cause damage to the system. Therefore, generally zero(0) is recommended for I gain. 7) The gains explained here as integer value are the values that are used inside the wCK module and are not to be applied as PID gains for other control systems.
MotionBuilder Tutorial
54/57
10.2. Caution
1) This function is supported only with MotionBuilder version 1.10 beta or higher. 2) C code is based on CodeVisionAVR 1.24.8d.
1) Convert a motion file to a header file(*.h) Open MotionBuilder (version 1.10 beta or higher) Click Open button to open [p_ex1.prj] file in [motion_exam] folder Click Motion List button
MotionBuilder Tutorial
55/57
Set the Header File Format as ME_FMT#1(default) and push the Create Header File button.
Assign a name for the header file(*.h) and push [Save] button. For example, a name p_ex1.h was used in this example.
MotionBuilder Tutorial
56/57
A pop-up window appears and ask if you want to read the generated header file. Choose as you wish. Header file generation is completed.
2) Include the header file(*.h) into C coding Move the generated file p_ex1.h into the folder cv_exam/src. A file with identical name will be overwritten. Use CodeVisionAVR and read cv_ex1.prj. Edit comm.c so as to match with the name as below. #include "p_ex1.h" Change the array names to match with the motion file in SampleMotion1 function in comm.c (use capital letter only) For example, if the motion name is 'M_EX1' gpT_Table gpE_Table gpPg_Table gpDg_Table gpIg_Table gpFN_Table gpRT_Table gpPos_Table Motion.NumOfScene Motion.NumOfwCK = M_EX1_Torque; = M_EX1_Port; = M_EX1_RuntimePGain; = M_EX1_RuntimeDGain; = M_EX1_RuntimeIGain; = M_EX1_Frames; = M_EX1_TrTime; = M_EX1_Position; = M_EX1_NUM_OF_SCENES; = M_EX1_NUM_OF_WCKS;
3) Generate an executable hex file(*.hex) Use CodeVisionAVR and run Project Make menu or push Shift+F9. Executable hex file generation is completed
4) Download to RoboBuilder and run Connect RoboBuilder with PC and turn it on. (connect power supply too). Run the [RBCUpgradeTool] and set Com port accordingly. Set the 'Firmware File' to the main.hex file which was generated in cv_exam/src folder.
MotionBuilder Tutorial
57/57
Push the 'Click here and Push Reset Button' button. Then RoboBuilder wait for you to push the reset button. Push the Reset button (the hole between PF1 button and PF2 button to start the firmware upgrade. When download is completed, the message of Flash File successfully downloaded.' appears.
Disconnect RoboBuilder from PC and push PF1 button to run the motion All procedures are completed.