Set max value for translate
This commit is contained in:
@@ -78,8 +78,13 @@ class AxidrawController : public RobotController
|
|||||||
{
|
{
|
||||||
float lspan = lmax - lmin;
|
float lspan = lmax - lmin;
|
||||||
float rspan = rmax - rmin;
|
float rspan = rmax - rmin;
|
||||||
val = (val - lmin) / lspan;
|
float out = (val - lmin) / lspan;
|
||||||
return rmin + (val * rspan);
|
out = rmin + (val * rspan);
|
||||||
|
|
||||||
|
// Ensure that output is within bounds
|
||||||
|
out = std::max(rmin, out);
|
||||||
|
out = std::min(rmax, out);
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user