考虑差速驱动里程计中车轮的不对中
我有一个差速驱动机器人,使用里程计来推断其位置。
我正在使用标准方程:
WheelBase = 35.5cm;
WheelRadius = 5cm;
WheelCircumference = (WheelRadius * 2 * Math.PI);
WheelCircumferencePerEncoderClick = WheelCircumference / 360;
DistanceLeft = WheelCircumferencePerEncoderClick * EncoderCountLeft
DistanceRight = WheelCircumferencePerEncoderClick * EncoderCountRight
DistanceTravelled = (DistanceRight + DistanceLeft) / 2
AngleChange (Theta) = (DistanceRight - DistanceLeft) / WheelBase
我的(DIY)底盘有一个小特点,在轴距(35.5厘米)的过程中,车轮未对准,因为左轮为6.39毫米(我是一个软件)人不是硬件人!)比右轮更“向前”。 (轮子是机器人的中间。)
我不确定如何计算我必须在公式中添加什么才能给我正确的值。它不会对机器人产生太大影响,除非它当场转动,我的价值观相差甚远,我认为这是造成这种情况的原因。
我的第一个想法是在网格上绘制车轮位置,并计算其位置线的斜率,然后用它来乘以......某物。
我走在正确的轨道上吗?有人可以帮忙吗?我环顾四周是否有这个错误,大多数人似乎都忽略了它(因为他们使用的是专业机箱)。
I have a differential drive robot, using odometery to infer its position.
I am using the standard equations:
WheelBase = 35.5cm;
WheelRadius = 5cm;
WheelCircumference = (WheelRadius * 2 * Math.PI);
WheelCircumferencePerEncoderClick = WheelCircumference / 360;
DistanceLeft = WheelCircumferencePerEncoderClick * EncoderCountLeft
DistanceRight = WheelCircumferencePerEncoderClick * EncoderCountRight
DistanceTravelled = (DistanceRight + DistanceLeft) / 2
AngleChange (Theta) = (DistanceRight - DistanceLeft) / WheelBase
My (DIY) chassis has as a slight feature, where over the course of the wheel base (35.5cm), the wheels are misaligned, in that the left wheel is 6.39mm (I'm a software person not a hardware person!) more 'forwards' than the right wheel. (The wheels are the middle of the robot.)
I'm unsure how to calculate what I must add to my formulas to give me the correct values.. It doesn't affect the robot much, unless it does on the spot turns, and my values are way off, I think this is causing it.
My first thought was to plot the wheel locations on a grid, and calculate the slope of the line of their positions, and use that to multiply... something.
Am I on the right track? Can someone lend a hand? I've looked around for this error, and most people seem to ignore it (since they are using professional chassis).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
必须对AngleChanged 的公式进行修正,如下:
取L 和R 分别为左轮和右轮在一刻内行驶的距离。
让 B 表示标称轴距的长度(而不是倾斜轴距的长度)。
设E代表左轮误差。即左轮相对理想位置向前偏移的距离。
我们寻求找到 θ,即一次轴距角度的变化。
首先,(预)计算倾斜轴距与理想轴距之间的角度:
使用一些基本几何(如果您愿意,我可以发布详细信息),我们可以计算 θ 如下:
可见,当 E=0 时,这会简化为之前的实现,并且具有直观可理解的结果,因为 E -> 。 +inf.,我们的公式似乎是正确的。
注意:
您可能希望在计算 σ (sigma) 时消除计算上难看的反正切值。在这些情况下,通常的做法是(事实上,您在之前的公式中使用过它)对于较小的 x 使用近似值 arctan(x) = x。
这里的问题是,虽然数量 (LR)/B 可能非常小,但误差相加 E/B 可能会变得大得令人无法接受。您可以尝试通过去掉反正切并使用 sigma = (E+LR)/B 来计算西格玛,但如果您想要更好的近似值,您应该使用 arctan(a+x) 大约 0 的一阶泰勒级数:
arctan(a+x) = arctan(a) + x/(1 + a^2)
应用于 sigma 的计算,近似值现在如下所示:
请注意,arctan(E / B) 已预先计算为 φ。这是 sigma 的一个更好的近似值,它应该可以产生更精确的 theta 计算。
The correction must be made to the formula for AngleChanged, as follows:
Take L and R to be the distances traveled by the left and right wheels, respectively, in one tick.
Let B denote the length of the nominal wheelbase (not the length of your skewed one).
Let E represent the left wheel error. That is, the distance the left wheel is offset forward from its ideal position.
We seek to find θ, the change in the angle of the wheelbase in one tick.
First, (pre)-calculate the angle between the skewed wheelbase and the ideal wheelbase:
Using some elementary geometry (I can post details if you desire), we may calculate theta as follows:
Seeing as this reduces to your previous implementation when E=0, and has intuitively understandable results as E -> +inf., our formula seems correct.
NOTE:
You probably want to do away with that computationally ugly arctangent in your calculation of σ (sigma). In situations as these, it's common practice (indeed, you used it in your previous formulas) to use the approximation arctan(x) = x, for small x.
The problem here is that while the quantity (L-R)/B is likely to be quite small, the error addition E/B may grow unacceptably large. You can try calculating sigma by just doing away with the arctan and using sigma = (E+L-R)/B, but if you want a better approximation you should use the first-order taylor series for arctan(a+x) around 0:
arctan(a+x) = arctan(a) + x/(1 + a^2)
Applied to the calculation of sigma, the approximation now looks such:
Notice that the arctan(E / B) has already been precalculated as φ. This is a much better approximation for sigma, which should yield more exact calculations for theta.
如果我没看错的话,问题是因为左轮在右轮前面,当它们以不同的速率转动时,它们无法在不打滑的情况下滚动。转动速率的差异越大,问题就越严重,这可能就是为什么当旋转相反时,它会在“在一角钱上转动”时出现。
我认为解决它的方法是考虑一个相关的问题:两个轮子位置正确,但都稍微向左倾斜(这正是您所处的情况,将轮子之间的对角线视为“轴距” )。然后,运动可以分为两个分量,主要的前后分量,其正常作用,以及次要的侧向分量,其不引起角度变化并且仅取决于车轮旋转的总和。
我会看看我是否能想出一些有意义的数学......
If I'm reading this right, the problem is that because the left wheel is ahead of the right, when they turn at different rates they cannot roll without slipping. The greater the difference in turning rates, the worse the problem gets, which is probably why it shows up while "turning on a dime", when the rotations are opposed.
I think the way to solve it is to consider a related problem: two wheels located correctly, but both skewed a little to the left (which is exactly the situation you're in, thinking of the diagonal between the wheels as the "wheelbase"). The motion can then be broken into two components, the major forward-back component, which acts normally, and the minor sideways component which causes no angle change and depends only on the sum of the wheel rotations.
I'll see if I can come up with some math that makes sense...