当前位置:网站首页>ROS Robot Learning -- kinematics solution of mcnamu wheel
ROS Robot Learning -- kinematics solution of mcnamu wheel
2022-04-22 13:02:00 【Fan Ziqi】
Kinematic solution of mcnamu wheel
One 、 Mcnamum round Introduction
Read about Robomaster All of my classmates know that ,RM The wheels used in the chariot are mcnamu wheels , This kind of wheel is installed in the same way as ordinary wheels , It can be installed on parallel shafts , But the mcnamu wheel can move in all directions , namely Back and forth movement 、 Move horizontally 、 Rotate around the center . Because of the above advantages , Many industrial omni-directional mobile platforms use this kind of wheel . There are also shortcomings , Just don't wear , It needs to be replaced regularly .
The mcnamu wheel consists of two parts : Wheel hub and Roller , The hub is the main body of the wheel , The roller is a small ellipsoid like wheel around the wheel hub , The hub and roller have their own shafts , And the included angle between the hub shaft and the roller shaft is 45°( Can be other angles, but 45° Horns are the most common )
The installation method of wheat wheel is also exquisite , Although they are all coaxial installation , But unlike ordinary wheels , The wheat wheel is divided into left-handed and right-handed , On a four-wheel chassis, you need to use two left-hand and two right-hand . The installation method is O type , As shown in the figure :

The picture on the left shows what you see after installation , The figure on the right shows the shape surrounded by rollers with four wheels in contact with the ground , That is to say “O shape ”
there O Shape refers to the shape surrounded by rollers in contact with the ground , Don't ask why the picture on the left looks like X 了
Two 、 Kinematic model of mcnamu wheel
1. Basic knowledge of
1.1 Coordinate system
stay ROS In the robot , The coordinate system is defined with the right hand
about ROS robot , If you take it as the origin of the coordinate system , that
- x Axis : In front of the
- y Axis : left side
- z Axis : upper
As shown in the figure :

besides , For rotational motion , Also use the right hand to define :
according to The right hand defines , around z The shaft is rotating yes Counter clockwise rotation
1.2 Unit of measurement
ROS Use metric :
- Linear velocity :
m/s - angular velocity :
rad/s
1.3 Wheel serial number definition
Left front 1 Right front 2
Back left 3 Right rear 4
2. Inverse kinematics analysis
Inverse kinematics model (inverse kinematic model) The obtained formula can calculate the speed of four wheels according to the motion state of the chassis .
2.1 Decomposition of chassis motion
The motion of a rigid body in a plane can be decomposed into three independent components :X Shaft translation 、Y Shaft translation 、yaw Shaft rotation . The motion of the chassis can also be divided into three quantities :
As shown in the figure below :

- v t x v_{tx} vtx Express X The speed at which the axis moves , That is, the front and rear direction , Define forward as positive ;
- v t y v_{ty} vty Express Y The speed at which the axis moves , Right and left , Define left as positive ;
- ω → \overrightarrow{\omega} ω Express yaw Angular velocity of shaft rotation , Define counterclockwise as positive .
2.2 Calculate the speed of the wheel axis position
As shown in the figure below , Take the right front wheel as an example , The blue box represents the wheel , Define the following variables :
- r → \overrightarrow{r} r Is the vector from the center of the chassis to the axis of the wheel ;
- v → \overrightarrow{v} v Is the velocity vector of the wheel axis ;
- v r → \overrightarrow{v_r} vr The axis of the wheel is perpendicular to r → \overrightarrow{r} r The direction of ( The tangent direction ) The velocity component of ;
You can calculate that :
KaTeX parse error: No such environment: align* at position 8: \begin{̲a̲l̲i̲g̲n̲*̲}̲ \overrightarro…
take r → \overrightarrow{r} r Decompose into r x r_x rx and r y r_y ry, Calculate the wheel axis at X、Y The velocity component of the shaft :
{ v x = v t x + ω ⋅ r y v y = v t y + ω ⋅ r x \left\{\begin{matrix} v_x=v_{tx}+\omega\cdot{r_y} \\ v_y=v_{ty}+\omega\cdot{r_x} \end{matrix}\right. { vx=vtx+ω⋅ryvy=vty+ω⋅rx
The other three wheels are the same
2.3 Calculate the roller speed in contact with the ground
from 2.2 Calculated wheel axis speed , It can be decomposed into... Along the roller axis v ∥ → \overrightarrow{v_\parallel} v∥ And perpendicular to the roller axis v ⊥ → \overrightarrow{v_\perp} v⊥ , As shown in the figure
among v ⊥ → \overrightarrow{v_\perp} v⊥ For idling the roller , You can ignore
Define a unit vector in the direction of the roller e ^ \hat{e} e^, For the right front wheel , e ^ = 1 2 ⋅ i ^ + 1 2 ⋅ j ^ \hat{e}=\frac{1}{\sqrt{2}}\cdot\hat{i}+\frac{1}{\sqrt{2}}\cdot\hat{j} e^=21⋅i^+21⋅j^
Then the velocity along the axis is v → \overrightarrow{v} v stay e ^ \hat{e} e^ Projection of direction :
KaTeX parse error: No such environment: align* at position 8: \begin{̲a̲l̲i̲g̲n̲*̲}̲ \overrightarr…
2.4 Calculate the speed of the wheel ( The linear velocity at the point of contact with the ground )
As shown in the figure , The wheel speed is v w v_w vw
Because the roller and the axle are 45° horn , be v ω v_\omega vω Obtainable :
KaTeX parse error: No such environment: align* at position 8: \begin{̲a̲l̲i̲g̲n̲*̲}̲ v_w&=\frac{v_…
take 2.2 Found { v x = v t x + ω ⋅ r y v y = v t y + ω ⋅ r x \left\{\begin{matrix} v_x=v_{tx}+\omega\cdot{r_y} \\ v_y=v_{ty}+\omega\cdot{r_x} \end{matrix}\right. {
vx=vtx+ω⋅ryvy=vty+ω⋅rx Bring it up , The rotational speed of this wheel can be calculated :
v w = v t x + v t y + ω ( r x + r y ) v_w=v_{tx}+v_{ty}+\omega(r_x+r_y) vw=vtx+vty+ω(rx+ry)
Combine the above four steps , The rotational speed of the four wheels can be calculated according to the motion state of the chassis :
{ v w 1 = v t x − v t y − ω ( r x + r y ) v w 2 = v t x + v t y + ω ( r x + r y ) v w 3 = v t x + v t y − ω ( r x + r y ) v w 4 = v t x − v t y + ω ( r x + r y ) \left\{\begin{matrix} v_{w1}=v_{tx}-v_{ty}-\omega(r_x+r_y)\\ v_{w2}=v_{tx}+v_{ty}+\omega(r_x+r_y)\\ v_{w3}=v_{tx}+v_{ty}-\omega(r_x+r_y)\\ v_{w4}=v_{tx}-v_{ty}+\omega(r_x+r_y) \end{matrix}\right. ⎩⎪⎪⎨⎪⎪⎧vw1=vtx−vty−ω(rx+ry)vw2=vtx+vty+ω(rx+ry)vw3=vtx+vty−ω(rx+ry)vw4=vtx−vty+ω(rx+ry)
The above equations are O Inverse kinematics model of V-shaped wheat wheel chassis .
2.5 Code implementation
// Parameter macro definition
#define ENCODER_RESOLUTION 1440.0 // Encoder resolution , The wheel goes round , The number of pulses generated by the encoder
#define WHEEL_DIAMETER 0.058 // Wheel diameter , Company : rice
#define D_X 0.18 // chassis Y The distance between the centers of the two wheels on the shaft
#define D_Y 0.25 // chassis X The distance between the centers of the two wheels on the shaft
#define PID_RATE 50 //PID Adjust the PWM The frequency of the value
double pulse_per_meter = 0;
float rx_plus_ry_cali = 0.3;
double angular_correction_factor = 1.0;
double linear_correction_factor = 1.0;
double angular_correction_factor = 1.0;
/** * @ Function function : Kinematics analysis parameter initialization */
void Kinematics_Init(void)
{
// The wheel goes round , The moving distance is the circumference of the wheel WHEEL_DIAMETER*3.1415926, The pulse signal generated by the encoder is ENCODER_RESOLUTION. Then the pulse signal generated by the motor encoder rotating for one turn can be divided by the circumference of the wheel to get the wheel forward 1m The distance corresponding to the change of encoder count
pulse_per_meter = (float)(ENCODER_RESOLUTION/(WHEEL_DIAMETER*3.1415926))/linear_correction_factor;
float r_x = D_X/2;
float r_y = D_Y/2;
rx_plus_ry_cali = (r_x + r_y)/angular_correction_factor;
}
/** * @ Function function : Inverse kinematics analysis , Chassis three-axis speed --> Wheel speed * @ Input : Robot three-axis speed m/s * @ Output : The target speed that the motor should reach ( One PID During the control cycle , Change of motor encoder count value ) */
void Kinematics_Inverse(int16_t* input, int16_t* output)
{
float v_tx = (float)input[0];
float v_ty = (float)input[1];
float omega = (float)input[2];
static float v_w[4] = {
0};
v_w[0] = v_tx - v_ty - (r_x + r_y)*omega;
v_w[1] = v_tx + v_ty + (r_x + r_y)*omega;
v_w[2] = v_tx + v_ty - (r_x + r_y)*omega;
v_w[3] = v_tx - v_ty + (r_x + r_y)*omega;
// Calculate a PID During the control cycle , Change of motor encoder count value
output[0] = (int16_t)(v_w[0] * pulse_per_meter/PID_RATE);
output[1] = (int16_t)(v_w[1] * pulse_per_meter/PID_RATE);
output[2] = (int16_t)(v_w[2] * pulse_per_meter/PID_RATE);
output[3] = (int16_t)(v_w[3] * pulse_per_meter/PID_RATE);
}
3. Forward kinematics analysis
3.1 Forward kinematics model
Forward kinematics model (forward kinematic model) Let's go through the speed of four wheels , Calculate the motion state of the chassis . It can be solved directly according to the three equations in the inverse kinematics model , such as :
{ v t x = v 4 + v 3 2 v t y = v 3 − v 1 2 ω = v 2 − v 3 2 ( r x + r y ) \left\{\begin{matrix} v_{tx}=\frac{v_4+v_3}{2}\\ v_{ty}=\frac{v_3-v_1}{2}\\ \omega=\frac{v_2-v_3}{2(r_x+r_y)} \end{matrix}\right. ⎩⎨⎧vtx=2v4+v3vty=2v3−v1ω=2(rx+ry)v2−v3
The change of odometer is calculated by integrating the time in the chassis coordinate system
3.2 Code implementation
// Parameter macro definition
#define ENCODER_MAX 32767
#define ENCODER_MIN -32768
#define ENCODER_LOW_WRAP ((ENCODER_MAX - ENCODER_MIN)*0.3+ENCODER_MIN)
#define ENCODER_HIGH_WRAP ((ENCODER_MAX - ENCODER_MIN)*0.7+ENCODER_MIN)
#define PI 3.1415926
// Variable definitions
int32_t wheel_turns[4] = {
0};
int32_t encoder_sum_current[4] = {
0};
/** * @ The functionality : Forward kinematics analysis , Wheel code value -> Chassis three-axis odometer coordinates * @ Input : Encoder accumulation value * @ Output : Three axis odometer x y yaw */
void Kinematics_Forward(int16_t* input, int16_t* output)
{
static double dv_w_times_dt[4]; // Instantaneous variation of wheel dxw=dvw*dt
static double dv_t_times_dt[3]; // Instantaneous change of chassis dxt=dvt*dt
static int16_t encoder_sum[4];
// Multiply the accumulated value of the left wheel encoder by -1, To calculate the distance forward
encoder_sum[0] = -input[0];
encoder_sum[1] = input[1];
encoder_sum[2] = -input[2];
encoder_sum[3] = input[3];
// Encoder count overflow processing
for(int i=0;i<4;i++)
{
if(encoder_sum[i] < ENCODER_LOW_WRAP && encoder_sum_current[i] > ENCODER_HIGH_WRAP)
wheel_turns[i]++;
else if(encoder_sum[i] > ENCODER_HIGH_WRAP && encoder_sum_current[i] < ENCODER_LOW_WRAP)
wheel_turns[i]--;
else
wheel_turns[i]=0;
}
// Convert the encoder value to the forward distance , Company m
for(int i=0;i<4;i++)
{
dv_w_times_dt[i] = 1.0*(encoder_sum[i] + wheel_turns[i]*(ENCODER_MAX-ENCODER_MIN)-encoder_sum_current[i])/pulse_per_meter;
encoder_sum_current[i] = encoder_sum[i];
}
// To calculate the coordinates, so change back
dv_w_times_dt[0] = -dv_w_times_dt[0];
dv_w_times_dt[1] = dv_w_times_dt[1];
dv_w_times_dt[2] = -dv_w_times_dt[2];
dv_w_times_dt[3] = dv_w_times_dt[3];
// Calculate the chassis coordinate system (base_link) Next x Axis 、y Axis change distance m And Yaw Axis orientation changes rad The amount of change over time
dv_t_times_dt[0] = ( dv_w_times_dt[3] + dv_w_times_dt[2])/2.0;
dv_t_times_dt[1] = ( dv_w_times_dt[2] - dv_w_times_dt[0])/2.0;
dv_t_times_dt[2] = ( dv_w_times_dt[1] - dv_w_times_dt[2])/(2*wheel_track_cali);
// Integral calculation odometer coordinate system (odom_frame) The robot under X,Y,Yaw Axis coordinates
//dx = ( vx*cos(theta) - vy*sin(theta) )*dt
//dy = ( vx*sin(theta) + vy*cos(theta) )*dt
output[0] += (int16_t)(cos((double)output[2])*dv_t_times_dt[0] - sin((double)output[2])*dv_t_times_dt[1]);
output[1] += (int16_t)(sin((double)output[2])*dv_t_times_dt[0] + cos((double)output[2])*dv_t_times_dt[1]);
output[2] += (int16_t)(dv_t_times_dt[2]*1000);
//Yaw Axis coordinate change range control -2Π -> 2Π
if(output[2] > PI)
output[2] -= 2*PI;
else if(output[2] < -PI)
output[2] += 2*PI;
// Send the robot X Axis y Axis Yaw Instantaneous variation of shaft , stay ROS End divided by time
output[3] = (int16_t)(dv_t_times_dt[0]);
output[4] = (int16_t)(dv_t_times_dt[1]);
output[5] = (int16_t)(dv_t_times_dt[2]);
}
reference :
【1】https://zhuanlan.zhihu.com/p/20282234
【2】https://blog.csdn.net/shixiaolu63/article/details/78496457
版权声明
本文为[Fan Ziqi]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221300407976.html
边栏推荐
- C#窗体的淡入淡出功能(项目工程源码)
- 11. 盛最多水的容器
- 机器学习7-逻辑斯蒂回归实现西瓜数据集2.0的二分类
- 启牛app证券账户合法吗,新手在这里开户安不安全
- Excel string splicing
- Machine learning 7- logistic regression to realize the binary classification of watermelon dataset 2.0
- ROS2——什么是接口
- Leetcode 389. Find different
- C#自定义Button实现源码
- R language uses rnbinom function to generate random numbers conforming to negative binomial distribution, and uses plot function to visualize random numbers conforming to negative binomial distributio
猜你喜欢

Leetcode 695. Maximum area of the island

17. 电话号码的字母组合

详解为什么OpenCV的直方图计算函数calcHist()计算出的灰度值为255的像素个数为0

柔性印刷电路板(PCB)的设计方法、类型等详细解析

Verify whether the form is empty

mysql数据库已经成功启动,可是show不是内部或外部命令,该如何解决呢?

OpenCV函数line()的参数pt1和pt2的类型要求

How to batch delete worksheets in Excel

Example accumulation of two-dimensional line drawing function plot () in MATLAB

Redis local connection to view data
随机推荐
Leetcode 206, reverse linked list
Let cpolar get a fixed TCP address
R language multiple decision curve analysis DCA (decision curve analysis) curve visualization in the same image, using PNG function to save the DCA visualization results of decision curve analysis in
JS foundation 14
How to realize the conversion between array and list?
New ideas for smart home (2022)
数商云家电商城系统解决方案,优化电器商城采购供应链管理,减低库存提升资金利用率
Graph search of obstacles in far planner
NoSQL survey Part3: open source failure
利用OpenCV的函数threshold()对图像作基于OTSU的阈值化处理---并附比较好的介绍OTSU原理的博文链接
Redis本地连接查看数据
从构建到治理,业内首本微服务治理技术白皮书正式发布(含免费下载链接)
Explain in detail why the number of pixels with a gray value of 255 calculated by the opencv histogram calculation function calchist() is 0
What happens when the weight of the model and loss or intermediate variable become Nan
396. 旋轉函數
Leetcode 617. Merge binary tree
我们需要什么样的数据库产品
Excel表格中如何批量删除工作表
树莓派压缩备份
R language uses the scale function to standardize and scale dataframe data (set the scale parameter, divide the scale parameter setting by the standard deviation)