25 #include "../../include/robotis_manipulator/robotis_manipulator.h" 50 Eigen::Vector3d world_position,
51 Eigen::Matrix3d world_orientation)
59 Eigen::Vector3d relative_position,
60 Eigen::Matrix3d relative_orientation,
61 Eigen::Vector3d axis_of_rotation,
62 int8_t joint_actuator_id,
63 double max_position_limit,
64 double min_position_limit,
67 Eigen::Matrix3d inertia_tensor,
68 Eigen::Vector3d center_of_mass)
71 relative_position, relative_orientation, axis_of_rotation, joint_actuator_id,
72 max_position_limit, min_position_limit, coefficient, mass,
73 inertia_tensor, center_of_mass);
83 Eigen::Vector3d relative_position,
84 Eigen::Matrix3d relative_orientation,
86 double max_position_limit,
87 double min_position_limit,
90 Eigen::Matrix3d inertia_tensor,
91 Eigen::Vector3d center_of_mass)
94 relative_position, relative_orientation, tool_id,
95 max_position_limit, min_position_limit, coefficient, mass,
96 inertia_tensor, center_of_mass);
120 for(uint32_t index = 0; index < id_array.size(); index++)
129 tool_actuator_.insert(std::make_pair(actuator_name, tool_actuator));
339 std::map<Name, JointActuator *>::iterator it_joint_actuator;
352 std::map<Name, JointActuator *>::iterator it_joint_actuator;
364 std::map<Name, ToolActuator *>::iterator it_tool_actuator;
377 std::map<Name, ToolActuator *>::iterator it_tool_actuator;
389 std::map<Name, JointActuator *>::iterator it_joint_actuator;
394 std::map<Name, ToolActuator *>::iterator it_tool_actuator;
407 std::map<Name, JointActuator *>::iterator it_joint_actuator;
412 std::map<Name, ToolActuator *>::iterator it_tool_actuator;
454 std::vector<uint8_t> id;
455 std::vector<JointValue> value_vector;
457 value_vector.push_back(value);
472 if(joint_component_name.size() != value_vector.size())
482 std::vector<int8_t> joint_id;
483 for(uint32_t index = 0; index < value_vector.size(); index++)
486 value_vector.at(index).position = value_vector.at(index).position / coefficient;
487 value_vector.at(index).velocity = value_vector.at(index).velocity / coefficient;
488 value_vector.at(index).acceleration = value_vector.at(index).acceleration / coefficient;
489 value_vector.at(index).effort = value_vector.at(index).effort;
493 std::vector<uint8_t> single_actuator_id;
494 std::vector<JointValue> single_value_vector;
495 std::map<Name, JointActuator *>::iterator it_joint_actuator;
498 single_actuator_id =
joint_actuator_.at(it_joint_actuator->first)->getId();
499 for(uint32_t index = 0; index < single_actuator_id.size(); index++)
501 for(uint32_t index2=0; index2 < joint_id.size(); index2++)
503 if(single_actuator_id.at(index) == joint_id.at(index2))
505 single_value_vector.push_back(value_vector.at(index2));
509 joint_actuator_.at(it_joint_actuator->first)->sendJointActuatorValue(single_actuator_id, single_value_vector);
516 for(uint8_t index = 0; index < joint_component_name.size(); index++)
531 std::map<Name, Component>::iterator it;
532 std::vector<int8_t> joint_id;
539 value_vector.at(index).position = value_vector.at(index).position / coefficient;
540 value_vector.at(index).velocity = value_vector.at(index).velocity / coefficient;
541 value_vector.at(index).acceleration = value_vector.at(index).acceleration / coefficient;
542 value_vector.at(index).effort = value_vector.at(index).effort;
548 std::vector<uint8_t> single_actuator_id;
549 std::vector<JointValue> single_value_vector;
550 std::map<Name, JointActuator *>::iterator it_joint_actuator;
553 single_actuator_id =
joint_actuator_.at(it_joint_actuator->first)->getId();
554 for(uint32_t index = 0; index < single_actuator_id.size(); index++)
556 for(uint32_t index2=0; index2 < joint_id.size(); index2++)
558 if(single_actuator_id.at(index) == joint_id.at(index2))
560 single_value_vector.push_back(value_vector.at(index2));
564 joint_actuator_.at(it_joint_actuator->first)->sendJointActuatorValue(single_actuator_id, single_value_vector);
580 std::vector<uint8_t> actuator_id;
581 std::vector<JointValue> result;
588 result.at(0).position = result.at(0).position * coefficient;
589 result.at(0).velocity = result.at(0).velocity * coefficient;
590 result.at(0).acceleration = result.at(0).acceleration * coefficient;
591 result.at(0).effort = result.at(0).effort;
603 std::vector<JointValue> get_value_vector;
604 std::vector<uint8_t> get_actuator_id;
606 std::vector<JointValue> single_value_vector;
607 std::vector<uint8_t> single_actuator_id;
608 std::map<Name, JointActuator *>::iterator it_joint_actuator;
611 single_actuator_id =
joint_actuator_.at(it_joint_actuator->first)->getId();
612 single_value_vector =
joint_actuator_.at(it_joint_actuator->first)->receiveJointActuatorValue(single_actuator_id);
613 for(uint32_t index=0; index < single_actuator_id.size(); index++)
615 get_actuator_id.push_back(single_actuator_id.at(index));
616 get_value_vector.push_back(single_value_vector.at(index));
620 std::vector<JointValue> result_vector;
623 for(uint32_t index = 0; index < joint_component_name.size(); index++)
625 for(uint32_t index2 = 0; index2 < get_actuator_id.size(); index2++)
627 if(
manipulator_.
getId(joint_component_name.at(index)) == get_actuator_id.at(index2))
630 result.
position = get_value_vector.at(index2).position * coefficient;
631 result.
velocity = get_value_vector.at(index2).velocity * coefficient;
632 result.
acceleration = get_value_vector.at(index2).acceleration * coefficient;
633 result.
effort = get_value_vector.at(index2).effort;
635 result_vector.push_back(result);
640 return result_vector;
649 std::vector<JointValue> get_value_vector;
650 std::vector<uint8_t> get_actuator_id;
652 std::vector<JointValue> single_value_vector;
653 std::vector<uint8_t> single_actuator_id;
654 std::map<Name, JointActuator *>::iterator it_joint_actuator;
657 single_actuator_id =
joint_actuator_.at(it_joint_actuator->first)->getId();
658 single_value_vector =
joint_actuator_.at(it_joint_actuator->first)->receiveJointActuatorValue(single_actuator_id);
659 for(uint32_t index=0; index < single_actuator_id.size(); index++)
661 get_actuator_id.push_back(single_actuator_id.at(index));
662 get_value_vector.push_back(single_value_vector.at(index));
666 std::map<Name, Component>::iterator it;
667 std::vector<JointValue> result_vector;
672 for(uint32_t index2 = 0; index2 < get_actuator_id.size(); index2++)
677 result.
position = get_value_vector.at(index2).position * coefficient;
678 result.
velocity = get_value_vector.at(index2).velocity * coefficient;
679 result.
acceleration = get_value_vector.at(index2).acceleration * coefficient;
680 result.
effort = get_value_vector.at(index2).effort;
682 result_vector.push_back(result);
687 return result_vector;
726 for (uint32_t index = 0; index < tool_component_name.size(); index++)
729 value_vector.at(index).position = value_vector.at(index).position / coefficient;
730 value_vector.at(index).velocity = value_vector.at(index).velocity / coefficient;
731 value_vector.at(index).acceleration = value_vector.at(index).acceleration / coefficient;
741 for(uint8_t index = 0; index < tool_component_name.size(); index++)
755 std::vector<Name> tool_component_name;
757 for (uint32_t index = 0; index < tool_component_name.size(); index++)
760 value_vector.at(index).position = value_vector.at(index).position / coefficient;
761 value_vector.at(index).velocity = value_vector.at(index).velocity / coefficient;
762 value_vector.at(index).acceleration = value_vector.at(index).acceleration / coefficient;
799 std::vector<JointValue> result_vector;
801 for (uint32_t index = 0; index < tool_component_name.size(); index++)
811 result_vector.push_back(result);
813 return result_vector;
822 std::vector<Name> tool_component_name;
824 std::vector<JointValue> result_vector;
826 for (uint32_t index = 0; index < tool_component_name.size(); index++)
836 result_vector.push_back(result);
838 return result_vector;
874 log::error(
"[checkJointLimit] Goal value exceeded limit at " +
STRING(component_name) +
".");
885 log::error(
"[checkJointLimit] Goal value exceeded limit at " +
STRING(component_name) +
".");
892 for(uint32_t index = 0; index < component_name.size(); index++)
896 log::error(
"[checkJointLimit] Goal value exceeded limit at " +
STRING(component_name.at(index)) +
".");
905 for(uint32_t index = 0; index < component_name.size(); index++)
909 log::error(
"[checkJointLimit] Goal value exceeded limit at " +
STRING(component_name.at(index)) +
".");
927 if(present_joint_value.size() != 0)
934 std::vector<double> goal_joint_position;
936 goal_joint_position.push_back(present_way_point.at(i).position + delta_goal_joint_position.at(i));
946 if(present_joint_value.size() != 0)
958 goal_way_point_temp.
position = goal_joint_position.at(index);
961 goal_way_point_temp.
effort = 0.0;
963 goal_way_point.push_back(goal_way_point_temp);
980 if(present_joint_value.size() != 0)
999 if(present_joint_value.size() != 0)
1007 goal_pose.
position = goal_position;
1014 if(present_joint_value.size() != 0)
1029 if(present_joint_value.size() != 0)
1040 Pose temp_goal_pose;
1043 std::vector<JointValue> goal_joint_angle;
1055 log::error(
"[JOINT_TRAJECTORY] Fail to solve IK");
1060 if(present_joint_value.size() != 0)
1075 if(present_joint_value.size() != 0)
1090 if(present_joint_value.size() != 0)
1106 if(present_joint_value.size() != 0)
1114 goal_pose.
position = goal_position;
1121 if(present_joint_value.size() != 0)
1140 if(present_joint_value.size() != 0)
1149 goal_task_way_point.
kinematic = goal_pose;
1172 if(present_joint_value.size() != 0)
1194 if(present_joint_value.size() != 0)
1216 if(present_joint_value.size() != 0)
1238 tool_value.
position = tool_goal_position;
1285 log::error(
"[TASK_TRAJECTORY] fail to solve IK");
1318 log::error(
"[CUSTOM_TASK_TRAJECTORY] fail to solve IK");
1331 return joint_way_point_value;
1361 return joint_goal_way_point;
1389 return joint_goal_way_point;
1396 std::vector<JointValue> result_vector;
1398 for(uint32_t index =0; index<tool_component_name.size(); index++)
1402 return result_vector;
void enableAllActuator()
enableAllActuator
uint8_t getToolActuatorId(Name actuator_name)
getToolActuatorId
CustomTaskTrajectory * getCustomTaskTrajectory(Name name)
getCustomTaskTrajectory
void setAllToolValue(std::vector< JointValue > tool_value_vector)
setAllToolValue
void printManipulatorSetting()
printManipulatorSetting
void setPresentControlToolName(Name present_control_tool_name)
setPresentControlToolName
void enableAllToolActuator()
enableAllToolActuator
void makeToolTrajectory(Name tool_name, double tool_goal_position)
makeToolTrajectory
std::vector< JointValue > getToolGoalValue()
getToolGoalValue
std::vector< JointValue > receiveMultipleToolActuatorValue(std::vector< Name > tool_component_name)
receiveMultipleToolActuatorValue
std::vector< JointValue > getAllToolValue()
getAllToolValue
virtual ~RobotisManipulator()
bool getActuatorEnabledState(Name actuator_name)
getActuatorEnabledState
int8_t getId(Name component_name)
getId
void disableActuator(Name actuator_name)
disableActuator
void setMoveTime(double move_time)
setMoveTime
void addCustomTrajectory(Name trajectory_name, CustomJointTrajectory *custom_trajectory)
addCustomTrajectory
std::vector< JointValue > receiveAllJointActuatorValue()
receiveAllJointActuatorValue
TaskWaypoint getPresentTaskWaypoint(Name tool_name)
getPresentTaskWaypoint
void makeCustomTrajectory(Name trajectory_name, JointWaypoint start_way_point, const void *arg)
makeCustomTrajectory
Manipulator * getManipulator()
getManipulator
std::vector< JointValue > getAllActiveJointValue()
getAllActiveJointValue
void addJoint(Name my_name, Name parent_name, Name child_name, Eigen::Vector3d relative_position, Eigen::Matrix3d relative_orientation, Eigen::Vector3d axis_of_rotation=Eigen::Vector3d::Zero(), int8_t joint_actuator_id=-1, double max_position_limit=M_PI, double min_position_limit=-M_PI, double coefficient=1.0, double mass=0.0, Eigen::Matrix3d inertia_tensor=Eigen::Matrix3d::Identity(), Eigen::Vector3d center_of_mass=Eigen::Vector3d::Zero())
addJoint
void setCustomTrajectoryOption(Name trajectory_name, const void *arg)
setCustomTrajectoryOption
void disableAllJointActuator()
disableAllJointActuator
bool sendAllToolActuatorValue(std::vector< JointValue > value_vector)
sendAllToolActuatorValue
JointValue getToolValue(Name tool_name)
getToolValue
KinematicPose getKinematicPose(Name component_name)
getKinematicPose
TaskWaypoint getTaskWaypoint(double tick)
getTaskWaypoint
bool sendMultipleJointActuatorValue(std::vector< Name > joint_component_name, std::vector< JointValue > value_vector)
sendMultipleJointActuatorValue
double getCoefficient(Name component_name)
getCoefficient
virtual void solveForwardKinematics(Manipulator *manipulator)=0
solveForwardKinematics
void setAllActiveJointValue(std::vector< JointValue > joint_value_vector)
setAllActiveJointValue
void addWorld(Name world_name, Name child_name, Eigen::Vector3d world_position=Eigen::Vector3d::Zero(), Eigen::Matrix3d world_orientation=Eigen::Matrix3d::Identity())
addWorld
std::vector< JointValue > receiveMultipleJointActuatorValue(std::vector< Name > joint_component_name)
receiveMultipleJointActuatorValue
JointValue receiveToolActuatorValue(Name tool_component_name)
receiveToolActuatorValue
std::vector< Name > getAllActiveJointComponentName()
getAllActiveJointComponentName
void setToolActuatorMode(Name actuator_name, const void *arg)
setToolActuatorMode
Name getComponentActuatorName(Name component_name)
getComponentActuatorName
std::vector< JointValue > getAllJointValue()
getAllJointValue
std::vector< JointValue > getJointGoalValueFromTrajectoryTickTime(double tick_time)
getJointGoalValueFromTrajectoryTickTime
DynamicPose getComponentDynamicPoseFromWorld(Name component_name)
getComponentDynamicPoseFromWorld
The CustomJointTrajectory class.
std::vector< JointValue > receiveAllToolActuatorValue()
receiveAllToolActuatorValue
Name findComponentNameUsingId(int8_t id)
findComponentNameUsingId
virtual bool solveInverseKinematics(Manipulator *manipulator, Name tool_name, Pose target_pose, std::vector< JointValue > *goal_joint_position)=0
solveInverseKinematics
void setStartTimeToPresentTime()
setStartTimeToPresentTime
std::map< Name, Component >::iterator getIteratorEnd()
getIteratorEnd
std::vector< JointValue > JointWaypoint
JointWaypoint getPresentJointWaypoint()
getPresentJointWaypoint
void makeJointTrajectory(std::vector< double > goal_joint_position, double move_time, std::vector< JointValue > present_joint_value={})
makeJointTrajectory
Trajectory * getTrajectory()
getTrajectory
void addToolActuator(Name tool_name, ToolActuator *tool_actuator, uint8_t id, const void *arg)
addToolActuator
void sleepTrajectory(double wait_time, std::vector< JointValue > present_joint_value={})
sleepTrajectory
void setPresentJointWaypoint(JointWaypoint joint_value_vector)
setPresentJointWaypoint
std::vector< JointValue > getAllJointValue()
getAllJointValue
bool trajectory_initialized_state_
JointValue getJointValue(Name joint_name)
getJointValue
std::vector< JointValue > getJointGoalValueFromTrajectory(double present_time)
getJointGoalValueFromTrajectory
bool sendAllJointActuatorValue(std::vector< JointValue > value_vector)
sendAllJointActuatorValue
void addComponentChild(Name my_name, Name child_name)
addComponentChild
void enableAllJointActuator()
enableAllJointActuator
void updatePresentWaypoint(Kinematics *kinematics)
updatePresentWaypoint
void solveForwardKinematics()
solveForwardKinematics
double getTrajectoryMoveTime()
getTrajectoryMoveTime
JointValue getToolGoalValue(Name tool_name)
getToolGoalValue
The CustomTaskTrajectory class.
bool sendMultipleToolActuatorValue(std::vector< Name > tool_component_name, std::vector< JointValue > value_vector)
sendMultipleToolActuatorValue
void setToolGoalValue(Name tool_name, JointValue tool_goal_value)
setToolGoalValue
void disableAllToolActuator()
disableAllToolActuator
bool checkJointLimit(Name component_name, double position)
checkJointLimit
void setComponentActuatorName(Name component_name, Name actuator_name)
setComponentActuatorName
Pose getComponentPoseFromWorld(Name component_name)
getComponentPoseFromWorld
void makeTaskTrajectoryFromPresentPose(Name tool_name, Eigen::Vector3d position_meter, double move_time, std::vector< JointValue > present_joint_value={})
makeTaskTrajectoryFromPresentPose
std::vector< JointValue > getAllActiveJointValue()
getAllActiveJointValue
JointValue getJointValue(Name component_name)
getJointValue
bool checkTrajectoryType(TrajectoryType trajectory_type)
checkTrajectoryType
TaskTrajectory getTaskTrajectory()
getTaskTrajectory
std::map< Name, Component >::iterator getIteratorBegin()
getIteratorBegin
JointWaypoint getJointWaypoint(double tick)
getJointWaypoint
std::vector< double > getAllToolPosition()
getAllToolPosition
std::map< Name, ToolActuator * > tool_actuator_
void setJointActuatorMode(Name actuator_name, std::vector< uint8_t > id_array, const void *arg)
setJointActuatorMode
DynamicPose getDynamicPose(Name component_name)
getDynamicPose
Eigen::Vector3d getComponentPositionFromWorld(Name component_name)
getComponentPositionFromWorld
std::vector< uint8_t > getJointActuatorId(Name actuator_name)
getJointActuatorId
virtual void setOption(const void *arg)=0
setOption
void addKinematics(Kinematics *kinematics)
addKinematics
bool actuator_added_stete_
virtual Eigen::MatrixXd jacobian(Manipulator *manipulator, Name tool_name)=0
jacobian
void enableActuator(Name actuator_name)
enableActuator
void makeJointTrajectoryFromPresentPosition(std::vector< double > delta_goal_joint_position, double move_time, std::vector< JointValue > present_joint_value={})
makeJointTrajectoryFromPresentPosition
std::vector< double > getAllToolPosition()
getAllToolPosition
Eigen::Matrix3d getComponentOrientationFromWorld(Name component_name)
getComponentOrientationFromWorld
bool checkComponentType(Name component_name, ComponentType component_type)
checkComponentType
bool sendToolActuatorValue(Name tool_component_name, JointValue value)
sendToolActuatorValue
void setKinematicsOption(const void *arg)
setKinematicsOption
void addTool(Name my_name, Name parent_name, Eigen::Vector3d relative_position, Eigen::Matrix3d relative_orientation, int8_t tool_id=-1, double max_position_limit=M_PI, double min_position_limit=-M_PI, double coefficient=1.0, double mass=0.0, Eigen::Matrix3d inertia_tensor=Eigen::Matrix3d::Identity(), Eigen::Vector3d center_of_mass=Eigen::Vector3d::Zero())
addTool
void initTrajectoryWaypoint(Manipulator actual_manipulator, Kinematics *kinematics)
initTrajectoryWaypoint
bool checkJointLimit(Name Component_name, double value)
checkJointLimit
void addTool(Name my_name, Name parent_name, Eigen::Vector3d relative_position, Eigen::Matrix3d relative_orientation, int8_t tool_id=-1, double max_position_limit=M_PI, double min_position_limit=-M_PI, double coefficient=1.0, double mass=0.0, Eigen::Matrix3d inertia_tensor=Eigen::Matrix3d::Identity(), Eigen::Vector3d center_of_mass=Eigen::Vector3d::Zero())
addTool
KinematicPose getComponentKinematicPoseFromWorld(Name component_name)
getComponentKinematicPoseFromWorld
void error(STRING str)
error
JointWaypoint getTrajectoryJointValue(double tick_time)
getTrajectoryJointValue
bool solveInverseKinematics(Name tool_name, Pose goal_pose, std::vector< JointValue > *goal_joint_value)
solveInverseKinematics
JointWaypoint removeWaypointDynamicData(JointWaypoint value)
removeWaypointDynamicData
void makeTaskTrajectory(Name tool_name, Eigen::Vector3d goal_position, double move_time, std::vector< JointValue > present_joint_value={})
makeTaskTrajectory
void addWorld(Name world_name, Name child_name, Eigen::Vector3d world_position=Eigen::Vector3d::Zero(), Eigen::Matrix3d world_orientation=Eigen::Matrix3d::Identity())
addWorld
Eigen::MatrixXd jacobian(Name tool_name)
jacobian
double getMoveTime()
getMoveTime
std::vector< Name > getAllToolComponentName()
getAllToolComponentName
std::map< Name, JointActuator * > joint_actuator_
void disableAllActuator()
disableAllActuator
std::vector< JointValue > getAllToolValue()
getAllToolValue
void addCustomTrajectory(Name trajectory_name, CustomJointTrajectory *custom_trajectory)
addCustomTrajectory
JointTrajectory getJointTrajectory()
getJointTrajectory
void addJoint(Name my_name, Name parent_name, Name child_name, Eigen::Vector3d relative_position, Eigen::Matrix3d relative_orientation, Eigen::Vector3d axis_of_rotation=Eigen::Vector3d::Zero(), int8_t joint_actuator_id=-1, double max_position_limit=M_PI, double min_position_limit=-M_PI, double coefficient=1.0, double mass=0.0, Eigen::Matrix3d inertia_tensor=Eigen::Matrix3d::Identity(), Eigen::Vector3d center_of_mass=Eigen::Vector3d::Zero())
addJoint
Manipulator * getManipulator()
getManipulator
void startMoving()
startMoving
void makeTaskTrajectory(TaskWaypoint start_way_point, TaskWaypoint goal_way_point)
makeTaskTrajectory
Name getPresentControlToolName()
getPresentControlToolName
Name getPresentCustomTrajectoryName()
getPresentCustomTrajectoryName
void setPresentTime(double present_time)
setPresentTime
void setCustomTrajectoryOption(Name trajectory_name, const void *arg)
setCustomTrajectoryOption
Eigen::Matrix3d orientation
void printManipulatorSetting()
printManipulatorSetting
void makeJointTrajectory(JointWaypoint start_way_point, JointWaypoint goal_way_point)
makeJointTrajectory
double getTickTime()
getTickTime
void addComponentChild(Name my_name, Name child_name)
addComponentChild
void makeCustomTrajectory(Name trajectory_name, Name tool_name, const void *arg, double move_time, std::vector< JointValue > present_joint_value={})
makeCustomTrajectory
bool getMovingState()
getMovingState
CustomJointTrajectory * getCustomJointTrajectory(Name name)
getCustomJointTrajectory
void setTrajectoryType(TrajectoryType trajectory_type)
setTrajectoryType
void setJointValue(Name name, JointValue joint_value)
setJointValue
Pose getPose(Name component_name)
getPose
void addJointActuator(Name actuator_name, JointActuator *joint_actuator, std::vector< uint8_t > id_array, const void *arg)
addJointActuator
JointValue receiveJointActuatorValue(Name joint_component_name)
receiveJointActuatorValue
bool sendJointActuatorValue(Name joint_component_name, JointValue value)
sendJointActuatorValue