Ballbot and Controller

Typically: "How do I... ", "How can I... " questions
Post Reply
pedrophj
Posts: 3
Joined: 15 Feb 2018, 01:21

Ballbot and Controller

Post by pedrophj » 06 Mar 2018, 14:05

Hello everyone,

I am studying the ballbot model in V-REP. Could someone help me understand it?

Code: Select all

  
    local l=math.sqrt(v[1]*v[1]+v[2]*v[2]+v[3]*v[3]) 
    local ls=l 
    local w=0.18 

    v[1]=v[1]*ls*w/l  
    v[2]=v[2]*ls*w/l 
    v[3]=v[3]*ls*w/l 
    
I understand that v[1]=v[1]*ls*w/l it is the same as v[1]=v[1]*w, because above the author did ls = l. Right ?

Code: Select all

  local m=simGetObjectMatrix(sens,-1)
    
    
    local euler=simGetEulerAnglesFromMatrix(m)
    euler[1]=0
    euler[2]=0

    local m2=simBuildMatrix({0,0,0},euler) 
    local m3=simGetInvertedMatrix(m2)      

     local vect={m[3],m[7],m[11]}           
    vect=simMultiplyVector(m3,vect)       
    v=simMultiplyVector(m3,v)              
    velo=simMultiplyVector(m3,velo)        
    d=0.2
I researched and the elements 3, 7, 11 are position.
What are the variables vect, velo, d and v ?

Which controller is being used ?

Thanks

coppelia
Site Admin
Posts: 6747
Joined: 14 Dec 2012, 00:25

Re: Ballbot and Controller

Post by coppelia » 07 Mar 2018, 11:26

Hello,

the controller is a very simple proportional controller, as far as I remember. It is meant as a simple example. You can (and should!) write a much better controller.

Cheers

pedrophj
Posts: 3
Joined: 15 Feb 2018, 01:21

Re: Ballbot and Controller

Post by pedrophj » 07 Mar 2018, 20:06

Thanks for answering me.

So, the code that calculates the angular velocity of the actuator is this below (variable v).

The variable "velo" is the absolute velocity of the robot.

The gain of the controller is 200, but I did not understand the "dir" (direction) and also I do not know what "vect" is.

I need to understand well the measured variables to be able to implement a new controller.

Code: Select all

   vect[1]=vect[1]-v[1]+velo[1]*d
    vect[2]=vect[2]-v[2]+velo[2]*d
   
    local v=-math.sqrt(vect[1]*vect[1]+vect[2]*vect[2])*200
    local dir=math.atan2(vect[1],vect[2])+1*math.pi/2
    
    setBallMotion(v,dir,0)

coppelia
Site Admin
Posts: 6747
Joined: 14 Dec 2012, 00:25

Re: Ballbot and Controller

Post by coppelia » 08 Mar 2018, 08:47

From what I can tell, the controller looks at the Z-vector component of the Ballbot's reference frame (object BallRobot_sensorPosition) to determine the amount and direction of inclination.

Cheers

pedrophj
Posts: 3
Joined: 15 Feb 2018, 01:21

Re: Ballbot and Controller

Post by pedrophj » 08 Mar 2018, 14:49

Thanks for helping me. Now I can design an LQR or PID controller.

Post Reply