Skip to content
Snippets Groups Projects
Commit 0e3fbd84 authored by Fabian Reister's avatar Fabian Reister Committed by Fabian Reister
Browse files

fixing build

parent 40d10ea4
Branches skills/dev
No related tags found
No related merge requests found
......@@ -39,13 +39,13 @@ namespace armarx::control::skills::skills
if (not virtualRobot)
{
ARMARX_ERROR << "Could not get robot '" << remote.robotName << "'";
return {::armarx::skills::TerminatedSkillStatus::Failed};
return MakeFailedResult();
}
// check jointsTargetValues are valid (joints exist, target values are within limits)
if (not checkJointsTargetValuesValid(in.parameters.jointsTargetValues, virtualRobot))
{
return {::armarx::skills::TerminatedSkillStatus::Failed};
return MakeFailedResult();
}
// request joints
......@@ -54,11 +54,11 @@ namespace armarx::control::skills::skills
{
remote.kinematicUnit->requestJoints(jointNames);
}
catch (armarx::KinematicUnitUnavailable e)
catch (const armarx::KinematicUnitUnavailable& e)
{
ARMARX_IMPORTANT << "Failed to request joints. Terminating. Joints unavailable:"
<< e.nodeOwners;
return {::armarx::skills::TerminatedSkillStatus::Failed};
return MakeFailedResult();
}
// move joints
......@@ -82,7 +82,7 @@ namespace armarx::control::skills::skills
in.parameters.accuracyOverride,
virtualRobot);
}
return {::armarx::skills::TerminatedSkillStatus::Succeeded};
return MakeSucceededResult();
}
bool
......@@ -132,12 +132,14 @@ namespace armarx::control::skills::skills
ARMARX_INFO << "Waiting until target values are reached";
const Clock clock;
const Duration sleepTime = Duration::MilliSeconds(20);
const Duration sleepTime = Duration::MilliSeconds(50);
auto do_if_terminate_and_not_reached = [&]()
{
ARMARX_INFO << "Skill got aborted, stopping movement";
syncVirtualRobot(virtualRobot);
ARMARX_CHECK(
remote.virtualRobotReader.synchronizeRobot(*virtualRobot, armarx::DateTime::Now()))
<< "Robot state synchronization failed";
// stop movement
switchControlMode(jointsTargetValues, eVelocityControl);
......@@ -158,7 +160,9 @@ namespace armarx::control::skills::skills
while (not reached)
{
throwIfSkillShouldTerminate(do_if_terminate_and_not_reached);
syncVirtualRobot(virtualRobot);
ARMARX_CHECK(
remote.virtualRobotReader.synchronizeRobot(*virtualRobot, armarx::DateTime::Now()))
<< "Robot state synchronization failed";
reached = true;
for (const auto& [jointName, targetValue] : jointsTargetValues)
......@@ -187,7 +191,9 @@ namespace armarx::control::skills::skills
const NameValueMap& speedOverride,
const VirtualRobot::RobotPtr& virtualRobot)
{
syncVirtualRobot(virtualRobot);
ARMARX_CHECK(
remote.virtualRobotReader.synchronizeRobot(*virtualRobot, armarx::DateTime::Now()))
<< "Robot state synchronization failed";
//build trajectory
armarx::trajectory::Trajectory trajectory;
......@@ -235,12 +241,4 @@ namespace armarx::control::skills::skills
ARMARX_INFO << "Target values reached";
}
void
MoveJoints::syncVirtualRobot(const VirtualRobot::RobotPtr& virtualRobot)
{
ARMARX_CHECK(
remote.virtualRobotReader.synchronizeRobot(*virtualRobot, armarx::DateTime::Now()))
<< "Robot state synchronization failed";
}
} // namespace armarx::control::skills::skills
......@@ -32,11 +32,12 @@ namespace armarx::control::skills::skills
static ::armarx::skills::SkillDescription
GetSkillDescription()
{
return {armarx::skills::SkillID("MoveJoints"),
"Moves joints to specified target values using the KinematicUnit",
nullptr,
::armarx::Duration::Minutes(1),
ParamType::ToAronType()};
return ::armarx::skills::SkillDescription{
.skillId = {.skillName = "MoveJoints"},
.description = "Moves joints to specified target values using the KinematicUnit",
.rootProfileDefaults = nullptr,
.timeout = ::armarx::Duration::Minutes(1),
.parametersType = ParamType::ToAronType()};
}
MoveJoints(const Remote&);
......@@ -62,8 +63,6 @@ namespace armarx::control::skills::skills
const NameValueMap& speedOverride,
const VirtualRobot::RobotPtr& virtualRobot);
void syncVirtualRobot(const VirtualRobot::RobotPtr& virtualRobot);
private:
Remote remote;
};
......
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