Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add external axes support #88

Merged
merged 7 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/abb_libegm/egm_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace egm
*/
enum RobotAxes
{
None = 0, ///< \brief No robot axes are expected (i.e. only external axes).
Six = 6, ///< \brief A six axes robot.
Seven = 7 ///< \brief A seven axes robot.
};
Expand Down
16 changes: 15 additions & 1 deletion src/egm_base_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ void EGMBaseInterface::OutputContainer::constructReply(const BaseConfiguration&
constructHeader();
bool success = constructJointBody(configuration);

if (success)
if (success && configuration.axes != None)
{
success = constructCartesianBody(configuration);
}
Expand Down Expand Up @@ -515,6 +515,20 @@ bool EGMBaseInterface::OutputContainer::constructJointBody(const BaseConfigurati

switch (configuration.axes)
{
case None:
{
if (robot_position.values_size() == 0)
{
for (int i = 0; i < external_position.values_size() && i < ext_condition; ++i)
{
planned->mutable_externaljoints()->add_joints(external_position.values(i));
}

position_ok = true;
}
}
break;

case Six:
{
if (robot_position.values_size() == rob_condition)
Expand Down
32 changes: 30 additions & 2 deletions src/egm_common_auxiliary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,20 @@ bool parse(wrapper::Joints* p_target_robot,

switch (axes)
{
case None:
{
if (source_robot.joints_size() == 0)
{
for (int i = 0; i < source_external.joints_size(); ++i)
{
p_target_external->add_values(source_external.joints(i));
}

success = true;
}
}
break;

case Six:
{
if (source_robot.joints_size() == Constants::RobotController::DEFAULT_NUMBER_OF_ROBOT_JOINTS)
Expand Down Expand Up @@ -842,7 +856,14 @@ bool parse(wrapper::Feedback* p_target, const EgmFeedBack& source, const RobotAx

if (success)
{
success = parse(p_target->mutable_robot()->mutable_cartesian()->mutable_pose(), source.cartesian());
if(axes == None)
{
success = !source.has_cartesian();
}
else
{
success = parse(p_target->mutable_robot()->mutable_cartesian()->mutable_pose(), source.cartesian());
}

if (success)
{
Expand All @@ -866,7 +887,14 @@ bool parse(wrapper::Planned* p_target, const EgmPlanned& source, const RobotAxes

if (success)
{
success = parse(p_target->mutable_robot()->mutable_cartesian()->mutable_pose(), source.cartesian());
if(axes == None)
{
success = !source.has_cartesian();
}
else
{
success = parse(p_target->mutable_robot()->mutable_cartesian()->mutable_pose(), source.cartesian());
}

if (success)
{
Expand Down
6 changes: 3 additions & 3 deletions src/egm_trajectory_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ wrapper::trajectory::ExecutionProgress_SubState EGMTrajectoryInterface::Trajecto
void EGMTrajectoryInterface::TrajectoryMotion::MotionStep::resetMotionStep()
{
unsigned int robot_joints = data.feedback.robot().joints().position().values_size();
unsigned int external_joints = data.feedback.robot().joints().position().values_size();
unsigned int external_joints = data.feedback.external().joints().position().values_size();

internal_goal.Clear();
external_goal.Clear();
Expand Down Expand Up @@ -243,7 +243,7 @@ void EGMTrajectoryInterface::TrajectoryMotion::MotionStep::resetMotionStep()
void EGMTrajectoryInterface::TrajectoryMotion::MotionStep::prepareNormalGoal(const bool last_point)
{
unsigned int robot_joints = data.feedback.robot().joints().position().values_size();
unsigned int external_joints = data.feedback.robot().joints().position().values_size();
unsigned int external_joints = data.feedback.external().joints().position().values_size();

data.mode = (external_goal.robot().has_cartesian() ? EGMPose : EGMJoint);

Expand Down Expand Up @@ -394,7 +394,7 @@ double EGMTrajectoryInterface::TrajectoryMotion::MotionStep::estimateDuration()
double estimate = 0.0;

unsigned int robot_joints = data.feedback.robot().joints().position().values_size();
unsigned int external_joints = data.feedback.robot().joints().position().values_size();
unsigned int external_joints = data.feedback.external().joints().position().values_size();

// Reset robot joint values.
reset(internal_goal.mutable_robot()->mutable_joints()->mutable_velocity(), robot_joints);
Expand Down