Skip to content

Commit

Permalink
Merge pull request start-jsk#1042 from YoheiKakiuchi/fix_less_than_on…
Browse files Browse the repository at this point in the history
…e_sec

Fix less than one sec
  • Loading branch information
k-okada authored May 14, 2018
2 parents 6caec6b + 18829d3 commit 0beacf4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hrpsys_ros_bridge/src/HrpsysJointTrajectoryBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ void HrpsysJointTrajectoryBridge::jointTrajectoryActionObj::onJointTrajectory(
else
{ // if i == 0
duration[i] = trajectory.points[i].time_from_start.toSec();
if ( abs(duration[i]) < 0.001 ) duration[i] = 0.001; // set magic delta ... https://github.com/start-jsk/rtmros_common/issues/1036
if ( std::abs(duration[i]) < 0.001 ) duration[i] = 0.001; // set magic delta ... https://github.com/start-jsk/rtmros_common/issues/1036
}
}

Expand Down
2 changes: 1 addition & 1 deletion hrpsys_ros_bridge/src/HrpsysSeqStateROSBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void HrpsysSeqStateROSBridge::onJointTrajectory(trajectory_msgs::JointTrajectory
duration[i] = trajectory.points[i].time_from_start.toSec() - trajectory.points[i-1].time_from_start.toSec();
} else { // if i == 0
duration[i] = trajectory.points[i].time_from_start.toSec();
if ( abs(duration[i]) < 0.001 ) duration[i] = 0.001; // set delta ... https://github.com/start-jsk/rtmros_common/issues/1036
if ( std::abs(duration[i]) < 0.001 ) duration[i] = 0.001; // set delta ... https://github.com/start-jsk/rtmros_common/issues/1036
}
}

Expand Down
13 changes: 13 additions & 0 deletions hrpsys_ros_bridge/test/test-samplerobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,19 @@ def impl_test_joint_angles(self, larm, goal):
rospy.logwarn("difference between two /LARM_LINK7 %r %r"%(array(trans1)-array(trans2),linalg.norm(array(trans1)-array(trans2))))
self.assertNotAlmostEqual(linalg.norm(array(trans1)-array(trans2)), 0, delta=0.1)

## move less than 1.0 sec
goal.trajectory.header.stamp = rospy.get_rostime()
point = JointTrajectoryPoint()
point.positions = [ x * math.pi / 180.0 for x in [30,30,30, 0,-40,-30] ]
point.time_from_start = rospy.Duration(0.9)
goal.trajectory.points = [point]
larm.send_goal(goal)
start_time = rospy.get_rostime()
larm.wait_for_result()
stop_time = rospy.get_rostime()
rospy.logwarn("working time: %f"%(stop_time - start_time).to_sec())
self.assertNotAlmostEqual((stop_time - start_time).to_sec(), 0, delta=0.1)

# send joint angles
def test_joint_angles(self):
# for < kinetic
Expand Down

0 comments on commit 0beacf4

Please sign in to comment.