Skip to content

Commit

Permalink
Forces the action to wait for half of the duration of the trajectory
Browse files Browse the repository at this point in the history
before it begins to check for completition. This prevents the action
for returning immediately for trajectories that end near the start
point and are slow to start moving.
  • Loading branch information
Jonathan Meyer authored and shaun-edwards committed Sep 28, 2015
1 parent a7c0a52 commit cbdf113
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ class JointTrajectoryAction
*/
industrial_msgs::RobotStatusConstPtr last_robot_status_;

/**
* \brief Time at which to start checking for completion of current
* goal, if one is active
*/
ros::Time time_to_check_;

/**
* \brief The watchdog period (seconds)
*/
Expand Down
8 changes: 8 additions & 0 deletions industrial_robot_client/src/joint_trajectory_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ void JointTrajectoryAction::goalCB(JointTractoryActionServer::GoalHandle & gh)
gh.setAccepted();
active_goal_ = gh;
has_active_goal_ = true;
time_to_check_ = ros::Time::now() +
ros::Duration(active_goal_.getGoal()->trajectory.points.back().time_from_start.toSec() / 2.0);

ROS_INFO("Publishing trajectory");

Expand Down Expand Up @@ -225,6 +227,12 @@ void JointTrajectoryAction::controllerStateCB(const control_msgs::FollowJointTra
return;
}

if (ros::Time::now() < time_to_check_)
{
ROS_DEBUG("Waiting to check for goal completion until halfway through trajectory");
return;
}

// Checking for goal constraints
// Checks that we have ended inside the goal constraints and has motion stopped

Expand Down

0 comments on commit cbdf113

Please sign in to comment.