26 #include <std_msgs/String.h> 28 #include "../include/open_manipulator_p_control_gui/qnode.hpp" 43 open_manipulator_actuator_enabled_(false),
44 open_manipulator_is_moving_(false),
92 std::cout <<
"Ros shutdown, proceeding to close the gui." << std::endl;
98 if(msg->open_manipulator_moving_state == msg->IS_MOVING)
103 if(msg->open_manipulator_actuator_state == msg->ACTUATOR_ENABLED)
110 std::vector<double> temp_angle;
114 for(
int i = 0; i < msg->name.size(); i ++)
116 if (!msg->name.at(i).compare(
"joint1")) temp_angle.at(0) = (msg->position.at(i));
117 else if(!msg->name.at(i).compare(
"joint2")) temp_angle.at(1) = (msg->position.at(i));
118 else if(!msg->name.at(i).compare(
"joint3")) temp_angle.at(2) = (msg->position.at(i));
119 else if(!msg->name.at(i).compare(
"joint4")) temp_angle.at(3) = (msg->position.at(i));
120 else if(!msg->name.at(i).compare(
"joint5")) temp_angle.at(4) = (msg->position.at(i));
121 else if(!msg->name.at(i).compare(
"joint6")) temp_angle.at(5) = (msg->position.at(i));
125 if(!msg->name.at(i).compare(
"gripper")) temp_angle.at(6) = (msg->position.at(i));
133 std::vector<double> temp_position;
134 temp_position.push_back(msg->pose.position.x);
135 temp_position.push_back(msg->pose.position.y);
136 temp_position.push_back(msg->pose.position.z);
138 Eigen::Quaterniond temp_orientation(msg->pose.orientation.w, msg->pose.orientation.x, msg->pose.orientation.y, msg->pose.orientation.z);
179 std_msgs::String msg;
186 open_manipulator_msgs::SetJointPosition srv;
187 srv.request.joint_position.joint_name = joint_name;
188 srv.request.joint_position.position = joint_angle;
189 srv.request.path_time = path_time;
193 return srv.response.is_planned;
200 open_manipulator_msgs::SetKinematicsPose srv;
202 srv.request.end_effector_name =
"gripper";
204 srv.request.kinematics_pose.pose.position.x = kinematics_pose.at(0);
205 srv.request.kinematics_pose.pose.position.y = kinematics_pose.at(1);
206 srv.request.kinematics_pose.pose.position.z = kinematics_pose.at(2);
208 srv.request.kinematics_pose.pose.orientation.w = kinematics_pose.at(3);
209 srv.request.kinematics_pose.pose.orientation.x = kinematics_pose.at(4);
210 srv.request.kinematics_pose.pose.orientation.y = kinematics_pose.at(5);
211 srv.request.kinematics_pose.pose.orientation.z = kinematics_pose.at(6);
213 srv.request.path_time = path_time;
217 return srv.response.is_planned;
224 open_manipulator_msgs::SetDrawingTrajectory srv;
225 srv.request.end_effector_name =
"gripper";
226 srv.request.drawing_trajectory_name = name;
227 srv.request.path_time = path_time;
228 for(
int i = 0; i < arg.size(); i ++)
229 srv.request.param.push_back(arg.at(i));
233 return srv.response.is_planned;
240 open_manipulator_msgs::SetJointPosition srv;
241 srv.request.joint_position.joint_name.push_back(
"gripper");
242 srv.request.joint_position.position = joint_angle;
246 return srv.response.is_planned;
253 open_manipulator_msgs::SetActuatorState srv;
254 srv.request.set_actuator_state = actuator_state;
258 return srv.response.is_planned;
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
std::vector< double > getPresentJointAngle()
ros::ServiceClient goal_tool_control_client_
bool getOpenManipulatorMovingState()
void publish(const boost::shared_ptr< M > &message) const
bool setActuatorState(bool actuator_state)
ros::ServiceClient goal_drawing_trajectory_client_
void setOption(std::string opt)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
ros::Subscriber open_manipulator_joint_states_sub_
Eigen::Quaterniond present_kinematics_orientation_
std::vector< double > present_kinematics_position_
void manipulatorStatesCallback(const open_manipulator_msgs::OpenManipulatorState::ConstPtr &msg)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
Eigen::Quaterniond getPresentKinematicsOrientation()
Eigen::Vector3d convertQuaternionToRPYVector(const Eigen::Quaterniond &quaternion)
void jointStatesCallback(const sensor_msgs::JointState::ConstPtr &msg)
#define NUM_OF_JOINT_AND_TOOL
ros::Subscriber open_manipulator_kinematics_pose_sub_
bool open_manipulator_actuator_enabled_
Eigen::Vector3d present_kinematics_orientation_rpy_
bool getWithGripperState()
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
std::vector< double > getPresentKinematicsPosition()
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
bool setJointSpacePath(std::vector< std::string > joint_name, std::vector< double > joint_angle, double path_time)
bool getOpenManipulatorActuatorState()
ROSCPP_DECL bool isStarted()
ros::Publisher open_manipulator_option_pub_
std::vector< double > present_joint_angle_
QNode(int argc, char **argv)
ROSCPP_DECL void shutdown()
open_manipulator_msgs::KinematicsPose kinematics_pose_
bool setDrawingTrajectory(std::string name, std::vector< double > arg, double path_time)
bool setTaskSpacePath(std::vector< double > kinematics_pose, double path_time)
ros::ServiceClient goal_joint_space_path_client_
ROSCPP_DECL void spinOnce()
Eigen::Vector3d getPresentKinematicsOrientationRPY()
ros::ServiceClient goal_task_space_path_position_only_client_
void kinematicsPoseCallback(const open_manipulator_msgs::KinematicsPose::ConstPtr &msg)
ros::Subscriber open_manipulator_states_sub_
bool open_manipulator_is_moving_
ros::ServiceClient goal_task_space_path_client_
ROSCPP_DECL void waitForShutdown()
ros::ServiceClient set_actuator_state_client_
bool setToolControl(std::vector< double > joint_angle)