11#include <armarx/view_selection/skills/aron/LookAtArticulatedObjectFrame.aron.generated.h>
18 ::armarx::skills::SkillDescription
23 defaults.objectToSearch.dataset =
"Kitchen-interior";
24 defaults.objectToSearch.className =
"fridge";
25 defaults.objectToSearch.instanceName =
"0";
27 defaults.locationsToScan = {
"FridgeDoorShelf_node"};
29 defaults.durationPerLocationSeconds = 10;
31 defaults.objectToSearchFor.dataset =
"Kitchen-interior";
32 defaults.objectToSearchFor.className =
"bio-milk";
33 defaults.objectToSearchFor.instanceName =
"0";
35 defaults.matchInstanceName =
false;
37 return ::armarx::skills::SkillDescription{
39 .description =
"Scan locations of an articulated object looking for another object.",
40 .rootProfileDefaults = defaults.toAron(),
42 .parametersType = ParamType::ToAronType(),
63 properties(properties)
75 ARMARX_INFO <<
"Scanning " << in.parameters.objectToSearch.dataset <<
"/"
76 << in.parameters.objectToSearch.className <<
"/"
77 << in.parameters.objectToSearch.instanceName <<
". Looking for "
79 for (
const auto& location : in.parameters.locationsToScan)
85 armarx::view_selection::skills::arondto::LookAtArticulatedObjectFrameParams;
90 [&](Parameters& params)
92 params.object = in.parameters.objectToSearch;
93 params.node = location;
94 params.objectPoseProvider = std::nullopt;
95 params.durationSeconds =
96 in.parameters.durationPerLocationSeconds;
97 params.priority = 100;
117 const auto object = [&]() -> std::optional<objpose::ObjectPose>
119 if (in.parameters.matchInstanceName)
126 for (
const auto& [_, obj] :
130 if (obj.timestamp > skillStartTime)
138 if (
object.has_value() && object->timestamp > skillStartTime)
141 ARMARX_INFO <<
"Object " <<
object->objectID <<
" found at "
142 <<
object->timestamp;
145 metronome.waitForNextTick();
static Duration Minutes(std::int64_t minutes)
Constructs a duration in minutes.
static Duration Seconds(std::int64_t seconds)
Constructs a duration in seconds.
static Frequency Hertz(std::int64_t hertz)
A known object ID of the form "Dataset/ClassName" or "Dataset/ClassName/InstanceName".
std::optional< objpose::ObjectPose > queryLatestObjectInstance(const ObjectID &instanceId)
std::map< std::string, objpose::ObjectPose > queryLatestObjectInstances(const ObjectID &classId)
Represents a point in time.
Simple rate limiter for use in loops to maintain a certain frequency given a clock.
arondto::ScanLocationsForObjectParams ParamType
std::optional< TerminatedSkillStatusUpdate > callSubskill(const SkillID &skillId)
Call a subskill with the given ID and its default parameters.
static MainResult MakeSucceededResult(aron::data::DictPtr data=nullptr)
virtual MainResult main()
Override this method with the actual implementation.
void throwIfSkillShouldTerminate(const std::string &abortedMessage="") const
static MainResult MakeFailedResult(aron::data::DictPtr data=nullptr)
::armarx::skills::SkillDescription GetSkillDescription()
ScanLocationsForObject(const Services &services, const Properties &properties)
#define ARMARX_INFO
The normal logging level.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
#define ARMARX_VERBOSE
The logging level for verbose information.
bool skillExecutionFailed(const std::optional< armarx::skills::TerminatedSkillStatusUpdate > &update)
This file is part of ArmarX.
const armarx::skills::SkillID ScanLocationsForObject
This file is part of ArmarX.
This file offers overloads of toIce() and fromIce() functions for STL container types.
void fromAron(const arondto::PackagePath &dto, PackageFileLocation &bo)
This file is part of ArmarX.
This file is part of ArmarX.
A result struct for th main method of a skill.
armarx::skills::SkillID lookAtArticulatedObjectFrame
armarx::armem::obj::instance::Reader objectReader