mirror of
https://github.com/introlab/rtabmap.git
synced 2026-10-03 16:47:47 +08:00
Added marker range support
This commit is contained in:
@@ -920,14 +920,14 @@ class RTABMAP_CORE_EXPORT Parameters
|
||||
RTABMAP_PARAM(Marker, Strategy, int, 0, "Marker detection implementation: 0=OpenCV, 1=AprilTag");
|
||||
RTABMAP_PARAM(Marker, Dictionary, int, 0, "Dictionary to use: DICT_ARUCO_4X4_50=0, DICT_ARUCO_4X4_100=1, DICT_ARUCO_4X4_250=2, DICT_ARUCO_4X4_1000=3, DICT_ARUCO_5X5_50=4, DICT_ARUCO_5X5_100=5, DICT_ARUCO_5X5_250=6, DICT_ARUCO_5X5_1000=7, DICT_ARUCO_6X6_50=8, DICT_ARUCO_6X6_100=9, DICT_ARUCO_6X6_250=10, DICT_ARUCO_6X6_1000=11, DICT_ARUCO_7X7_50=12, DICT_ARUCO_7X7_100=13, DICT_ARUCO_7X7_250=14, DICT_ARUCO_7X7_1000=15, DICT_ARUCO_ORIGINAL = 16, DICT_APRILTAG_16h5=17, DICT_APRILTAG_25h9=18, DICT_APRILTAG_36h10=19, DICT_APRILTAG_36h11=20, DICT_ARUCO_MIP_36H12=21");
|
||||
RTABMAP_PARAM(Marker, Length, float, 0, "The length (m) of the markers' side. Value <=0 means automatic marker length estimation using the depth image (the camera should look at the marker perpendicularly for initialization). If 0, the length is estimated only on the first marker detected, then re-used for all next detections (i.e., this assumes that markers have all the same length). With <0, the length is estimated once for each unique marker, then re-used for next detections with the same marker ID.");
|
||||
RTABMAP_PARAM_STR(Marker, Lengths, "", uFormat("List of markers to detect. Format is the marker's ID followed by its length (in meters), markers are separated by a vertical line (\"id1 length|id2 length\"). If empty, all markers of the chosen dictionary can be detected and their length is set/estimated based on %s. For example, to detect only markers 12 and 14 with lengths of 8 and 15 cm respectively, set \"12 0.08|14 0.15\".", kMarkerDictionary().c_str()).c_str());
|
||||
RTABMAP_PARAM_STR(Marker, Lengths, "", uFormat("List of markers to detect. Format is the marker's ID followed by its length (in meters), multiple markers are separated by a vertical line (\"id1 length|id2 length\"). We can also define a range of markers with \"id1:id2 length\" (id2 included). If empty, all markers of the chosen dictionary can be detected and their length is set/estimated based on %s. For example, to detect markers 12 and 14 with lengths of 8 and 15 cm respectively, and all markers between 30 and 40 with a length of 10 cm, set \"12 0.08|14 0.15|30:40 0.1\".", kMarkerDictionary().c_str()).c_str());
|
||||
RTABMAP_PARAM(Marker, MaxDepthError, float, 0.01, uFormat("Maximum depth error between all corners of a marker when estimating the marker length (when %s is 0). The smaller it is, the more perpendicular the camera should be toward the marker to initialize the length.", kMarkerLength().c_str()));
|
||||
RTABMAP_PARAM(Marker, VarianceLinear, float, 0.001, uFormat("Linear variance to set on marker detections. If %s is enabled and %s=2 (GTSAM): it is the variance of the range factor, with 9999 to disable range factor and to do only bearing.", kMarkerVarianceOrientationIgnored().c_str(), kOptimizerStrategy().c_str()));
|
||||
RTABMAP_PARAM(Marker, VarianceAngular, float, 0.01, uFormat("Angular variance to set on marker detections. If %s is enabled, it is ignored with %s=1 (g2o) and it corresponds to bearing variance with %s=2 (GTSAM).", kMarkerVarianceOrientationIgnored().c_str(), kOptimizerStrategy().c_str(), kOptimizerStrategy().c_str()));
|
||||
RTABMAP_PARAM(Marker, VarianceOrientationIgnored, bool, false, uFormat("When this setting is false, the landmark's orientation is optimized during graph optimization. When this setting is true, only the position of the landmark is optimized. This can be useful when the landmark's orientation estimation is not reliable. Note that for %s=1 (g2o), only %s needs be set if we ignore orientation. For %s=2 (GTSAM), instead of optimizing the landmark's position directly, a bearing/range factor is used, with %s as the variance of the range factor (with 9999 to optimize the position with only a bearing factor) and %s as the variance of the bearing factor (pitch/yaw).", kOptimizerStrategy().c_str(), kMarkerVarianceLinear().c_str(), kOptimizerStrategy().c_str(), kMarkerVarianceLinear().c_str(), kMarkerVarianceAngular().c_str()));
|
||||
RTABMAP_PARAM(Marker, MaxRange, float, 0.0, "Maximum range in which markers will be detected. <=0 for unlimited range.");
|
||||
RTABMAP_PARAM(Marker, MinRange, float, 0.0, "Miniminum range in which markers will be detected. <=0 for unlimited range.");
|
||||
RTABMAP_PARAM_STR(Marker, Priors, "", "World prior locations of the markers. The map will be transformed in marker's world frame when a tag is detected. Format is the marker's ID followed by its position (angles in rad), markers are separated by vertical line (\"id1 x y z roll pitch yaw|id2 x y z roll pitch yaw\"). Example: \"1 0 0 1 0 0 0|2 1 0 1 0 0 1.57\" (marker 2 is 1 meter forward than marker 1 with 90 deg yaw rotation).");
|
||||
RTABMAP_PARAM_STR(Marker, Priors, "", "World prior locations of the markers. The map will be transformed in marker's world frame when a tag is detected. Format is the marker's ID followed by its position (angles in rad), multiple markers are separated by vertical line (\"id1 x y z roll pitch yaw|id2 x y z roll pitch yaw\"). Example: \"1 0 0 1 0 0 0|2 1 0 1 0 0 1.57\" (marker 2 is 1 meter forward than marker 1 with 90 deg yaw rotation).");
|
||||
RTABMAP_PARAM(Marker, PriorsVarianceLinear, float, 0.001, "Linear variance to set on marker priors.");
|
||||
RTABMAP_PARAM(Marker, PriorsVarianceAngular, float, 0.001, "Angular variance to set on marker priors.");
|
||||
|
||||
|
||||
@@ -266,10 +266,46 @@ void MarkerDetector::parseParameters(const ParametersMap & parameters)
|
||||
}
|
||||
else
|
||||
{
|
||||
int id = uStr2Int(items.front());
|
||||
float length = uStr2Float(items.back());
|
||||
UDEBUG("Adding marker %d with length %f", id, length);
|
||||
markerLengths_.insert(std::make_pair(id, length));
|
||||
if(uStrContains(items.front(), ":"))
|
||||
{
|
||||
std::list<std::string> range = uSplit(items.front(), ':');
|
||||
if(range.size() != 2)
|
||||
{
|
||||
UERROR("Invalid string format \"%s\" for parameter %s, make "
|
||||
"sure the values are separated by single space and/or '|'. See "
|
||||
"description of the parameter for example. That parameter "
|
||||
"will be ignored.",
|
||||
strLengths.c_str(),
|
||||
Parameters::kMarkerLengths().c_str());
|
||||
markerLengths_.clear();
|
||||
break;
|
||||
}
|
||||
int id1 = uStr2Int(range.front());
|
||||
int id2 = uStr2Int(range.back());
|
||||
UDEBUG("Adding a range of markers %d -> %d with length %f", id1, id2, length);
|
||||
for(int id=id1; id<=id2; ++id)
|
||||
{
|
||||
auto inserted = markerLengths_.insert(std::make_pair(id, length));
|
||||
if(!inserted.second)
|
||||
{
|
||||
UWARN("Marker %d is already configured with length %f, not overwriting", inserted.first->first, inserted.first->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
int id = uStr2Int(items.front());
|
||||
auto inserted = markerLengths_.insert(std::make_pair(id, length));
|
||||
if(!inserted.second)
|
||||
{
|
||||
UWARN("Marker %d is already configured with length %f, overwriting with %f", inserted.first->first, inserted.first->second, length);
|
||||
inserted.first->second = length;
|
||||
}
|
||||
else
|
||||
{
|
||||
UDEBUG("Added marker %d with length %f", id, length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -342,7 +378,7 @@ void MarkerDetector::parseParameters(const ParametersMap & parameters)
|
||||
{
|
||||
#ifdef RTABMAP_APRILTAG
|
||||
UERROR("RTAB-Map is not built with opencv-aruco library! Fallback to AprilTag strategy (%s=1).", Parameters::kMarkerStrategy().c_str());
|
||||
strategy_ = 1;
|
||||
strategy_ = kStrategyApriltag;
|
||||
#else
|
||||
UERROR("RTAB-Map is not built with opencv-aruco library!");
|
||||
#endif
|
||||
@@ -407,7 +443,7 @@ void MarkerDetector::parseParameters(const ParametersMap & parameters)
|
||||
{
|
||||
#ifdef HAVE_OPENCV_ARUCO
|
||||
UERROR("RTAB-Map is not built with apriltag library! Fallback to OpenCV (%s=0).", Parameters::kMarkerStrategy().c_str());
|
||||
strategy_ = 0;
|
||||
strategy_ = kStrategyOpencv;
|
||||
#else
|
||||
UERROR("RTAB-Map is not built with apriltag library!");
|
||||
#endif
|
||||
|
||||
@@ -15556,6 +15556,10 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QDoubleSpinBox" name="MarkerLength">
|
||||
<property name="toolTip">
|
||||
<string>If 0, the length is estimated only on the first marker detected, then re-used for all next detections (i.e., this assumes that markers have all the same length).
|
||||
With <0, the length is estimated once for each unique marker, then re-used for next detections with the same marker ID.</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> m</string>
|
||||
</property>
|
||||
@@ -15576,7 +15580,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
<item row="11" column="1">
|
||||
<widget class="QLabel" name="label_space2_15">
|
||||
<property name="text">
|
||||
<string>World prior locations of the markers. The map will be transformed in marker's world frame when a tag is detected. Format is the marker's ID followed by its position (angles in rad), markers are separated by a vertical line ("id1 x y z roll pitch yaw|id2 x y z roll pitch yaw"). Example: "1 0 0 1 0 0 0|2 1 0 1 0 0 1.57" (marker 2 is 1 meter forward than marker 1 with 90 deg yaw rotation).</string>
|
||||
<string>World prior locations of the markers. The map will be transformed in marker's world frame when a tag is detected. Format is the marker's ID followed by its position (angles in rad), multiple markers are separated by a vertical line ("id1 x y z roll pitch yaw|id2 x y z roll pitch yaw"). Example: "1 0 0 1 0 0 0|2 1 0 1 0 0 1.57" (marker 2 is 1 meter forward than marker 1 with 90 deg yaw rotation).</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
@@ -15624,7 +15628,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_space2_7">
|
||||
<property name="text">
|
||||
<string>Marker length. The length (m) of the markers' side. Value <=0 means automatic marker length estimation using the depth image (the camera should look at the marker perpendicularly for initialization). If 0, the length is estimated only on the first marker detected, then re-used for all next detections (i.e., this assumes that markers have all the same length). With <0, the length is estimated once for each unique marker, then re-used for next detections with the same marker ID.</string>
|
||||
<string>Marker length. The length (m) of the markers' side. Value &lt;=0 means automatic marker length estimation using the depth image (the camera should look at the marker perpendicularly for initialization). Mouse over the spinbox to see the difference between negative and 0.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
@@ -15996,6 +16000,9 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLineEdit" name="MarkerLengths">
|
||||
<property name="toolTip">
|
||||
<string>For example, to detect markers 12 and 14 with lengths of 8 and 15 cm respectively, and all markers between 30 and 40 with a length of 10 cm, set "12 0.08|14 0.15|30:40 0.1"</string>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string/>
|
||||
</property>
|
||||
@@ -16004,7 +16011,7 @@ If set to false, classic RTAB-Map loop closure detection is done using only imag
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="label_space2_25">
|
||||
<property name="text">
|
||||
<string>List of markers to detect. Format is the marker's ID followed by its length (in meters), markers are separated by a vertical line ("id1 length|id2 length"). If empty, all markers of the chosen dictionary can be detected and their length is set/estimated based on Marker Length. For example, to detect only markers 12 and 14 with lengths of 8 and 15 cm respectively, set "12 0.08|14 0.15".</string>
|
||||
<string>List of markers to detect. Format is the marker's ID followed by its length (in meters), markers are separated by a vertical line ("id1 length|id2 length"). We can also define a range of markers with "id1:id2 length" (id2 included). If empty, all markers of the chosen dictionary can be detected and their length is set/estimated based on Marker Length. Mouse over text box for example.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
||||
Reference in New Issue
Block a user