Skip to content

Commit 0beacf4

Browse files
authored
Merge pull request #1042 from YoheiKakiuchi/fix_less_than_one_sec
Fix less than one sec
2 parents 6caec6b + 18829d3 commit 0beacf4

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

hrpsys_ros_bridge/src/HrpsysJointTrajectoryBridge.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ void HrpsysJointTrajectoryBridge::jointTrajectoryActionObj::onJointTrajectory(
472472
else
473473
{ // if i == 0
474474
duration[i] = trajectory.points[i].time_from_start.toSec();
475-
if ( abs(duration[i]) < 0.001 ) duration[i] = 0.001; // set magic delta ... https://github.com/start-jsk/rtmros_common/issues/1036
475+
if ( std::abs(duration[i]) < 0.001 ) duration[i] = 0.001; // set magic delta ... https://github.com/start-jsk/rtmros_common/issues/1036
476476
}
477477
}
478478

hrpsys_ros_bridge/src/HrpsysSeqStateROSBridge.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ void HrpsysSeqStateROSBridge::onJointTrajectory(trajectory_msgs::JointTrajectory
206206
duration[i] = trajectory.points[i].time_from_start.toSec() - trajectory.points[i-1].time_from_start.toSec();
207207
} else { // if i == 0
208208
duration[i] = trajectory.points[i].time_from_start.toSec();
209-
if ( abs(duration[i]) < 0.001 ) duration[i] = 0.001; // set delta ... https://github.com/start-jsk/rtmros_common/issues/1036
209+
if ( std::abs(duration[i]) < 0.001 ) duration[i] = 0.001; // set delta ... https://github.com/start-jsk/rtmros_common/issues/1036
210210
}
211211
}
212212

hrpsys_ros_bridge/test/test-samplerobot.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,19 @@ def impl_test_joint_angles(self, larm, goal):
118118
rospy.logwarn("difference between two /LARM_LINK7 %r %r"%(array(trans1)-array(trans2),linalg.norm(array(trans1)-array(trans2))))
119119
self.assertNotAlmostEqual(linalg.norm(array(trans1)-array(trans2)), 0, delta=0.1)
120120

121+
## move less than 1.0 sec
122+
goal.trajectory.header.stamp = rospy.get_rostime()
123+
point = JointTrajectoryPoint()
124+
point.positions = [ x * math.pi / 180.0 for x in [30,30,30, 0,-40,-30] ]
125+
point.time_from_start = rospy.Duration(0.9)
126+
goal.trajectory.points = [point]
127+
larm.send_goal(goal)
128+
start_time = rospy.get_rostime()
129+
larm.wait_for_result()
130+
stop_time = rospy.get_rostime()
131+
rospy.logwarn("working time: %f"%(stop_time - start_time).to_sec())
132+
self.assertNotAlmostEqual((stop_time - start_time).to_sec(), 0, delta=0.1)
133+
121134
# send joint angles
122135
def test_joint_angles(self):
123136
# for < kinetic

0 commit comments

Comments
 (0)