Correction de l'erreur d'angle initialisé.
This commit is contained in:
parent
ed0147a2e9
commit
237c9be64c
16
IO.hpp
16
IO.hpp
|
@ -152,19 +152,29 @@ class IO {
|
||||||
float getAngle(Axes axis)
|
float getAngle(Axes axis)
|
||||||
{
|
{
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
|
float angle;
|
||||||
|
|
||||||
m_code_cell->Motion_RotationRead(x, y, z);
|
m_code_cell->Motion_RotationRead(x, y, z);
|
||||||
|
|
||||||
switch(axis)
|
switch(axis)
|
||||||
{
|
{
|
||||||
case Axes::X:
|
case Axes::X:
|
||||||
return x - m_init_x;
|
angle = x - m_init_x;
|
||||||
|
if(angle < -180) angle += 360;
|
||||||
|
if(angle > 180) angle -= 360;
|
||||||
|
return angle;
|
||||||
|
|
||||||
case Axes::Y:
|
case Axes::Y:
|
||||||
return y - m_init_y;
|
angle = y - m_init_y;
|
||||||
|
if(angle < -180) angle += 360;
|
||||||
|
if(angle > 180) angle -= 360;
|
||||||
|
return angle;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return z - m_init_z;
|
angle = z - m_init_z;
|
||||||
|
if(angle < -180) angle += 360;
|
||||||
|
if(angle > 180) angle -= 360;
|
||||||
|
return angle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue