for Robot Artificial Inteligence

2. Sensor Fusion for Localization and Multi-object Tracking

|

Sensor Fusion to estimate orientation

  • Attitude and Heading reference system(AHRM)

  • 자력계 [magnetometer, 磁力計]

  • we can find orientation using Magnetometer, Accelerometer, Gyro

  • Accleromter : 중력 방향을 이용해서 orientation을 찾는다 (accleration은 오직 위아래 Gravity만 얻는다.)
  • Magnetometer : 자기력을 이용하여 북쪽을 결정한다. (기준점을 이용한 orientation구한다, 만약 Magnetic 물체가 있으면 방해를 받는다.)

  • 하지만 남반구인지 북반구인지에 따라 북쪽을 가르키는 방향이 다르다.

  • 정확한 북쪽을 가르키기 위해서는 몇가지 외적이 필요하다.

  • 아래쪽은 가속도 벡터의 반대 방향( Measure accleration)
  • East는 아래쪽과 Magnetic field의 외적이고
  • 북쪽은 동쪽과 아래쪽의 외적이다.
  • 따라서 본체의 방향은 본체 프레임과 NED(North, East, Down) 프레임 사이의 회전이다.
  • 방금 계산한 NED 벡터에서 Direction Consine Matrix directly하게 구할 수 있다.

let’s check real device

  • there is a physical IMU and Accelerometer.

  • first connect to the Arduino and IMU
  • and using a Matlab viewer to visualize the orientation
  • update the view each time
  • from for 1 = 1:1000 to Q
    • is a basically reading the sensors performing the cross products and building The DCM

  • but the systme is linear, so if moving alot it’s estimate accurate down
  • Accleration 센서는 오직 위아래 중력 값만 판단한다.
  • Magnetic 물체가 있으면 orientation 값을 찾는데 방해를 받는다.
  • 예를 들어

  • 문제를 풀기 위해 Calibration 필요

  • 한가지 더 문제인 Corrupting linear accelrations

  • take the commands that are sent to the actuators and play it through a model of the system to estimate the expected linear acceration and then subtract that value from the measurement
  • this is something that is possible if say our system is drone and mine is flying it around by commanding the four propellers.
  • if we can’t predict the linear acceleration or the external disturbances are too high, another option is to ignore accelerometer reading that are outside of some threshold from a 1g measurement. if magnitude of the reading is not close to the magnitude of gravity, then, clearly the sensor is picking up on other movement and it can’t be trusted.
  • this keeps corrupted measuremens from getting into our fusion algorithm, but it is not a great solution because we stopped estimating orientation during these times and we lose track of the state of the system again
  • it is not really problem if we trying to estimate orientation for a static object.

Solving to get orientation value problem

  • add gyro !

  • there are two method to find orientation
    • accel + mag
    • Gyro
  • accel + mag 장단점과 Gyro의 장단점을 합하여 문제점 해결

  • Complementary(상호 보완) Filter
  • Kalman Filter
  • Madgwick
  • mahony

  • 센서 퓨전을 하면서 어떤 센서를 더 믿을 것인지 결정하는 것이 중요하다.

Reference

Matlab Sensor Fusion.

Comment  Read more

1. Fundamental of Sensor Fusion

|

Sensor Fusion

센서 융합은 자율 시스템 설계의 필수 요소이다. 자율 주행차, 레이더 추적기지(Ladar tracking station), inter of thing(IOT) 등 여러 종류의 센서 융합에 의존한다.

what is sensor fusion?

Definition : combining two or more data sources in a way that generates a better understaning of the systems

  • more consistent(一致的)
  • more accurate
  • more dependable

why sensor fusion need?

4 ways sensor fusion can help

  • No.2 : reduce noise with two different sensor types

  • Coverage : 적용 범위
  • Coherent : 일관성 있는

how does sensor fusion help in the design of autonomous system?

Reference

Matlab Sensor Fusion.

Comment  Read more

3. Computer System

|

What is a Computer System?

  • A computer system is a programmable electronics device that can be programmed to accpet some inputs in terms of data, then process this data and provide the Output in the desired format.
  • Computer is Digital Electronic Machine
  • Computer Needs to be Programmed
  • Computer Hardware can execute only Machine Code

  • all the programs instructions written in any programming language must be first converted to machine code instructions in binary which can be directly interpreted and executed by the CPU

  • A computer system is a programmable electronics device that can be programmed to accpet some input in terms of data, then process this data based on program insturctions and provide the output in the disired format.
  • the input is generally in the form of data which is commonly defined as raw facts and observation. data could be in any form such numbers, chracters, alphabets and special symbols.

    A computer consists of four basic Components:

  • ALU is the Arithmetic and Logic Unit which performs all the arithmetic and logical operations such as addition, subtraction, logical AND, OR etc. CU is the Control Unit. It decodes the instructions, and controls all the other internal components of the CPU to make it work.

what is computer hardawre & software?

  • Computer consist of two main compenents(Hardware + Software)
  • Computer Software : Operation System + System Software + Application Programs

  • the computer system mainly consist of hardware components and the software.
  • all the physical components inside the computer cabinet and the input/output gadgets attached to the computer are referred as hardware components.
  • the hard ware components inside the computer cabinet are referred as internal components such as motherboard
  • the external hardware components attached to the computer system are also referred as peripheral devices such as keyboard.

System Software

  • system software는 software과 hardware를 운영하고 컨트롤하여 컴퓨터 시스템을 가동 하는 것이다.

MAINFRAME COMPUTERS

Super Computers

Comment  Read more

3.Global/Local Variable

|

  • Global Variable
    • defined on top
    • initialized with 0
    • visible everywhere
  • Local Variable
    • defined in functions
    • initialized randomly
    • visible just in the function

Global/local variable Example 1

#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int Aglobal[3]; // global array of variable
int a ;

void printing()
{
    cout<<a;
}

int main()
{
    int Alocal[3];

    a = 5;

    printing();

    return 0;

}
  • Aglobal is the global array of variable.
    • it is allocated in the stack in memory structure as int(4 bits) memory allocation.
  • Alocal is the local array of vairble.
    • it created in the stack in memory structure as int(4byte) memory allocation.
  • printing allocated in the stack in memory structure
  • int a allocated in the stack in memory structure

  • 글로벌 variable은 고유의 값으로 local function에서 지정할 수 있고 main function에서 값을 지정할 수 있다.

Global/local variable Example 2

  • 그렇다면 만약 global에도 똑같은 variable 이름과, 로컬에도 똑같은 Variable 이름이 있다면 어떻게 되는가

#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int Aglobal[3]; // global array of variable
int a ;

void printing()
{
    cout<<a<<"\n";

    int a = 5;

    cout <<a<<"\n";
}

int main()
{
    int Alocal[3];

    a = 100;

    printing();

    return 0;

}

  • C++는 객체언어로 Sequence대로 출력이 되기 떄문에 ,Global Variable a값이 먼저 출력이 되고 local function에서 지정한 a 값이 출력이 된다.

  • 여기서 주의해야할 점은 Local Function에서 지정된 변수 a이의 이름은 Global 변수하고 이름이 같은데, Local Function이 종료가 되면 Allocated 되었던 Local variable 값은 초기화가 되고 Local Funtion이 끝나고 a 변수 값은 Global Variable 값으로 돌아온다

#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int Aglobal[3]; // global array of variable
int a ;

void printing()
{
    cout<<a<<"\n";

    int a = 5;

    cout <<a<<"\n";
}

int main()
{
    int Alocal[3];

    a = 100;

    printing();

    cout<<a<<"\n";

    return 0;

}

  • after we exit a function, local variable disappear (cannot seen/used in other functions)

Global/local variable Example 3

  • Functions parameter are local variables!
  • 즉 Function 파라미터들은 로컬 변수로 메모리 구조 Stack에 Allcolate 된다.
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int A[3][5], i ;

void printingRow(int row)
{
    for (i=0; i<5; ++i)
    {
        cout<<A[row][i]<<" ";
    }
    cout<<"\n";
}

int main()
{
    for(i=0; i<3; ++i)
    {
        printingRow(i);
    }

    return 0;

}

  • 여기서 첫 행밖에 출력이 안되는 이유는 현재 global variable i 만으로 for loop을 사용하기 때문이다

  • 더 자세하게 말하자면, 현재 main function에서 i=1이 local function 파라미터로 들어간다. int row로 allocated가 되어서 i=1값이 들어가게 되는데, local function for loop에 global variable i를 쓰면서, 첫번째 행이 끝나고 i의 값은 5가 되어 있다. 그리고 exit local function 했을떄 i의 값은 이미 5가 되어있으므로 main function에 있는 for loop의 조건을 충족하지 못하여 나가게 되는 것이다.

  • 그렇기 때문에 Global Variable로 for loop 쓸떄 주의해야 한다.

  • 아래와 같이 해결 할 수 있다.

#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int A[3][5];

void printingRow(int row)
{
    for (int i=0; i<5; ++i)
    {
        cout<<A[row][i]<<" ";
    }
    cout<<"\n";
}

int main()
{
    for(int i=0; i<3; ++i)
    {
        printingRow(i);
    }

    return 0;

}

Exercise (Array Return)

#include <iostream>
#include <bits/stdc++.h>
using namespace std;

void addMatrix (int matrix[][5], int X)
{
    for (int i=0; i<5; ++i)
    {
        for (int j=0; j<5; ++j)
        {
            matrix[i][j]=+X;
        }
    }
}

void printingmatrix(int matrix[][5])
{
    for (int i=0; i<5; ++i)
    {
        for (int j=0; j<5; ++j)
        {
            cout<<matrix[i][j]<<" ";
        }
        cout<<"\n";

    }

}

int main()
{
    int Alocal[5][5];

    // initialize, because local variable value is random when they are allocated. on the other hand, global variable is 0 when they allocated.
    for (int i = 0; i<5; ++i)
    {
        for (int j=0; j<5; ++j)
        {
            Alocal[i][j] = 0;
        }
    }

    addMatrix (Alocal, 1);

    addMatrix (Alocal, 10);

    printingmatrix(Alocal);

}

  • 값이 11이 아니라 10이 나오는 이유는 matrix[i][j]=+X; 가 아니라 matrix[i][j]+=X;로 하여야 acculate가 된다.
  • 메인 function에 있는 Alocal 값이 local function 파라미터 matrix로 변하면서 즉 matrix = Alocal이 되면서 Accoluate가 된다.

  • 해결책
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

void addMatrix (int matrix[][5], int X)
{
    for (int i=0; i<5; ++i)
    {
        for (int j=0; j<5; ++j)
        {
            matrix[i][j]=+X;
        }
    }
}

void printingmatrix(int matrix[][5])
{
    for (int i=0; i<5; ++i)
    {
        for (int j=0; j<5; ++j)
        {
            cout<<matrix[i][j]<<" ";
        }
        cout<<"\n";

    }

}

int main()
{
    int Alocal[5][5];

    // initialize, because local variable value is random when they are allocated. on the other hand, global variable is 0 when they allocated.
    for (int i = 0; i<5; ++i)
    {
        for (int j=0; j<5; ++j)
        {
            Alocal[i][j] = 0;
        }
    }

    addMatrix (Alocal, 1);

    addMatrix (Alocal, 10);

    printingmatrix(Alocal);

}

Comment  Read more

2. CPU

|

Transistor in Microprocessor

CPU

  • Brain of the computer system
  • the cpu(central processing unit) is one of the most important compnent which is responsible to perform all arithmetic calculations and logical operations performed by the computer system.
  • the CPU consist of millions of tiny component called “transitor” which is fundamental building block for all CPU. the transistor is used in CPU as tiny switch to define two states “ON” and “OFF”

Moore’s Law

  • Moore’s Law is named after GOrdon E. Moore who was co-founder and chairman Emeritus of Intel Corporation. Gordon Moore first published what later became known as Moore’s Law in 1964 in a electronics magazine article called “Cramming more components onto integrated circuits”. this is actually a observation rather a law.

Comment  Read more