I am sharing a Matlab code to get a vertex angle from three points.
This is the code, and you can download this one from here <Download>
function [ang] = get_vertex_ang_from_three_points(p0,p1,p2)
% get the vertex angle at p0 from three points p0,p1,p2 % p0, p1,p2 are two dim vector % %%% example % p0=[0;0];p1=[1;0];p2=[0;1]; % get_vertex_ang_from_three_points(p0,p1,p2) % answer = 1.57 (45 deg) %%%
v1 = p1-p0; v2 = p2-p0; ang = acos(v1′v2/(norm(v1)norm(v2)));
It is very easy to use. you can get the vertex angle from three points, It is written in Matlab code
In this post, I will explain how to derive a dynamic equation with Lagrange Equation by MATLAB with Examples. As an example, I will derive a dynamic model of a three-DOF arm manipulator (or triple pendulum). Of course you may get a dynamic model for a two-DOF arm manipulator by simply removing several lines. I am attaching demo codes for both two and three DOF arm manipulators.
If you know all theories and necessary skills and if you just want source code, you can just download from here.
In the attached file, “Symb_Development_3DOF.m” generates a dynamic model. “main_sim_three_dof_arm.m” runs a simulation. You may get a result like this.
1. Example system
Let’s suppose a three DOF arm manipulator shown in the below figure. I am assuming all of masses (M1, M2, M3) exist at the end of links for simplicity. Three actuators exist at each joint, and directly actuate the torques (u1,u2,u3). The manipulator kinematics is governed by three joint angles (q1, q2, q3).
three DOF arm manipulator
2. Theoretical Background
We will get a dynamic equation of this system by using Lagrangian mechanics. If you do not have a background knowledge of Lagrangian mechanics, please refer here.
The general dynamic equation is obtained by
Where, T is the total kinetic energy, V is the total potential energy of the system. where is the generalized force, t is time, is the generalized coordinates, is the generalized velocity. For the example of three-DOF arm manipulator problem, is the torque at the j-th joint, is the angle of the j-th joint, is the angular velocity of the j-th joint.
3. Using Matlab symbolic toolbox
First, let’s define the symbols.
I am using x to represent q, xd for , xdd for L is the length of each link. u is the torque of each joint. g is the gravity constant.
In the attached file, “Symb_Development_3DOF.m” generates a dynamic model. “main_sim_three_dof_arm.m” runs a simulation. Then, you can get this result.
So far, I have explained how to derive a Lagrange Equation by MATLAB with Examples.I hope that this post helps your project and save your time. Please leave a message if you have any question.
Update on 02/21/2016
I updated some code and posting about typo. “simple” -> “simplify” There is no function “simple” Now all programs are running well.
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.
>> 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.
– 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.
>> 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
– 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.
Statistical Method for Prediction of Human Walking Pattern with Gaussian Process Regression
We propose a novel methodology for predicting human gait pattern kinematics based on a statistical and stochastic approach using a method called Gaussian process regression (GPR). We selected 14 body parameters that significantly affect the gait pattern and 14 joint motions that represent gait kinematics. The body parameter and gait kinematics data were recorded from 113 subjects by anthropometric measurements and a motion capture system. We generated a regression model with GPR for gait pattern prediction and built a stochastic function mapping from body parameters to gait kinematics based on the database and GPR, and validated the model with a cross validation method. The function can not only produce trajectories for the joint motions associated with gait kinematics, but can also estimate the associated uncertainties. Our approach results in a novel, low-cost and subject-specific method for predicting gait kinematics with only the subject’s body parameters as the necessary input, and also enables a comprehensive understanding of the correlation and uncertainty between body parameters and gait kinematics.
In this post, I share a numerical Jacobian matrix calculation method with matlab code.
Actually there is a function in Matlab inherently, but it is very complex. ( look at the function, NumJac ), So I made a very simple version. I wish this can help you.
Today I’d like to introduce a parallel computation skill in Matlab.
I also heard that the use of parallel computation in Matlab is very easy. But it was better than my expectation. Wonderful!!
You need to know the usage of SPMD. It is pretty easy.
First let’s the code, you can also download this file in the attachment, click <here>.
The result is the below
Starting matlabpool using the ‘local’ configuration … connected to 4 labs. Elapsed time is 120.482356 seconds. Sending a stop signal to all the labs … stopped. Elapsed time is 167.796932 seconds.
Because, I did many other works in the calculation time, Its result is not very fast, The slowest CPU core determined the final computation time. But its performance is really good if you have more than 4 multi cpu cores.
I wish this post can help your understanding about the use of SPMD in Matlab.
if you have any question, please leave me a comment below.
—————————————————————————————————
I am Youngmok Yun, and writing about robotics theories and my research.