31 : control_cycle_msec_(0)
75 doc = YAML::LoadFile(path.c_str());
76 }
catch (
const std::exception& e)
84 _mov_time = doc[
"mov_time"].as<
double>();
89 YAML::Node _tar_pose_node = doc[
"tar_pose"];
90 for (YAML::iterator _it = _tar_pose_node.begin(); _it != _tar_pose_node.end(); ++_it)
95 _id = _it->first.as<
int>();
96 _value = _it->second.as<
double>();
132 while (ros_node.
ok())
146 if (msg->data ==
"ini_pose")
149 std::string ini_pose_path =
ros::package::getPath(
"manipulator_h_base_module") +
"/config/ini_pose.yaml";
166 std_msgs::String str_msg;
167 str_msg.data =
"base_module";
175 manipulator_h_base_module_msgs::GetJointPose::Response &res)
182 for (
int name_index = 0; name_index < req.joint_name.size(); name_index++)
198 manipulator_h_base_module_msgs::GetKinematicsPose::Response &res)
209 res.group_pose.orientation.w = quaternion.w();
210 res.group_pose.orientation.x = quaternion.x();
211 res.group_pose.orientation.y = quaternion.y();
212 res.group_pose.orientation.z = quaternion.z();
279 ROS_INFO(
"[start] send trajectory");
280 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_INFO,
"Start Trajectory");
290 double mov_time = 2.0;
292 double max_diff, abs_diff;
311 abs_diff = fabs(tar_value - ini_value);
313 if (max_diff < abs_diff)
352 ROS_INFO(
"[start] send trajectory");
353 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_INFO,
"Start Trajectory");
360 double mov_time = 2.0;
383 for (
int dim = 0; dim < 3; dim++)
405 ROS_INFO(
"[start] send trajectory");
406 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_INFO,
"Start Trajectory");
410 std::map<std::string, double> sensors)
417 for (std::map<std::string, robotis_framework::DynamixelState *>::iterator state_iter =
result_.begin();
418 state_iter !=
result_.end(); state_iter++)
420 std::string joint_name = state_iter->first;
423 std::map<std::string, robotis_framework::Dynamixel*>::iterator dxl_it = dxls.find(joint_name);
424 if (dxl_it != dxls.end())
425 dxl = dxl_it->second;
456 double ik_tol = 1e-3;
460 if (ik_success ==
true)
467 ROS_INFO(
"[end] send trajectory (ik failed)");
468 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_INFO,
"End Trajectory (IK Failed)");
486 for (std::map<std::string, robotis_framework::DynamixelState *>::iterator state_iter =
result_.begin();
487 state_iter !=
result_.end(); state_iter++)
489 std::string joint_name = state_iter->first;
498 publishStatusMsg(robotis_controller_msgs::StatusMsg::STATUS_INFO,
"End Trajectory");
522 robotis_controller_msgs::StatusMsg status;
525 status.module_name =
"Base";
526 status.status_msg = msg;
void initialize(const int control_cycle_msec, robotis_framework::Robot *robot)
bool inverseKinematics(int to, Eigen::MatrixXd tar_position, Eigen::MatrixXd tar_orientation, int max_iter, double ik_err)
Eigen::MatrixXd ik_start_rotation_
std::map< std::string, DynamixelState * > result_
Eigen::MatrixXd calcMinimumJerkTra(double pos_start, double vel_start, double accel_start, double pos_end, double vel_end, double accel_end, double smp_time, double mov_time)
void publish(const boost::shared_ptr< M > &message) const
Eigen::MatrixXd ik_target_rotation_
BaseJointData curr_joint_state_[MAX_JOINT_ID+1]
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
BaseJointState * joint_state_
ros::Publisher status_msg_pub_
Eigen::Quaterniond convertRotationToQuaternion(const Eigen::Matrix3d &rotation)
void kinematicsPoseMsgCallback(const manipulator_h_base_module_msgs::KinematicsPose::ConstPtr &msg)
Eigen::MatrixXd ik_target_position_
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
void setInverseKinematics(int cnt, Eigen::MatrixXd start_rotation)
ControlMode control_mode_
void generateInitPoseTrajProcess()
Eigen::MatrixXd position_
void generateJointTrajProcess()
void parseIniPoseData(const std::string &path)
void forwardKinematics(int joint_ID)
void setModeMsgCallback(const std_msgs::String::ConstPtr &msg)
void jointPoseMsgCallback(const manipulator_h_base_module_msgs::JointPose::ConstPtr &msg)
Eigen::MatrixXd orientation_
manipulator_h_base_module_msgs::JointPose joint_pose_msg_
bool getJointPoseCallback(manipulator_h_base_module_msgs::GetJointPose::Request &req, manipulator_h_base_module_msgs::GetJointPose::Response &res)
void setCallbackQueue(CallbackQueueInterface *queue)
ros::Publisher set_ctrl_module_pub_
manipulator_h_base_module_msgs::KinematicsPose kinematics_pose_msg_
void publishStatusMsg(unsigned int type, std::string msg)
std::map< std::string, int > joint_name_to_id_
ManipulatorKinematicsDynamics * manipulator_
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
LinkData * manipulator_link_data_[ALL_JOINT_ID+1]
Eigen::MatrixXd joint_ini_pose_
ROSLIB_DECL std::string getPath(const std::string &package_name)
void generateTaskTrajProcess()
void initPoseMsgCallback(const std_msgs::String::ConstPtr &msg)
boost::thread * tra_gene_thread_
Eigen::MatrixXd calc_task_tra_
DynamixelState * dxl_state_
Eigen::MatrixXd calc_joint_tra_
boost::thread queue_thread_
bool getKinematicsPoseCallback(manipulator_h_base_module_msgs::GetKinematicsPose::Request &req, manipulator_h_base_module_msgs::GetKinematicsPose::Response &res)
void process(std::map< std::string, robotis_framework::Dynamixel * > dxls, std::map< std::string, double > sensors)
BaseJointData goal_joint_state_[MAX_JOINT_ID+1]