Category

Thursday, October 11, 2012

Centralized vs decentralized and distributed vs non-distributed

  • Thanks to the PhD thesis of Keith Yu Kit Leung: "Cooperative Localization and Mapping in Sparsely-Communicating Robot Networks" I understood the differences.

  • Definition 1: A centralized multi-robot system is a group of robots in which the computation for a task is performed only by a specifc robot in the team or by an external computer.
  • Definition 2: A decentralized multi-robot system is a group of robots in which the computation for a task can be performed by any one or more robots in the team.
    • which means, if the one who was doing the task fails, someone else can take over
  • Definition 3: A distributed multi-robot system is a group of robots in which the computation for a task is divided amongst the robots in the team.
so we can have systems like these:
  1. centralized+distributed: all the nodes perform some part of the task and finally one guy put everything together
  2. centralized+non-distributed: one node performs the task
  3. decentralized+distributed: part of the tasks are divided and anyone can put everything together; no need of a special guy
  4. decentralized+non-distributed: one guy performs the entire task(non-distributed) but this one guy can be any guy. that means if the guy who was doing the task fails, another one can take over

Monday, May 28, 2012

Hi guys,

Well, global variables are not encouraged in MATLAB. But, sometimes you may want to initialize an object with some parameters and you would like to access some global parameters as well.

Here is what you can do.
  • Create a file (say Params.m) for storing such global variables.
          insert your global parameters like this:
          global MY_GLOBAL; MY_GLOBAL = 1;
  • Next, include this file in your main .m file.
          Params;
  • Afterthat, in your class file, inside the constructor function (or any other function)
          global MY_GLOBAL;
          obj.xyz = MY_GLOBAL;

done!


Tuesday, May 1, 2012

Sensor model and Likelihood Function

  • The probabiloty density function (pdf) p(z|x) serves as the sensor model.
  • This can be thought of in two ways:
    • to build the sensor model: we can fix x = x and ask what pdf in z results. Then, p(z|x) is a function of z. An exmaple would be, say we know the true location of a target then p(z|x) is the distribution of the observation.
    • when the sensor model is established observatione are made and z = z will be fixed. From this then we want to infer the state x. Thus, p(z|x) will then be a distribution of x. This distribution is called the likelihood function. L(x) = p(z|x)
  • In the case of likelihood function we know the observation z = z. But, that does not mean we are going to calculate p(x|z); we are still dealing with p(z|x).

Friday, January 13, 2012

Pull up and pull down Resistors

  • The task of a pull up or pull down resistor is to give a default value to a pin of a circuit component when there is no other connection is present. So, we are making the particular pin not to float!.
  • Have a look at this circuit:

    • Now, when S1 switch OFF, the input '1' is floating and it can take any value because of noise. So, we cannot really predict what will be there at the output '2'.
  • To avoid this kind of behavior we attach a pull up resistor as follows:
  • Now, when the S1 switch is OFF the pin '1' takes the Vcc voltage because normally the component does not absorb any current (high impedance inputs). 
  • Pull down resistor does essentially the same job.
I2C
  • I²C requires pull-up resistors on its clock (SCL) and data line (SDA).
  • The reason is because the pins on the chips are of open-collector design, which means that a chip can only pull the lines low, otherwise they float up to VDD. 
  • In I²C, pulling the line to ground indicates a logical zero while letting it float to VDD is a logical one. 

  •  Pull up resistors help nodes to determine whether the other nodes are transmitting or not by monitoring the state of the line.
    • When a node is transmitting it will the pull the line down to zero. Then the first node can detect that the other is transmitting.
[images credit: http://www.seattlerobotics.org/encoder/mar97/basics.html
http://en.wikipedia.org/wiki/Pull-up_resistor]

Friday, October 7, 2011

Correlation Coefficient

  • The correlation coefficient (or cross-correlation coefficient) gives a measure of correlation (linear dependence) between two variables X and Y. It takes the values between +1 and -1 inclusive.
    • if the value is +1: the two data sets have a perfect positive relationship (if one increases, then the other also increases)
    • if the value is -1: the two data sets have a perfect negative relationship

  • There are several correlation coefficients. Let's have a look at the common Pearson product-moment correlation coefficient (PPMCC).
  • PPMCC is defined as the covariance of the two variables divided by the product of their standard deviations:

                                           this defines the population correlation coefficient.

  • For a sample based representation, we have sample correlation coefficient:
  • Here, you can notice that divide by n (for E operation) in the numerator and the denominator is cancelled off .
  • Now let us see an example.
    • let data set X = {10, 20, 30, 40, 50, 60} and Y = {3, 5, 2, 3, 7, 4}
    • E(X) = (10+20+30+40+50+60) / 6 = 35; E(Y) = (3+5+2+3+7+4) / 6 = 4
    • Numerator: (10-35)(3-4)+(20-35)(5-4)+(30-35)(2-4)+(40-35)(3-4)+(50-35)(7-4)+(60-35)(4-4) = 60
    • Denominator: sqrt((10-35)^2 + (20-35)^2 + (30-35)^2 + (40-35)^2 + (50-35)^2 + (60-35)^2) * sqrt((3-4)^2 + (5-4)^2 + (2-4)^2 + (3-4)^2 + (7-4)^2 + (4-4)^2) = 167.332
    • r = 60/167.332 = 0.358569

  • When the two data sets are equal, we have:

    • If you calculate the PPMCC for X = {10, 20, 30, 40, 50} and Y = {1, 2, 3, 4, 5} you will find that it is equal to 1.
      • This means that for PPMCC to be equal to 1, you do not need the two data sets to be equal.
    • PPMCC can be used as a matching techniques
      • map matching
      • image matching
    Equation credit: wikipedia

    Thursday, September 22, 2011

    Central Limit Theorem (CLT)

    • Before defining central limit theorem let's clarify the term i.i.d.
      • independent and identically distributed (i.i.d) random variables - this means that the random variables we consider have the same probability distribution as the others and they are mutually independent. An example would be two dice experiments performed simultaneously.

    • Central limit theorem states that if you take the average of the outcomes of sufficiently large i.i.d random variables, with finite mean and variance, it follows a normal or Gaussian distribution. 

    • Here is an example. Suppose we throw a dice 10000 times. Then the outcome would more or less look like this (uniform distribution).

    • Now, let's throw 2 dices together 10000 times and observe the average (or you can observe the sum of the outcomes for that matter) of outcomes.

    • Now, you get the idea. Suppose we throw 50 dices together 10000 times and observe the average (or sum) of outcomes.

    • This looks like a normal distribution to me.
    • Wikipaedia says: "Since real-world quantities are often the balanced sum of many unobserved random events, this theorem provides a partial explanation for the prevalence of the normal probability distribution".

    Wednesday, August 17, 2011

    URDF and XACRO for Modeling

    • We use Unified Robot Description Format (URDF) to model robot links and joints. It is in an XML format containing a tree of links and joints. It includes the inertial, visual and collision knowledge of the object being model.
       
    • XACRO is an XML macro language. It can be used to create shorter and more manageable XML files than URDFs. This is helpful when more than one links have the same properties and dimensions, like a table leg. In a URDF file every table leg would have to have its own defined properties and dimensions, like a cylinder radius and height. But in a XACRO they could all equal one variable.
    e.g.
    <xacro:property name="width" value=".2" />
    <xacro:property name="bodylen" value=".6" />
    <link name="base_link">
       <visual>
          <geometry>
             <cylinder radius="${width}" length="${bodylen}"/>
          </geometry>
          <material name="blue">
             <color rgba="0 0 .8 1"/>
          </material>
       </visual>
     <collision>
       <geometry>
         <cylinder radius="${width}" length="${bodylen}"/>
       </geometry>
      </collision>
    </link>


    By using XACRO you can make your XML files manageable.