Skip to content
Snippets Groups Projects
Commit 8e20fa59 authored by Jean Patrick Mathes's avatar Jean Patrick Mathes
Browse files

Set the scaling factor from a property

parent 3f1be062
No related branches found
No related tags found
No related merge requests found
......@@ -9,10 +9,10 @@
namespace armarx
{
Editor::Editor(viz::Client& client,
std::string const& providerName,
Properties properties,
std::function<void(objpose::ProvidedObjectPoseSeq &)> pushToMemory,
std::function<objpose::ObjectPoseSeq(void)> pullFromMemory)
: providerName(providerName)
: properties(std::move(properties))
, client(client)
, pushToMemory(std::move(pushToMemory))
, pullFromMemory(std::move(pullFromMemory))
......@@ -106,7 +106,7 @@ namespace armarx
}
objpose::ProvidedObjectPose& providing = providingPoses.emplace_back();
providing.providerName = providerName;
providing.providerName = properties.providerName;
providing.objectType = objpose::KnownObject;
providing.objectID = current.objectID;
......@@ -158,12 +158,10 @@ namespace armarx
interaction.contextMenu(description.options);
}
const float scale = 1.01F;
viz::Object object =
viz::Object(objectPose.objectID.str())
.pose(description.transform * objectPose.objectPoseGlobal)
.scale(scale)
.scale(properties.objectScaling)
.fileByObjectFinder(objectPose.objectID)
.enable(interaction);
......
......@@ -14,8 +14,14 @@ namespace armarx
class Editor
{
public:
struct Properties
{
std::string providerName;
float const& objectScaling;
};
explicit Editor(viz::Client& client,
std::string const& providerName,
Properties properties,
std::function<void(objpose::ProvidedObjectPoseSeq&)> pushToMemory,
std::function<objpose::ObjectPoseSeq(void)> pullFromMemory);
void step();
......@@ -24,7 +30,7 @@ namespace armarx
static constexpr const char* memoryLayerName = "Memory";
static constexpr const char* metaLayerName = "Meta";
std::string const& providerName;
Properties properties;
viz::Client& client;
const std::function<void(objpose::ProvidedObjectPoseSeq&)> pushToMemory;
......
......@@ -4,7 +4,6 @@
#include <RobotAPI/libraries/ArmarXObjects/ice_conversions.h>
#include <RobotAPI/libraries/ArmarXObjects/ProvidedObjectPose.h>
#include <RobotAPI/libraries/core/FramedPose.h>
#include "Editor.h"
......@@ -14,6 +13,9 @@ namespace armarx
{
armarx::PropertyDefinitionsPtr defs = new ComponentPropertyDefinitions(getConfigIdentifier());
defs->optional(this->objectScaling, "Editor.ObjectScaling",
"Scaling factor that is applied to all intractable objects.");
return defs;
}
......@@ -56,11 +58,14 @@ namespace armarx
void InteractiveMemoryEditor::run()
{
CycleUtil cycle(50);
const int64_t cycleDurationMs = 50;
CycleUtil cycle(cycleDurationMs);
objpose::ObjectPoseClient client = getClient();
Editor editor(arviz, getName(),
Editor::Properties properties = { .providerName = getName(), .objectScaling = objectScaling };
Editor editor(arviz, properties,
[&](objpose::ProvidedObjectPoseSeq &poses)
{
objectPoseTopic->reportObjectPoses(getName(), objpose::toIce(poses));
......@@ -78,13 +83,13 @@ namespace armarx
}
}
objpose::ProviderInfo InteractiveMemoryEditor::getProviderInfo(const Ice::Current &)
objpose::ProviderInfo InteractiveMemoryEditor::getProviderInfo(const Ice::Current & /*unused*/)
{
return providerInfo;
}
objpose::provider::RequestObjectsOutput InteractiveMemoryEditor::requestObjects(
const objpose::provider::RequestObjectsInput &input, const Ice::Current &)
const objpose::provider::RequestObjectsInput &input, const Ice::Current & /*unused*/)
{
objpose::provider::RequestObjectsOutput output;
......
......@@ -40,6 +40,8 @@ namespace armarx
armarx::ObjectFinder objectFinder;
objpose::ProviderInfo providerInfo;
float objectScaling = 1.01F;
armarx::SimpleRunningTask<>::pointer_type objectVizTask;
};
} // namespace armarx
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