Author Archives: admin

Simple C++ Code for Multi Dynamixel Servo Motor Control

Simple C++ Code for Multi Dynamixel Servo Motor Control

 

// this post is updated to eliminate the dependency on QT, 2015.06.26

 

In this post, I am sharing my C++ class to control multi Dynamixel servo motors.

In my case, I am using MX-24f, but most of dynamixel servo motors are using the same protocol. Thus, you can use this code directly. I am attaching all files (dynamixel library and others) to execute a demo program.

<Download>

If you don’t need common files, just use “multi_dnmx_motor.h” and “multi_dnmx_motor.cpp”. For the usage, see “main.cpp” file. It is super easy.  Demo program was made for Linux environment, but Windows uses still can use “multi_dnmx_motor” class

If you don’t know anything about Dynamixel program. Just follow the below.

 

0. Before following this instruction, check if the connection and settings are correct with “RoboPlus Manager” which can be downloaded in Robotis website, >> Support >> Download.

1. Go to “Dynamixel_src” folder.

2. “Make” : It will generate a library and automatically copy the lib. to the library folder.

3. Go to “Multi_Dynamixel_Motor_Control” folder.

4. Open “multi_dnmx_motor.h” file

5. Change “user setting”. You have to set the baud_rate, number of motors, and their motor IDs. Just change defines. (If you don’t know motors’ these values, use “RoboPlus”, a super easy program, and available in the Robotis website, http://support.robotis.com/en/ )

// User setting
#define BAUD_NUM 34 // 1: 1Mbps 34:57142bps
#define NUM_OF_MOTORS 4 // Number of motors

#define MOTOR_ID_1 1 // Motor 1 ID
#define MOTOR_ID_2 2 // Motor 2 ID
#define MOTOR_ID_3 3 // Motor 3 ID
#define MOTOR_ID_4 4 // Motor 4 ID

6.  compile it with this command

” g++ main.cpp multi_dnmx_motor.cpp -I../include -L../lib -ldxl  ”

7. Execute the program.

 

Good luck ^_^

<Download>

Add a shared object (*.so) file in qt project file (pro), example

The following is an example.

#————————————————-
#
# Project created by QtCreator 2013-12-20T11:36:03
#
#————————————————-

QT       -= gui

TARGET = Mocap_QT
CONFIG   += console
CONFIG   -= app_bundle

LIBS += ./lib/libowlsock.so

INCLUDEPATH += ./include/

TEMPLATE = app

SOURCES += main.cpp

Accurate, Robust, and Real-time Estimation of Finger Pose with a Motion Capture System

Finger exoskeletons and haptic devices demand an accurate, robust, and fast estimation of finger pose. We present a novel finger pose estimation method using a motion capture system. The method combines system identification and state estimation in a unified framework. The system identification stage investigates the accurate model of a finger, and the state estimation stage tracks the finger pose with Extended Kalman Filter (EKF) algorithm based on the model obtained in the system identification stage. The algorithm is validated by simulation and experiment. The experiment results show that the method can estimate the finger pose faster than 1 Khz and robustly against the measurement noise, occlusion of markers, and fast movement.

Sorry, no publications matched your criteria.

Hill Type Muscle Model with Matlab Code

Hill Type Muscle Model with Matlab Code

In this post, I will write on the Hill type muscle model, and then, I will provide a Matlab code made for the model. 

If you have a basic knowledge about the muscle tendon unit, and just want to download the Matlab code, just download from the following links

<Matlab m code> or <Matlab Simulink block>.

If you are familiar with Biomechanics, I think the best source to study a muscle tendon model is Zajac’s paper [4]. 

OK let’s go to the main writing.

Generally, the muscle tendon unit is modeled by the below figure including a CE (controctile component element), PE (parallel elastic element), and SE (series elastic element). This is the Hill type muscle-tendon model. The CE and PE are elements for a muscle, and the SE is for a tendon. Sometimes the SE is ignored in modeling, depending on tendon type, because its stiffness is very high.

hill type muscle model [1], Hill Type Muscle Model with Matlab Code

hill type muscle model [1]

The CE generates a contracting force on tendon, and the size of force is a function of the velocity/length of muscle as shown in the below equations. This is a general model, but sometimes the other model is used, depending on the type of muscle, if you want to know the detail refer [3]. 

Fce, Hill Type Muscle Model with Matlab Code

Force function of CE [2]

The PE element is modeled by the below equation. Again SE can be ignored, thus in my Matlab code, it is ignored.

Force of PE and SE, Hill Type Muscle Model with Matlab Code

Force of PE and SE [5]

Finally, we can make a model based on the above equations. In my code, I made a muscle-tendon model for finger muscles. If you want to model for the other muscle tendon unit, you have to search several parameters for the muscle.

You can download the Matlab code and Simulink code from below link. I made the same function with two different ways for user’s convenience.

<Matlab m code> or <Matlab Simulink block>.

 

[1]
E. M. Arnold, S. R. Ward, R. L. Lieber, and S. L. Delp, “A Model of the Lower Limb for Analysis of Human Movement,” Ann Biomed Eng, vol. 38, no. 2, pp. 269–279, Feb. 2010.
[2]
J. Rosen, M. B. Fuchs, and M. Arcan, “Performances of Hill-Type and Neural Network Muscle Models—Toward a Myosignal-Based Exoskeleton,” Computers and Biomedical Research, vol. 32, no. 5, pp. 415–439, Oct. 1999.
[3]
J. L. Sancho-Bru, A. Pérez-González, M. C. Mora, B. E. León, M. Vergara, J. L. Iserte, P. J. Rodríguez-Cervantes, and A. Morales, “Towards a realistic and self-contained biomechanical model of the hand,” 2011.
[4]
Z. Fe, “Muscle and tendon: properties, models, scaling, and application to biomechanics and motor control.,” Crit Rev Biomed Eng, vol. 17, no. 4, pp. 359–411, Dec. 1988.
[5]
P.-H. Kuo and A. D. Deshpande, “Contribution of passive properties of muscle-tendon units to the metacarpophalangeal joint torque of the index finger,” in Biomedical Robotics and Biomechatronics (BioRob), 2010 3rd IEEE RAS and EMBS International Conference on, 2010, pp. 288–294.

 

—————————————————————————————————————————–

I am Youngmok Yun, and writing about robotics theories and my research.

My main site is http://youngmok.com, and Korean ver. is  http://yunyoungmok.tistory.com.

—————————————————————————————————————————–

Matlab compiler installation. If you have trouble after installation of Microsoft Windows SDK 7.1

Solution for the Matlab compiler installation. If you have trouble after installation of Microsoft Windows SDK 7.1

Today I am writing a tip to solve a Matlab compiler setup problem. 

If you want to use MEX or any Matlab compiling technology, you need a compiler. Windows does not have a default compiler. So you have to install. If you don’t have any compiler, you would see the below message.

>> mex -setup

Welcome to mex -setup. This utility will help you set up 
a default compiler. For a list of supported compilers, see 
http://www.mathworks.com/support/compilers/R2013a/win64.html 

Please choose your compiler for building MEX-files: 

Would you like mex to locate installed compilers [y]/n? y

No supported SDK or compiler was found on this computer. 
For a list of supported compilers, see 
http://www.mathworks.com/support/compilers/R2013a/win64.html 

Error using mex (line 206)
Unable to complete successfully.

If you follow the link, you can install “Microsoft Windows SDK 7.1”

BUT, IMPORTANT, if you don’t have “.NET Framework 4.0,” you cannot install the compiler. As shown in the below figure, you MUST install .NET Framework 4.0 for installation of the windows compiler.

Matlab compiler problem, if you have trouble after the installation of Microsoft Windows SDK 7.1

Matlab compiler problem, if you have trouble after the installation of Microsoft Windows SDK 7.1

Then, I wish this post can help to solve your problem.

Thank you.

—————————————————————————————————————————–

I am Youngmok Yun, and writing about robotics theories and my research.

My main site is http://youngmok.com, and Korean ver. is  http://yunyoungmok.tistory.com.

—————————————————————————————————————————–

C++ code for reading unknown size matrix from text file

C++ code for reading unknown size matrix from text file

In this post, I upload my program {C++ code for reading unknown size matrix from text file } <download> which imports an arbitrary size matrix (or 2D array) from text (txt) file. This is c++ code.

The below is an execution result. The first figure is a text file including a matrix, the next figure is an execution screen. It’s very easy to use.

xtxt

text file to import. It has an arbitrary size matrix

screen

execution screen image, it imported the matrix from the above text fileSometimes, we want to import a matrix that we don’t know its size, especially when the file was generated from other programs.

I had googled for long time, and I realized that it is not easy to find. So, I made.

You don’t need to indicate the size of matrix, (cols and rows). It automatically imports and outputs, double type vector,  column and row size. It is very easy to use, and you can download the source code from here  <download>.

The only thing you should do is just download the source code, and import “x.txt” or “y.txt” which includes an arbitrary matrix.

Enjoy my program { C++ code for reading unknown size matrix from text file } Then good luck.

I referred partially this site.

http://stackoverflow.com/questions/1321137/convert-string-containing-several-numbers-into-integers

—————————————————————————————————————————–

I am Youngmok Yun, and writing about robotics theories and my research.

My main site is http://youngmok.com, and Korean ver. is  http://yunyoungmok.tistory.com.

—————————————————————————————————————————–

Very good source code for serial communication in QT Linux envirionment

< Source code for serial communication in QT Linux envirionment>

The below site has pretty good source code for serial communication in Linux QT environment.

You can download and learn how to use it.

http://www.embedded4fun.com/serial-port-interfacing-in-qt/

 

The below is how to install the code.  ( from the upper site)

  • cd <any folder (preferrably to the QtSDK installation folder)>
  • git clone https://code.google.com/p/qextserialport/
  • cd qextserialport
  • qmake
  • make
  • make install

<download>

Hyperterminal for serial communication (rs232 or rs485), download

Hyperterminal for serial communication (rs232 or rs485), download 

When I used Windows XP, I loved to use Hyperterminal because it is pretty simple and easy to use for serial communication. Especially it is pretty good for RS232 or RS485 communication. But now Windows does not support Hyperterminal any more.

So. I am attaching the previous program. You can download the program from the below link.

<Hyperterminal Download>

Previous research

>> 3D Environment Reconstruction & 3D SLAM based on Plane Feature

– Period : September, 2010 ~  2012

– Co-research with Prof. Nakju Doh, and Sooyong Yeon, Robotics Lab., Korea University
– Feature-based 3D SLAM(Simultaneous Localization and Mapping) algorithms can overcome weak points of non-feature-based (point-based) 3D SLAM algorithm such as ICP. Plane feature-based 3D SLAM approach manages map with plane features, which enables 3D SLAM at large-scale environment in real time.

* click to see a large picture

– Related Papers:

Sooyong Yeon, Changhyun Jun, Hyunga Choi, Jaehyeon Kang, Youngmok Yun, and Nakju Lett Doh, “Robust-PCA based Hierarchical Plane Extraction for the Application of Geometric 3D SLAM,” Industrial Robot, in Press

>> Outdoor Multi-robot Formation Control
 

– Period : July, 2011 ~
– Project of Agency for Defense Development(ADD), directed by Dr. Changhwan Kim, Korea Institute of Science and Technology(KIST)
– The goal of this project is first to control outdoor multi-robot with particular formations. Additionally, this control algorithm will be fused with other various applications such as surveillance, and invader searching.

 
– Application : Cooperative Control For Optimal Surveillance

YouTube 동영상

YouTube 동영상

 

>> Outdoor Localization with Optical Navigation Sensor, IMU and GPS 

Autonomous outdoor navigation algorithms are required in various military and industry fields. A stable and robust outdoor localization algorithm is critical to successful outdoor
navigation. However, unpredictable external effects and interruption of the GPS signal cause difficulties in outdoor localization. To address this issue, first we devised a new optical navigation
sensor that measures a mobile robot’s transverse distance without being subjected to external influence. Next, using the optical navigation sensor, a novel localization algorithm is established with Inertial-Measurement-Unit (IMU) and GPS. The algorithm is verified in an urban environment where the GPS signal is frequently interrupted and rough ground surfaces provide serious disturbances.

outdoor_mobile_robot outdoor_localization

– Related Papers:

Youngmok Yun, Jingfu Jin, Namhoon Kim, Jeongyeon Yoon, and Changhwan Kim, “Outdoor localization with optical navigation sensor, IMU and GPS,” Int. Conf. on Multisensor Fusion and Integration for Intelligent Systems (MFI), pp. 377-382. IEEE, 2012.

 

>> Mechatronic System Design and Control for Automobile System Validation 

– Period : April, 2008 ~ June, 2011

– Assistant Researcher, Renault-Samsung Motors Technical Center
– As a military service, for three years, I had worked at the Renault-Samsung Motors Technical Center. Main tasks were mechatronic system design and control for validation of automobile chassis system. Through these experience, I could learn about the practical design sense of mechanical and electronic system. Additionally, global cooperation with world-wide coworkers and participation to several huge-scale automobile projects were another pleasure. 

  
< Steering Performance Test Bench >
 
 

< Acc., Brake, Clutch Pedal & Parking Brake Durability Test Bench >


 >> Odometry Calibration of Mobile Robot using Home-positioning

– Period : 2007

– Advisor : Prof. Wankyun Chung, Robotics Lab., POSTECH
– The subject of  MS graduation thesis was “Odometry calibration of mobile robot using home-positioning.” Home-positioning frequently occurs due to the reason of recharge or initialization of mobile robot. What is even better is that its technique is maturely developed and already adopted in many commercial robots. My ideas was that home-positioning can be used as a powerful measurement of mobile robot, and this would lead high accuracy of odometry. You may see the detail idea at the below poster.

 

 

– Related Papers:

– Youngmok Yun, Byungjae Park, and Wan Kyun Chung, “Odometry Calibration using Home Positioning Function for Mobile Robot,” IEEE Int. Conf. on Robotics and Automation (ICRA), 2008.

– Sharifuddin Mondal, Youngmok Yun, and Wan Kyun Chung, “Terminal Iterative Learning Control for Calibrating Systematic Odometry Errors in Mobile Robots,” IEEE/ASME Int. Conf. on Advanced Intelligent Mechatronics (AIM), 2010.

– Youngmok Yun, Wan Kyun Chung, and Sang yep Nam, “Systematic Error Calibration of Mobile Robot using Home Positioning Function,” IEEE Int. Conf. on Ubiquitous Robots and Ambient Intelligence (URAI), 2008.

>> Development of Navigation and Human-robot Interaction Techniques 

– Period : 2006 ~ 2007
– Director : Prof. Wankyun Chung, Robotics Lab., POSTECH
– Project of Korean Ministry of Information and Communication
– Mobile robot team, Robotics Lab, POSTECH, developed autonomous mobile robot framework including SLAM, exploration, and path-planning. I took part in SLAM algorithm development and visual-feature recognition. 
 

SLAM movie clip, Robotics Lab, POSTECH

 
 

>> Tennis ball gathering robot using visual recognition

– Period : 2004 ~ 2005
– Graduation project, Mechanical Engineering Dept., POSTECH 
– Winner of the graduation project. 
– As a graduation project of ME, POSTECH, our team made tennis ball gathering robot using visual recognition. The task of the robot was to gather all tennis balls in a room. Frankly, now I can know that it was too difficult subject for undergraduate students to build all system and programs only within one year because there were too many things to do: mechanical design, electronic system organization, visual recognition programming, navigation algorithm programming and others. However, we devoted ourselves to the project, and finally, we won the competition of the project.