Skip to content
Snippets Groups Projects
Commit bc2aad20 authored by Philip Scherer's avatar Philip Scherer
Browse files

Add time offset and window params to ObjMem Visu

parent 5104c3b5
No related branches found
No related tags found
1 merge request!242Add Prediction Interface and linear position prediction model to Object Memory
......@@ -49,8 +49,12 @@ namespace armarx::armem::server::obj::instance
defs->optional(useArticulatedModels, prefix + "useArticulatedModels",
"Prefer articulated object models if available.");
defs->optional(showLinearPredictions, prefix + "showLinearPredictions",
defs->optional(showLinearPredictions, prefix + "predictions.linear.show",
"Show arrows linearly predicting object positions.");
defs->optional(linearPredictionTimeOffsetSeconds, prefix + "predictions.linear.timeOffset",
"The offset (in seconds) to the current time to make predictions for.");
defs->optional(linearPredictionTimeWindowSeconds, prefix + "predictions.linear.timeWindow",
"The time window (in seconds) into the past to perform the regression on.");
}
......@@ -247,9 +251,9 @@ namespace armarx::armem::server::obj::instance
objpose::ObjectPosePredictionRequest request;
toIce(request.objectID, id);
request.settings.predictionEngineID = "Linear Position Regression";
toIce(request.timeWindow, Duration::Seconds(2));
// TODO(phesch): Make parametrizable.
toIce(request.timestamp, Time::Now() + Duration::MilliSeconds(1000));
toIce(request.timeWindow, Duration::SecondsDouble(linearPredictionTimeWindowSeconds));
toIce(request.timestamp,
Time::Now() + Duration::SecondsDouble(linearPredictionTimeOffsetSeconds));
auto predictionResult = predictor(request);
if (predictionResult.success)
{
......@@ -302,6 +306,9 @@ namespace armarx::armem::server::obj::instance
useArticulatedModels.setValue(visu.useArticulatedModels);
showLinearPredictions.setValue(visu.showLinearPredictions);
linearPredictionTimeOffsetSeconds.setValue(visu.linearPredictionTimeOffsetSeconds);
linearPredictionTimeWindowSeconds.setValue(visu.linearPredictionTimeWindowSeconds);
linearPredictionTimeWindowSeconds.setRange(0, std::numeric_limits<float>::max());
GridLayout grid;
int row = 0;
......@@ -330,6 +337,12 @@ namespace armarx::armem::server::obj::instance
grid.add(Label("Show Linear Predictions"), {row, 0}).add(showLinearPredictions, {row, 1});
row++;
grid.add(Label("Time (seconds from now):"), {row, 0})
.add(linearPredictionTimeOffsetSeconds, {row, 1});
row++;
grid.add(Label("Time Window (seconds):"), {row, 0})
.add(linearPredictionTimeWindowSeconds, {row, 1});
row++;
group = GroupBox();
group.setLabel("Visualization");
......@@ -380,6 +393,8 @@ namespace armarx::armem::server::obj::instance
visu.useArticulatedModels = useArticulatedModels.getValue();
visu.showLinearPredictions = showLinearPredictions.getValue();
visu.linearPredictionTimeOffsetSeconds = linearPredictionTimeOffsetSeconds.getValue();
visu.linearPredictionTimeWindowSeconds = linearPredictionTimeWindowSeconds.getValue();
}
}
......@@ -87,8 +87,10 @@ namespace armarx::armem::server::obj::instance
/// Prefer articulated models if available.
bool useArticulatedModels = true;
/// Show linear prediction arrows for object positions.
/// Linear prediction arrows for object positions.
bool showLinearPredictions = false;
float linearPredictionTimeOffsetSeconds = 1;
float linearPredictionTimeWindowSeconds = 2;
SimpleRunningTask<>::pointer_type updateTask;
......@@ -128,6 +130,9 @@ namespace armarx::armem::server::obj::instance
armarx::RemoteGui::Client::CheckBox showLinearPredictions;
armarx::RemoteGui::Client::FloatSpinBox linearPredictionTimeOffsetSeconds;
armarx::RemoteGui::Client::FloatSpinBox linearPredictionTimeWindowSeconds;
void setup(const Visu& visu);
void update(Visu& visu);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment