for Robot Artificial Inteligence

12.Insertion sort

|

Introduction

  • Insertion sort is another take on sorting elements one at a time. This algorithm sorts much like a human being would sort cards.

Why is it Important?

  • Insertion sort is another important sorting algorithm that is easy to follow along with. It is the next sort that is typically covered in a Computer Science curriculum.

Lesson Notes

  • Insertion sort works similar to that of selection sort, in that it has a sorted and unsorted portion. Instead of finding the minimum in the unsorted portion, it takes the closest number to the unsorted portion and inserts it in to the sorted portion. (Hence the name, insertion sort)

  • So, in the example above, it begins by making the 9 the first member of the sorted subarray. It then looks to the element that is to the right of the sorted subarray. In this case it is the number 7.

  • It grabs this number and inserts it in to the sorted portion. Since it is less than 9, it inserts it behind the 9.

  • Our sorted portion is now 2 big. We then take the next number that is to the right of the sorted portion. This is the 6. We insert that to the left of the 7, as 6 is less than 7. Our sorted portion is now 3 large. We look at the next number which is a 15. This number however is the largest number in the array, so we just keep it where it’s at and move to the next number. We continue this until the array is sorted.

  • This algorithm, although smarter than the other two, is still about the same magnitude of run time. The best case scenario is better than that of selection sort, as if the number to the right of the sorted subarray is larger than the entire sorted array, then it just moves the sorted array over to fill this number. It then just moves on. If the entire array comes in sorted, then it just does 1 pass through the entire array and returns that it is sorted.

  • Best Time: Ω(n) : If the array comes in sorted, it can do just one pass to figure this out. This makes it’s best case scenario, an already sorted array, run at n time.

  • Average Time: Θ(n^2) : The average time of this is similar to that of selection sort. On average we have to search the array 1 less time each iteration. So the run time is generally around n(n-1)/2. This means that It will simplify to (n^2-n)/2 which means it will be n^2.

  • Worst Time: O(n^2) : This is when the array is reverse sorted. The array will have to insert and swap backwards for every single number in the array, making it have to make n operations, for the n sized array. In other words n*n which is n^2.

Comment  Read more

1. Fundamental of Computer science and programming

|

Computer Science(CS) vs Information Technology(IT)

  • 대표적으로
    • CS : Technology Designer & Developers
    • IT : Technology Implimenters and Practicioners
  • Career Focus
    • CS : The Computer Science professionals study the design and purpose of computer especially the mechanics of computation, data processing and system control. they understand the intricacies(繁琐复杂) of computer theory and master the mathematical algorithms necessary to write the code and develop innovative computer hardware, software programs and operating systems
    • IT : IT professionals use computer system, software and networks to process and distribute the data. they find technologicl solution for business needs by adapting, developing, maintaining the operating system and programs designed by the computer scientist. IT has become business critical element for day to day operations and maintenane of IT infrastructure for small and large companies

Computer science

Computer science is a discipline(训导) that spans(持续时间) theory and practice. it requires thinking both in abstract terms and in concrete terms. the practical side of computing can be seen everywhere. Nowadays, practically everyone is a computer user and many people are even computer programmer.

the computer science is inherently(天性地(선천적으로)) an interdisciplinary(多学科的).

the data science a sub-discipline of somputer science which is based on the fundamentals of mathematics and statistics used to develop critical reasoning and complex problem solving abilities

DataBase Fundamental

Classification of Computer science

Application of Computer Science

DBMS Fundamental : Data ANd Information

Comment  Read more

로봇 공학 석사 과정

|

첫 로봇 입문

대학교때 캡스톤 디자인으로 스마트 지팡이를 만든적이 있다. 시각장애인들을 위해 아두이노와 센서들을 이용하여 경사면이나 계단 장애물을 인식할 수 있는 지팡이를 만든 적이 있다. 이것이 내 첫 로봇 작품이다.

로봇공학 석사 과정

로봇 공학 석사 과정으로 진학을 하면서 굉장히 어려웠다. 우선 코딩 스킬도 좋지 못할 뿐더러 로봇에 관한 지식이 많이 부족하기 때문이였다(대학교때 들은 거라곤 동역학..). 첫학기에 Digital signal process(DSP), Linear Algebra, Mechanical System Dynamics, Performance Simulation and Control robot 등 수업을 들었다. 어려운 학문도 있고 쉬운 학문도 있었지만, 모두 굉장히 시간이 많이 들어가는 과목들이었다. 첫 학기가 끝나고, 로보틱스에 대해 더 자세히 공부하고 싶어 edX의 Columbia university에서 개설한 Robotics를 수료하였으며, Udemy에 Industrial Robotics를 수료하였고, Linear Algebra를 복습하였다. 현재 우리 연구실에서는 DSP를 활용하여 연구하지 않기 때문에 DSP에 대한 추가적인 공부는 보류하였다.

로봇 어플리케이션 1

첫 학기가 끝나고 이제 본격적으로 연구 활동에 들어가기 전에 겨울 방학 동안 프로그래밍에 대해 공부를 하였다.

  • ROS
  • Machine Learning (python)
  • Github
  • Solid Work
  • Matlab
  • Robotics(hello ROS world 과정)

지금 돌아서 생각하면, Solid work를 제외한, Udemy의 ROS 과정과 Machine learning 그리고 Robotics, Github, Matlab들이 유용했던것 같다. ROS는 현재까지 졸업 논문이나 학회 논문을 제출하는데 있어 중요한 시스템인데, 디버그가 많고 메카니즘을 이해하는데 시간이 필요하다. Machine Learning은 사실 현재 어디에서도 쓰이고 있기 때문에, 기본적인 개념을 알고 있다면 논문을 읽거나 공부하는데 이해하기 쉽기 때문이다. Robotics는 Robotics의 개념을 ROS를 이용하여 실제로 개발을 해보는 것인데, 굉장히 도움이 많이 되었다. Matlab은 연구 뿐만아니라 수업중에도 많이 쓰이는데 모든 수학적 시뮬레이션이나 문제를 해결하는데 있어서는 Matlab을 알고 있는것이 좋다.

겨울 방학동안 어플리케이션 개발을 위한 역량을 쌓았으며 두번쨰 학기에 개발을 본격적으로 시작하였다.

두번쨰 학기에 어플리케이션 개발을 위해 필요한 공부로는

  • Machine Vision(OpenCv)
  • Self Driving using OpenCv
  • Tensorflow

학기가 사작하자 마자 나는 연구 과제에 참여하였다. 내가 하는 것은 Shape recognition을 맡아 책 꽃이 로봇에 들어가는 알고리즘이었다. 이에 Machine Vision에 대한 공부가 많은 도움이 되었으며, Shape Recongintion에 사용하지 않았지만 Deep learning을 통한 Self Driving 개발을 해보았고 TensorFlow를 이용하면서 Deep learning에 대한 개념을 익혔다.

로봇 어플리케이션 2

두번째 학기가 끝나고 8월까지 방황하였다. 세번째 학기가 들어스면서 이제 졸업 논문과 연구를 준비를 해야하는데 어떤 주제로 어떻게 해야할지 몰랐었기 때문이다. 이런 막연한 두려움 떄문에, Robot ignite 1년치 회원권을 샀다. 약 50만원 정도 하는 돈인데, ROS 시스템에대해 공부할 수 있고 실전 문제 해결을 할 수 있기 때문이다. Robot ignite에 대한 커리큘럼을 다 풀어보고 Udemy에서 Reinforcement Learning에 대한 공부를 하면서 10월에 논문 모델링을 하고 11월에 교수님에게 Reinforcement를 이용한 Dual Arm Pick and place를 발표하였는데, 교수님은 내가 준비한 논문 과제가 아닌 SLAM이라는 주제를 주어주셨다. 그렇게 2학기는 ROS 시스템 운영 방법과 Reinforcement Learning에 대해서 공부하였다.

로봇 어플리케이션 3

겨울방학동안 SLAM이라는 주제를 받으며 네번째 학기가 시작하기 전에 공부를 해야했다.

  • Multi view geometry
  • Visual SLAM 종류
  • robot probability

대략 두가지로 공부했던것 같다. 현재 연구실에서 개발된 ORB-SLAM2과 Yolov3를 이용하여 Semantic SLAM system, Visual odometer과 Wheel odometer 센서 퓨전을 통한 robot Localization이 있는데, 내 졸업 논문 주제로 Motion Planning과 Image Processing을 통한 Fast Frointer-based Autonomous exploration을 개발하는 것이였다. 대략적인 SLAM에 대해서 공부하는데는 한달정도 걸렸던것 같다. 이전에 몰랐던 분야라 처음부터 배우는데 많은 시간을 들여야 했기 때문이다. 연구실에서 개발된 Semantic SLAM based on ORB-SLAM2 with yolov3와 Fusion sensor data를 하는 것에도 대략 한달 걸렸던것 같다. 공부하는데 있어 Youtube와 SLAM KR의 도움을 많이 받았다.

그렇게 1월과 2월이 지나가면서 3월부터 본격적으로 Frointer-based Autonomous Exploration을 공부했다. 3월에는 Sample based method를 이용하여 Navigation을 구현하였으며 4월에는 Frointer-based를 통한 Exploration을 구현함과 동시에 RGB-D카메라를 이용하여 Fast-Frointer-based 알고리즘을 개발하였으며, 현재 병렬 프로세스로 구현하는 일만 남았다.

기타

석사 두번쨰 학기에 목표였던 블로그를 만드는 것이였다. Django를 약 한달 동안 공부해본적이 있는데, 사실 상당한 공부량과 시간을 투자해야하므로 Django대신 jerk를 이용하여 github을 통한 호스팅 블로그를 만들었다.

현재 코로나 상황으로 실제 로봇에 implementing을 하지 못하고 있는 상황이다, 현재 모든 개발은 Gazebo Turtlebot으로 이루어졌으며, 5월달에는 Data structure과 Algorithm을 공부하고 있다.

Comment  Read more

컴퓨터 공학 비전공자가 개발자 되기 위한 노력

|

첫 컴퓨터 언어 입문

나는 대학교때 컴퓨터 언어와 컴퓨터 프로그래밍이라는 과목을 들은 적이 있다. 컴퓨터 언어 수업에는 C++ 개념과 컴퓨터 프로그래밍에서는 Matlab과 Labview를 배운적이 있었는데, 그렇게 잘하지는 못하였다. 기억도 안나지만 C++로 공학용 계산기를 만들고 Labview와 Matlab을 이용하여 간단한 메커니컬 문제들을 풀었던 기억이 난다. 나는 수업을 들으면서 도통 컴퓨터 시스템과 메모리 그리고 메카니즘을 이해하지 못했다. 그러면서 나는 다짐했다, 컴퓨터 언어를 쓰는 직업은 안갖겠다고…

로봇공학 석사 과정

석사 과정을 하면서 로봇공학의 연구의 기본 베이스는 컴퓨터 언어이었다. 시뮬레이션이나 임베디드 코딩을 하면서 실험을 통해 결과를 뽑아내야 논문을 쓸 수 있기 때문이다. 거기다 나는 로봇 소프트웨어 관련된 연구실에 배정을 받게 되었다. 나는 처음 연구실에 왔을 때 주눅이 들었었다. 박사, 석사 심지어 학부 연구생들 모두 프로그래밍을 하는 모습을 보면서 과연 내가 이 학교에 졸업할 수 있을까? 양질의 논문을 써서 졸업할 수 있을까 라는 의문점이 들었기 때문이다. 그렇게 나는 최대한 프로그래밍 언어를 빠르게 습득해야겠다고 결심하였다.

스크립트 언어 Python

석사 첫 학기에는 정말 프로그래밍을 따로 공부할 시간이 없었다. 핸드폰도 개통해야되고, 학교 행사, 수업 과제등 매일 매일 해야할 것들이 쏟아져 나왔기 때문이다. 특히 학교 수업은 8과목을 들었는데, 말 그대로 죽는 줄 알았다. 엄청난 과제와 프로젝트는 내가 생각했던(여유로운 석사생활) 석사생활이 아닌 헬스로 치면 단기간 벌크업 하는 느낌이었다. 그렇게 한학기가 끝나고, 연구실 프로젝트를 참여하기 위해 Udemy에서 python 강좌와 Machine learning in python 강좌, 그리고 ROS로 시작하였다. C++가 아닌 python을 시작한 이유는 인터넷에서 많이들 쉽다고 하고, 또한 C++보다 느리지만 연구하는데 있어 파이썬으로 많은 것을 할 수 있기 때문에 python으로 먼저 공부를 하였다. Udemy에서 산 python 강좌와 Machine learning in python의 실전 문제를 풀면서 우선 코딩에 자신감을 갖게 되었다.

C++ 시작

파이썬을 이용해서 많은 알고리즘과 시스템을 이용해 보았다. Tensorflow라든지 Self Driving Car, Opencv, OpenAi등 재미있는것을 도루도루 해보았다. 그러던 도중 C++를 시작하게 되었다. 사실 python으로 모든 연구와 개발을 할 수있다. 하지만 현업, 즉 많은 로봇 회사에서는 C++를 사용하는데, 그 이유가 포인터나 data structure등을 이용하여 메모리 할당량의 크기와 Access가 더 빠르기 때문이다. 나는 석사 과정까지만 하기로 결정을 하였고, 회사를 찾고 있었다. 인턴이든 정규직이든 C++의 능력은 거의 필수이다. python을 사용하는 회사는 극히 드물다. 그렇기 떄문에 C++를 시작하였다.

C++ 공부

파이썬을 하다 C++를 하려고 하니 어느정도 상관된 메커니즘이라 이해는 되지만, 여전히 C++는 어려웠다. 특히 Static, Dynamic, Pointer 등등 Data structure를 구현하는 것도 어려웠고 특히 C++에 대한 시스템 이해도가 낮았다. 개인적으로 Udemy를 통해 Computer Language 스킬을 올리기에 적합하다 생각하여 3개의 강좌를 구매하였다. Begineer C++, Advance C++m을 구매하였다. Begineer C++에는 C++의 기본적인 시스템을 설명해주고 실전 문제를 통해 문제를 풀어보았다(도서관 문제). Advance C++는 C++ 테크닉을 가르킨다고 생각하는게 맞을거 같다.

비전공자가 개발자 되는데 있어 알면 좋은 과정들

19년 1년동안 연구 개발과 프로그래밍을 하면서 실력을 쌓았다. 20년 3월 나는 자신감을 가지고 MS 코딩 테스트를 보았다. 하지만 3개 문제 중에 하나의 문제도 제대로 풀지 못하였다. Data structure와 Algorithm을 공부한적이 없기 때문이다. 여태까지 연구 개발하면서 기초적인것을 놔두고 문제에 직면하였을떄 구글링을 통한 문제를 풀었기 떄문에 스스로 알고리즘 문제를 풀 능력이 없었기 때문이다. 충격을 받고 이대로는 취업을 못하겠다라는 생각에 비전공자이지만 개발자로 일하고 계신 노코프님에게 메일을 보내어 진로 상담을 하였다. 비전공자가 개발자가 되는데 필요한 지식은 다음과 같다.

  • Data structure
  • Algorithm
  • OS
  • Computer Architecture(조금)

Data structure and Algorithm 에는 Time 및 Space Complexity를 논할 정도면 된다. OS, Computer Architecture에는 Process view, Thread model, CPU structure, memory hierarchy, virtual memory 정도 알고 있으면 된다. 실전 코드문제는 Leetcode 문제들을 통해 각 문제별로 Data structure와 Algorithm등이 어떻게 쓰이는것이 아는 것이 중요하다.

앞으로

비전공자들이 코딩을 공부하면서 코딩 테스트에 떨어진 경험이 많다. 특히, 업계에서 엔지니어링 석박사 학위 수준의 경력과 컴퓨터를 잘하는 사람을 찾는데 적합한 인재가 되기에는 많은 노력이 필요하다. 논문 구현을 어설프게 할 줄 아는 사람을 뽑아서 제품에 들어가는 프로그램을 맞길 수 없기 때문이다. 이리저리 정보를 보고 정리를 하면서 컴퓨터 비전공자가 알아야할 컴퓨터 관련 기대 수준은 컴공 학부 2~3학년 수준이라고 생각이 된다. 앞으로 2020년 취업까지 반년이 남았는데, 기초를 튼튼히 쌓고 연구 개발 및 코딩 문제 해결 능력등을 통해 현재 이 불안함을 떨쳐 낼 것이다.

Comment  Read more

2. Creating Project.

|

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

using namespace std;

ifstream f("data.in"); // reading a file named"data.in"
ofstream g("data.out"); // writing a program result of control input

int main()
{
    int a, b, sum;

    f>>a>>b;
    sum = a + b;

    g<<sum;

    return 0;

}

Comment  Read more