Sunday, December 8, 2013

Robot Arm Learns Playing a Toy YoYo

(Department of Mechatronics engineering final year project 2008)

1.0 Introduction     
                                                                                          
The purpose of this project is to develop algorithms and strategies for the robot arm to learn playing different yo-yos. After studied the way humans operate a yoyo, two main control strategies for playing yo-yo successfully. 
  • The upward motion of robot arm should start just before the yo-yo reaches its bottom position.  In this way, the yo-yo gain maximum energy for up-down motion.
  • By changing the top speed of robot arm during upward motion, the amplitude of yo-yo motion can be maintained at desired level.
Since yoyos are made of different materials, has different speed of their spin, the string length and undesired motion such as swinging, yawing and pitching, it requires adaptive control strategy. Human operator can adjust quickly to play different yo-yo successfully, but the robot arm with fixed movement cannot operate different yo-yos with different string length. Thus, an adaptive controller with the knowledge about robotic yoyo system is needed.

The following tasks have been achieved in this project:
  • Implement CMAC feedback error controller to provide accurate speed for upward motion to maintain the top height of yo-yo at desired level.
  • The robot arm can learn playing different yo-yo with self-turning process to find out when is best moment for upward motion.
  • The robot arm also can learn playing different yoyo from human demonstration.
      
    2.0 Experiment Setup



      In this project, two design configuration have been tested. Option 1: driving two stepper motors simultaneously with 2d kinematic equations to manipulate both sections of the robotic arm. Option 2: is the alternative design configuration with fixed the bottom joint of robot arm and design a mechanical structure to constrain the side movement of string, so the yo-yo could move up and down directly.

  
     2.1 Design Option 1 Setup

      
      In experimental option 1, the robot arm could only play yo-yo up to 10 cycles. The reason is that the slack on the joints of the robotic arm causes vibration while the robot arm moves up and down. This results in undesired motion of the yo-yo. Thus, robot arm cannot operate yo-yo successfully with this configuration.

      Video about performance of design option 1 is on following video, time from 11:20 to 11:40:

     2.2 Design Option 2 Setup


      In option 2, the bottom joint of robot arm is fixed and leave one joint free to move the string up and down.  Additional mechanical device will constrain the movement of yo-yo’s string vertically. This configuration also simplify the control algorithm for moving the robot arm and facilitates software implementation, so the project is primary focus on robotic arm learning strategies. Design option 2 with correct control strategy, the robot arm could play yo-yo more than 100 cycles.

      Video about performance of design option 2 is on following video, time from 0:07 to 3:20:
      http://www.youtube.com/watch?v=yJMeYc_eHtI



      A simple and robust mechanical structure has several clamps to hold the wooden rectangular structure. These clamps provide 5 degrees of adjustment. On the back connection with the vertical link of the robot arm also has additional 3 degrees of adjustment, so the yo-yo’s string goes through the top and bottom holes of the rectangle wooden structure will always travel directly towards the ground under gravitational force. When the robotic arm moves up, the yo-yo move up directly, so the yo-yo will have less undesired motion. In addition, this will also make the yoyo stay in the sensing area of ultrasonic sensor; allow the system to motoring yoyo position accurately. 



      Data acquisition card from National Instruments is the processing hardware of the robotic system, which reads voltage from load cell and ultrasonic sensor and send output signal to drive step motors which control the robot arm. It connects with PC and can be programmed with C++ MFC application.

      Ultrasonic Sensor to measure the position of yo-yo in real time, so the robot arm can make upward motion at right moment. 

      Ultrasonic Sensor UTRA-30-AV has measuring frequency of 20 times per second; range between 76mm and 2030mm; sensing area of conical shape and 15 degree total angle at 3db down; output 0 to 10 VDC proportional to distance. Occasionally, the yo-yo rolling away from detection range, so software functions are designed to filter out false position reading of yo-yo. The robotic system is able to monitor position of yoyo at accuracy around 3 mm.

      Load cell FSH01674 with measuring range from 0 to 8.9N (0 to 908g) has been attached to the string. In addition, a CSG110 (JM-2A) Amplifier is used for amplify the output voltage of the load cell. Thus, the output voltage of load cell from 0 to 8.9N is proportional 0 to 10VDC. Thus, the Data acquisition card could measure an input range from 0 to 10 VDC with an accuracy of 0.01V; the robotic system would be able to measure the force change less than 0.1g. Since the yoyo is weight 50g, the force sensor can detect the force change on the string, when yoyo reaches the bottom position an impact occurs.



     3.0 Robot arm play yoyo with pre-defined moving pattern 

      The most efficient transfer of the energy from the robot arm to the yo-yo is if the major upward motion is performed just before the yo-yo reaches the bottom position and the downward motion takes place after the bottom impact. The top height of the yo-yo motion can be controlled by changing the upward acceleration or duration upward motion.

      In this experiment, the ultrasonic sensor is on the floor and faces upwards to track yo-yo position at real time. Since yoyo and ultrasonic sensor has same position reference to the floor and robot arm moves down to its initial position before yoyo reach the bottom impact, the bottom position of yoyo is constant relative to ultrasonic sensor. Thus, the right moment for the robot arm to make upward motion is when yoyo reaches to a certain height above ultrasonic sensor. After trials and errors, the best moment for robot arm to start upward motion is when the yo-yo reaches 0.23 m above the bottom impact (0.38m above ultrasonic sensor).

      During upward motion, the stepper motor run clockwise 1100 steps, so the tip of robotic arm (connection between robot arm and string attach to yoyo) will move up by 11.7cm. The speed profile of this upward motion include constant acceleration period of initial 200 steps. After that, the stepper motor reaches to speed of 2857 steps/s (the tip of the robotic arm moves at about 1.1m/s). The stepper motor makes constant deceleration to stop in last 100 steps. Then, there is a short delay period of 500 us before the arm moves downward. This allows the mechanism to settle down and dissipate the momentum, so the step motor could have enough torque to move robot arm without slip. In downward motion, stepper motor running anticlockwise, accelerates to speed of 1623 steps /s during first 200 steps, decelerate to stop during last 100 steps, so the robot arm can move back to its initial position before the next yo-yo cycle start.

      The robotic system shows very promising result that can play yo-yo up to 50 cycles. The reason that robot arm can’t play yo-yo forever is the presence of undesired motion such as swinging, yawing and pitching. These disturbances dissipate extra energy during yoyo oscillatory motion. Since the robot arm move at pre-defined pattern, it pumps up same amount energy to the system each cycle. In addition, the potential energy stored in the yo-yo at the top position is the sum of the potential energy in the previous top position, the energy lost during last impact and the energy supplied by robot arm. Initially, the energy supply by robot arm is balance the energy loss at the bottom impact and friction between the string and the yo-yo. After number of cycles, the top height of yoyo decrease gradually until it stops oscillating due to undesired motion. Thus, the robot arm requires a close-loop controller that can adjust the speed of upward motion and duration to control the top height of yoyo. 


     3.1 Analysis yo-yo motion


      With loadcell, ultrasonic sensor, step motor and DAQ card, the robotic system can track several parameters of yoyo motion real-time. 

      The Figure 3.1 shows the software interface of the robotic system, which is written in C++ MFC function. The first line chart from the top describes the motion of yo-yo, y-axis represents yoyo position in unit of cm and x-axis is time in second. The reason for unsmooth plot of position reading is the yo-yo rolling away from detection range of ultrasonic detecting range and software functions filter out false position reading of yo-yo. The Second line chart describes tension force on the yo-yo string in Newtons (N). The third line chart describes motion of robot arm. As figure shows: the robot arm upward motion starts just before the yo-yo reaches its bottom position, during this moment the bottom impact occurs as indicated from force pluses. After that, the robot arm goes back to its initial position and ready for next yoyo cycle.


 3.2 Relationship between upward motion and amplitude of yoyo 


      The Figure 3.2 shows the relationship between upward motion and amplitude of yoyo. All three upward motions begin at 0.25m before the bottom impact but at different speed 1.2m/s, 0.9m/s and 0.7m/s respectively. We can see clearly that as the robot arm move faster, the yo-yo will reach higher position. Therefore, the height of the yo-yo depends on the speed of upward motion. The more energy transferred to the yo-yo, the higher position the yo-yo can reach.

      However, the relationship between the yo-yo top height and robotic arm speed are non-linear and has disturbances from yoyo’s undesired motion. Thus, the robot arm needs an adaptive controller with the knowledge about the robotic yoyo system to keep yoyo height with different upward motion.   


    4.0 CMAC Feedback Error controller

      In order to control amplitude of yoyo with different speed of upward motion, CMAC Feedback Error Controller has been implemented into the robotic arm system. The Feedback Error Controller contain CMAC neural network along with PID controller provide closed-loop supervise learning scheme for nonlinear adaptive control. This was originally proposed by Kawato.
     

    4.1 How CMAC works

      CMAC stand for Cerebellar Model Articulation Controller which is a computational model to simulate biological cerebellar and provides a learning algorithm by updating weights of neurons base on the difference between an output value and a desired output value in each training circle.



      Organisation of CMAC network; the input space is quantised using a set of rectangular cells with finite boundaries as shown above. The total collection of rectangular cells is divided into C layers, referred as generalization parameter; Each layer is offset relative to the others by the distance of D, referred as quantization interval; the width of individual rectangular cell is equal to C * D, known as input generalization. Thus, CMAC network guarantees only number of C memory cells are activated by one input.

      In above example, the CMAC network has 3 layers, so the generalization parameter C is equal to 3; quantization interval D  is 1; Width of each rectangular cell known as input generalization  C * D, is equal to 3. Input space from 0 to 23.

      Regulations of CMAC arrangement: CMAC network can be arranged with different number of layers; width of rectangular cell and quantization interval, and can has several input spaces for multi-input operation. On the condition that C parallel layers are offset to each other with distance of D, the width of each rectangular cell is equal to C * D, the input space is large enough to cover all input values of specific application.

      In CMAC operations, each memory cell can be assumed as an on-off type of entity, which is initially empty and all the memory cells have a zero value. If a memory cell is activated, its value is then equal to the value of adjustable weight produced by previous training cycle add on current stored value.   

      Any input value falls within the range of some adjacent cells are activated, and these excited cells contain stored values. The sum of these values produces an overall output of CMAC network.

      During CMAC training, the difference between CMAC output and desired output is divided by number of activated cells, this value also known as adjustable weight which is added on each of the activated cells, leave the other memory cells unchanged. After number of learning cycles with different tanning data pairs such as input and desired output, the value of each individual cell is adjusted in order to reduce output error, so CMAC can produce an output ever close to desired output.

      The Cerebellar Model Articulation Controller (CMAC) neural network is capable of learning nonlinear functions extremely quickly due to the local nature of its weight updating. The rectangular shape of CMAC receptive field functions, however, produces discontinuous (staircase) function approximations without inherent analytical derivatives. The ability to learn both functions and their derivatives is important for the development of many on-line adaptive filter, estimation, and control algorithms.

     Note: Complete details about CMAC neural network and Feedback error control can be found in article “Introduction CMAC Neural Network with Examples”. In following link:
  

    4.2 CMAC learn the inverse model of unknown system


      In a standard control scheme (figure 4.2), the controller needs to be the perfect inverse model of the system to maintain y(t) = yd(t), so the system is under control.

      Generally, it is hard to determine the function of unknown system. Even if the function is known exactly, computing an inverse can be difficultCMAC network can be trained to approximate unknown system. Thus, train CMAC neural network to approximate inverse model of unknown system is effective approach of designing system controller. 


    4.3 CMAC Feedback Error Controller for yoyo control

      When yo-yo is bouncing up and down, the kinetic energy is converted to potential and vice versa. It dissipates the energy at the bottom impact and due to the friction between the string and the yo-yo. To obtain oscillatory motion it is necessary to supply energy to the system. As the robot arm goes up, energy is transfer to yoyo motion. The fast robot arm moves the higher yoyo reaches. 



      In Figure 4.3, the controller has been implemented into robot arm and yoyo is the system being controlled. The purpose of this control process is that the robot arm make upward motion at speed of xp(t) to maintain top height of yoyo y(t) at desired level yd(t).

      x(t) indicates top speed m/s during the upward motion of tip of robot arm where yoyo’s string is attached, With a pre-defined moving pattern, the tip of robot arm move up by 11.7cm, and has initial 20% of the distance for constant acceleration to top speed of x(t) m/s, then the last 20% distance to decelerate to stop, and then move back to default position before next yoyo cycle. The robot arm with fix movement will supply same amount energy to the yoyo, which cannot response to the disturbance of yoyo motion; so cannot control the amplitude of yoyo, an adaptive controller is needed.

      The complete mathematical model of a yo-yo is very complicated; there are many difficulties to computing an inverse model of yoyo motion. In addition, the presence of undesired yoyo motion such as swinging, yawing and pitching create large disturbance which dissipate extra energy during yoyo oscillation, thus an adaptive CMAC Feedback Error Controller is implemented as following diagram. 



      Figure 12 shows the CMAC Feedback Error Controller has been implemented into the robotic arm system. The robotic system can learn to produce accurate speed xc(t) of upward motion to maintain y(t) = yd(t). The Feedback Error control scheme applies to both continuous-time system and discrete-time systems. The (t) represents the number of oscillatory cycle of yoyo, but not time interval. The Ultrasonic Sensor measures the top height of yoyo in each cycle.

      In the beginning of control process, the non-trained CMAC network contains empty memory cells, so it has no knowledge about the yoyo system. It receives an input query that the selected top height of yoyo up-down motion at yd(t) (82 cm is the highest position that yoyo can reach before hit top constraint ), the CMAC controller output speed xc(t)=0 m/s, which suggest the upward motion of robot arm is 0 m/s.  Thus, no energy is transfer to the yoyo.

      Simultaneously, the Ultrasonic Sensor measured the highest point y(t) that the yoyo has reached during last oscillatory cycle. The PID controller generates the speed command such as xp(t) = 1.1m/s  based on the difference between yd(t) and y(t). The sum of xc(t) and xp(t) is the upward motion speed x(t) of robot arm. Hence, robot arm move up at top seed 1.1 m/s during upward motion, and this upward motion supply energy to the yoyo.

      The xp(t) produce by PID controller is also the training signal error e given to CMAC for updating its weight values, so the CMAC could learn to produce correct speed command xc(t) in next oscillatory cycle.

      After number of oscillatory cycles, the System output y(t) is driven toward desired output yd (t). Equally xp(t) is getting smaller, PID controller will have less to do. Once the y(t) = yd(t), then IPD output xp(t) = 0. In this case, the fully trained CMAC controller provide the major portion of the speed output x(t), its memory cells contain knowledge about the yoyo system, and using the PID controller to stabilize the by compensating for any disturbances from yoyo’s undesired motion.

      The other advantage of implementing CMAC Feedback Error Controller for yoyo control is that the CMAC neutral network can provide optimal control for several different input queries. E.g. the desired top height of yoyo can be maintained at different level such as 60cm, 65, 70cm or 75cm above bottom position. The fully trained CMAC can provide instant output based on which desired yoyo top height is selected. While use the PID controller alone on Feedback path, it can only handle for one desired yoyo top height.

      Video about CMAC feedback error controller for yoyo control is on following web link, time from 0:00 to 3:20:    http://www.youtube.com/watch?v=yJMeYc_eHtI 


   5.0 Finding the right moment for upward motion with self-turning process

      Since the CMAC feedback error controller can provide accurate speed of upward motion to control the top height of yoyo, the next important yoyo control strategy is to find right timing for upward motion. As yoyos are made of different materials, has different speed of their spin, the string length, so the moment for yoyos’ upward motion will vary from one to another.

      The upward motion of robot arm should start just before the yo-yo reaches its bottom position.  In this way, the yo-yo gain maximum energy for up-down motion. The more energy transfers to the yo-yo, the higher position that the yo-yo could reach. 


      The Figure 5.0 illustrates that the robotic arm moves up at same speed, but upward motion start when yo-yo reaches different positions.  The red line represents the upward motion start when yoyo goes down to 0.25m above yoyo bottom position, and the yoyo reaches the highest amplitude compare to the other two trigger positions. Since the robotic arm supplies the same amount energy to the yoyo, most efficient transfer of the energy would result in the highest yoyo amplitude. Therefore, the trigger position for upward motion produces the highest yoyo amplitude that indicates the best moment for upward motion. In other word, the best timing to start upward motion is when yoyo goes down to 0.25m above bottom impact.

    5.2 Implementation of self-turning method

      In this part of experiment, different yoyo has been used. The white yoyo has twice the mass as the red yoyo, spins much faster and so the fall-down speed, also use slightly longer string length. Therefore, the best moment of upward motion is also different to the red yoyo.

      The self-turning method includes: The robot arm test the white yoyo with 5 different trigger positions such as 15cm, 20cm, 25cm, 40cm and 35cm above its bottom position, so the same upward motion start when yoyo goes down to the trigger position.

      For each trigger position, the robotic system measures the top height of yoyo in 6 oscillatory cycles, and then calculate the sum all 6 top height values. After all 5 trigger positions have been tested; the robot system selects the trigger position which produces the highest top height values as the best moment for upward motion. Finally, the robot arm is able to learn playing a yoyo with right timing and force.

      During self-turning process, it only requires a human operator to roll up the yoyo, robot arm do the rest of tasks automatically. The experiment result include the sum of 6 top height is 147cm for trigger position of 15cm, 131cm for trigger position of 20cm, 149cm for trigger position of 25cm,  272cm for trigger position of 40cm and 312cm for trigger position of 35cm. Therefore, the best timing to start upward motion is when the white yoyo goes down to 35cm above its bottom position. 

       Video about self-turning method is on following web link, time from 3:20 to 9:57

     6.2 Robot arm learn playing yoyo from human demonstration

      The ultrasonic sensor has been used to track movement of human hand, and then pass the position and speed of hand motion to the robot arm. The robot arm can synchronize with human hand, so human demonstrator and robot arm can play yo-yos at the same time.

      During the teaching operation, the robot arm could retrieve the trigger position for upward motion and train CMAC Feedback Error Controller to approximate the invers model of yoyo motion. Thus, the robot arm could skip the self-turning process and increment learning of CMAC Controller, and play a yoyo directly after human demonstration.  


      Video about Robot arm learn playing yoyo from human demonstration is on following web link, 10:00 to 11:08  http://www.youtube.com/watch?v=yJMeYc_eHtI


    7.0 Conclusion  

      In this project, the robot arm can learn playing different yo-yo with self-turning method to find out when is best moment for upward motion, using CMAC feedback error controller to provide accurate speed for upward motion to maintain the top height of yo-yo at desired level. The robot arm can learn playing different yoyo from human demonstration.


    8.0 Reference

      Complete details about CMAC neural network and Feedback error control can be found in article “Introduction CMAC Neural Network with Examples” 
 http://skyocean117.blogspot.co.nz/2013/12/introduction-to-cmac-neural-network.html
   
      Video about robot arm learns playing a yoyo on following link:                  http://www.youtube.com/watch?v=yJMeYc_eHtI 

      Article about mathematical model of yoyo “MODELLING AND CONTROL STRATEGY OF ROBOTIC YO-YO”


































1 comment:

  1. A majuscule website with engrossing and incomparable physical what else would you condition. click here now

    ReplyDelete