reverted modif on z when honolonomic but added modif on yaw depending on the estimated y value

This commit is contained in:
matlabbe
2015-06-16 10:50:49 -04:00
parent 7cd0d0cd53
commit 6a7a9fb9b0
4 changed files with 42 additions and 30 deletions

View File

@@ -322,7 +322,7 @@ class RTABMAP_EXP Parameters
RTABMAP_PARAM(Odom, ResetCountdown, int, 0, "Automatically reset odometry after X consecutive images on which odometry cannot be computed (value=0 disables auto-reset).");
RTABMAP_PARAM_STR(Odom, RoiRatios, "0.0 0.0 0.0 0.0", "Region of interest ratios [left, right, top, bottom].");
RTABMAP_PARAM(Odom, Force2D, bool, false, "Force 2D transform (3Dof: x,y and yaw).");
RTABMAP_PARAM(Odom, Holonomic, bool, true, "If the robot is holonomic (strafing and up/down commands can be issued). If not, y/z values will be estimated from x and rotation values (y=x*tan(yaw), z=x*tan(pitch)).");
RTABMAP_PARAM(Odom, Holonomic, bool, true, "If the robot is holonomic (strafing commands can be issued). If not, y value will be estimated from x and yaw values (y=x*tan(yaw)).");
RTABMAP_PARAM(Odom, FillInfoData, bool, true, "Fill info with data (inliers/outliers features).");
RTABMAP_PARAM(Odom, ImageBufferSize, unsigned int, 1, "Data buffer size (0 min inf).");
RTABMAP_PARAM(Odom, PnPEstimation, bool, false, "(PnP) Pose estimation from 2D to 3D correspondences instead of 3D to 3D correspondences.");

View File

@@ -213,28 +213,27 @@ Transform Odometry::process(const SensorData & data, OdometryInfo * info)
else
{
x = filters_[0]->filter(x);
y = filters_[1]->filter(y);
yaw = filters_[5]->filter(yaw);
if(_holonomic)
if(!_holonomic)
{
y = filters_[1]->filter(y);
}
else
{
y = x * tan(yaw);
float tmpY = x * tan(yaw);
if(fabs(tmpY) < fabs(y) || (tmpY<=0 && y >=0) || (tmpY>=0 && y<=0))
{
y = tmpY;
}
else
{
yaw = atan(y/x);
}
}
if(!_force2D)
{
z = filters_[2]->filter(z);
roll = filters_[3]->filter(roll);
pitch = filters_[4]->filter(pitch);
if(_holonomic)
{
z = filters_[2]->filter(z);
}
else
{
z = x * tan(pitch);
}
}
}
@@ -245,10 +244,14 @@ Transform Odometry::process(const SensorData & data, OdometryInfo * info)
}
else if(!_holonomic)
{
y = x * tan(yaw);
if(!_force2D)
float tmpY = x * tan(yaw);
if(fabs(tmpY) < fabs(y) || (tmpY<=0 && y >=0) || (tmpY>=0 && y<=0))
{
z = x * tan(pitch);
y = tmpY;
}
else
{
yaw = atan(y/x);
}
}
UASSERT_MSG(uIsFinite(x) && uIsFinite(y) && uIsFinite(z) &&