单轴只会为您提供有关您所在的四象限世界的一半的信息。在图表中,X的负值将告诉您是否位于前2个象限之一(象限1(0-90) )或象限2(90-180)),如果是正的,则是底部两个中的一个(象限3(180-270)和象限4(270-360))。要区分世界的左半部分和右半部分,需要另一个正交的轴(Y或Z取决于设备的方向)。
这是我如何解决问题:
创建一个2位(4态)状态机,使用两个轴跟踪象限 - 使用每个的四个正负组合。然后将当前读数与之前的读数进行比较,并根据极性变化从一个状态(象限)更改为下一个状态 - 与读取正交轴编码器的方式大致相同。务必处理两个方向的过渡。
你可以将它扩展到所有三对或轴(X,Y),(X,Z)和(Y,Z),以分别跟踪俯仰,偏航和滚转的旋转。
以上来自于谷歌翻译
以下为原文
A single axis willl only give you information on which half of the 4-quadrant world you are in. In your diagram, a negative value of X will tell you if you are in one of the top 2 quadrants (quadrant 1 (0-90) or quadrant 2 (90-180)) or, if positive, one of the bottom two (quadrant 3 (180-270) and quadrant 4(270-360)). To distinguish between the left and right halves of the world, you need another axis in quadrature (Y or Z depending on the orientation of the device).
Here's how I would approach the problem:
Create a 2-bit (4-state) state machine that tracks the quadrants using two axis - using the four combinations of positive and negative for each. Then compare the current readings with the previous and change from one state (quadrant) to the next based on the polarity changes - much the same way you would read a quadrature shaft encoder. Be sure to handle transitions in both directions.
You could probably extend this to all three pairs or axes (X,Y), (X,Z), and (Y,Z) to separately track rotations in pitch, yaw, and roll.
单轴只会为您提供有关您所在的四象限世界的一半的信息。在图表中,X的负值将告诉您是否位于前2个象限之一(象限1(0-90) )或象限2(90-180)),如果是正的,则是底部两个中的一个(象限3(180-270)和象限4(270-360))。要区分世界的左半部分和右半部分,需要另一个正交的轴(Y或Z取决于设备的方向)。
这是我如何解决问题:
创建一个2位(4态)状态机,使用两个轴跟踪象限 - 使用每个的四个正负组合。然后将当前读数与之前的读数进行比较,并根据极性变化从一个状态(象限)更改为下一个状态 - 与读取正交轴编码器的方式大致相同。务必处理两个方向的过渡。
你可以将它扩展到所有三对或轴(X,Y),(X,Z)和(Y,Z),以分别跟踪俯仰,偏航和滚转的旋转。
以上来自于谷歌翻译
以下为原文
A single axis willl only give you information on which half of the 4-quadrant world you are in. In your diagram, a negative value of X will tell you if you are in one of the top 2 quadrants (quadrant 1 (0-90) or quadrant 2 (90-180)) or, if positive, one of the bottom two (quadrant 3 (180-270) and quadrant 4(270-360)). To distinguish between the left and right halves of the world, you need another axis in quadrature (Y or Z depending on the orientation of the device).
Here's how I would approach the problem:
Create a 2-bit (4-state) state machine that tracks the quadrants using two axis - using the four combinations of positive and negative for each. Then compare the current readings with the previous and change from one state (quadrant) to the next based on the polarity changes - much the same way you would read a quadrature shaft encoder. Be sure to handle transitions in both directions.
You could probably extend this to all three pairs or axes (X,Y), (X,Z), and (Y,Z) to separately track rotations in pitch, yaw, and roll.
举报