Skip to content

Commit b12e889

Browse files
committed
add moving fail state
1 parent 868745d commit b12e889

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

include/robotis_manipulator/robotis_manipulator.h

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class RobotisManipulator
4646

4747
bool trajectory_initialized_state_;
4848
bool moving_state_;
49+
bool moving_fail_flag_;
4950
bool step_moving_state_;
5051

5152
bool joint_actuator_added_stete_;
@@ -338,6 +339,8 @@ class RobotisManipulator
338339
std::vector<JointValue> getJointGoalValueFromTrajectoryTickTime(double tick_time);
339340

340341
void stopMoving();
342+
bool getMovingFailState();
343+
void resetMovingFailState();
341344
};
342345
} // namespace ROBOTIS_MANIPULATOR
343346

src/robotis_manipulator/robotis_manipulator.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ using namespace robotis_manipulator;
2727
RobotisManipulator::RobotisManipulator()
2828
{
2929
moving_state_ = false;
30+
moving_fail_flag_ = false;
3031
joint_actuator_added_stete_ = false;
3132
tool_actuator_added_stete_ = false;
3233
step_moving_state_ = false;
@@ -949,6 +950,7 @@ std::vector<JointValue> RobotisManipulator::receiveAllToolActuatorValue()
949950
void RobotisManipulator::startMoving() //Private
950951
{
951952
moving_state_ = true;
953+
moving_fail_flag_ = false;
952954
trajectory_.setStartTimeToPresentTime();
953955
}
954956

@@ -962,6 +964,16 @@ bool RobotisManipulator::getMovingState()
962964
return moving_state_;
963965
}
964966

967+
bool RobotisManipulator::getMovingFailState()
968+
{
969+
return moving_fail_flag_;
970+
}
971+
972+
void RobotisManipulator::resetMovingFailState()
973+
{
974+
moving_fail_flag_ = false;
975+
}
976+
965977

966978
/*****************************************************************************
967979
** Check Joint Limit Function
@@ -1392,6 +1404,7 @@ JointWaypoint RobotisManipulator::getTrajectoryJointValue(double tick_time, int
13921404
if(!checkJointLimit(trajectory_.getManipulator()->getAllActiveJointComponentName(), joint_way_point_value))
13931405
{
13941406
joint_way_point_value = trajectory_.removeWaypointDynamicData(trajectory_.getPresentJointWaypoint());
1407+
moving_fail_flag_ = true;
13951408
moving_state_ = false;
13961409
}
13971410
//set present joint task value to trajectory manipulator
@@ -1414,6 +1427,7 @@ JointWaypoint RobotisManipulator::getTrajectoryJointValue(double tick_time, int
14141427
{
14151428
joint_way_point_value = trajectory_.removeWaypointDynamicData(trajectory_.getPresentJointWaypoint());
14161429
task_way_point = trajectory_.removeWaypointDynamicData(trajectory_.getPresentTaskWaypoint(trajectory_.getPresentControlToolName()));
1430+
moving_fail_flag_ = true;
14171431
moving_state_ = false;
14181432
}
14191433
}
@@ -1422,6 +1436,7 @@ JointWaypoint RobotisManipulator::getTrajectoryJointValue(double tick_time, int
14221436
joint_way_point_value = trajectory_.removeWaypointDynamicData(trajectory_.getPresentJointWaypoint());
14231437
task_way_point = trajectory_.removeWaypointDynamicData(trajectory_.getPresentTaskWaypoint(trajectory_.getPresentControlToolName()));
14241438
log::error("[TASK_TRAJECTORY] fail to solve IK");
1439+
moving_fail_flag_ = true;
14251440
moving_state_ = false;
14261441
}
14271442
//set present joint task value to trajectory manipulator
@@ -1438,6 +1453,7 @@ JointWaypoint RobotisManipulator::getTrajectoryJointValue(double tick_time, int
14381453
if(!checkJointLimit(trajectory_.getManipulator()->getAllActiveJointComponentName(), joint_way_point_value))
14391454
{
14401455
joint_way_point_value = trajectory_.removeWaypointDynamicData(trajectory_.getPresentJointWaypoint());
1456+
moving_fail_flag_ = true;
14411457
moving_state_ = false;
14421458
}
14431459
//set present joint task value to trajectory manipulator
@@ -1457,6 +1473,7 @@ JointWaypoint RobotisManipulator::getTrajectoryJointValue(double tick_time, int
14571473
{
14581474
joint_way_point_value = trajectory_.removeWaypointDynamicData(trajectory_.getPresentJointWaypoint());
14591475
task_way_point = trajectory_.removeWaypointDynamicData(trajectory_.getPresentTaskWaypoint(trajectory_.getPresentControlToolName()));
1476+
moving_fail_flag_ = true;
14601477
moving_state_ = false;
14611478
}
14621479
}
@@ -1465,6 +1482,7 @@ JointWaypoint RobotisManipulator::getTrajectoryJointValue(double tick_time, int
14651482
joint_way_point_value = trajectory_.removeWaypointDynamicData(trajectory_.getPresentJointWaypoint());
14661483
task_way_point = trajectory_.removeWaypointDynamicData(trajectory_.getPresentTaskWaypoint(trajectory_.getPresentControlToolName()));
14671484
log::error("[CUSTOM_TASK_TRAJECTORY] fail to solve IK");
1485+
moving_fail_flag_ = true;
14681486
moving_state_ = false;
14691487
}
14701488
//set present joint task value to trajectory manipulator

0 commit comments

Comments
 (0)