16 bool has_limits =
false;
17 bool has_soft_limits =
false;
19 urdf::JointConstSharedPtr urdf_joint =
model_ptr_->getJoint(joint_name);
20 if (urdf_joint != NULL)
26 has_soft_limits =
true;
63 printf(
"%s, ctrl_method=%d, has_soft_limits=%d, has_velocity_limits=%d, max_velocity=%f, has_position_limits=%d, min_position=%f, max_position=%f\n",
85 for(
unsigned int j=0; j <
dof_; j++)
133 ROS_ERROR(
"The Xarm may not be properly connected (ret = 3) or hardware Error/Warning (ret = 1 or 2) exists, PLEASE CHECK or RESTART HARDWARE!!!");
135 ROS_ERROR(
"Did you specify the correct ros param xarm_robot_ip ? Exitting...");
157 std::string robot_ip;
158 std::vector<std::string> jnt_names;
163 ROS_ERROR(
"ROS Parameter xarm_dof not specified!");
166 if(!robot_hw_nh.
hasParam(
"xarm_robot_ip"))
168 ROS_ERROR(
"ROS Parameter xarm_robot_ip not specified!");
172 if(!robot_hw_nh.
hasParam(
"/robot_description"))
174 ROS_ERROR(
"ROS Parameter /robot_description not specified!");
179 robot_hw_nh.
getParam(
"DOF", xarm_dof);
180 robot_hw_nh.
getParam(
"xarm_robot_ip", robot_ip);
181 robot_hw_nh.
getParam(
"joint_names", jnt_names);
187 std::string robot_description;
188 root_nh.
getParam(
"/robot_description", robot_description);
189 model_ptr_ = urdf::parseURDF(robot_description);
202 std::lock_guard<std::mutex> locker(
mutex_);
203 for(
int j=0; j<
dof_; j++)
260 std::lock_guard<std::mutex> locker(
mutex_);
261 for(
int k=0; k<
dof_; k++)
294 ROS_ERROR(
"XArmHW::Write() Error! Code: %d, Setting Robot State to STOP...", cmd_ret);
323 static int last_err = 0;
void registerInterface(T *iface)
std::vector< float > velocity_cmd_float_
int setState(short state)
hardware_interface::JointStateInterface js_interface_
std::vector< double > position_fdb_
hardware_interface::PositionJointInterface pj_interface_
urdf::ModelInterfaceSharedPtr model_ptr_
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
std::vector< double > velocity_fdb_
int motionEnable(short en)
std::vector< double > velocity_cmd_
void get_status(int state_mode_err[3])
joint_limits_interface::PositionJointSoftLimitsInterface pj_limits_interface_
void enforceLimits(const ros::Duration &period)
hardware_interface::EffortJointInterface ej_interface_
std::vector< float > position_cmd_float_
std::vector< double > effort_cmd_
std::vector< double > position_cmd_
hardware_interface::VelocityJointInterface vj_interface_
xarm_api::XArmROSClient xarm
joint_limits_interface::EffortJointSoftLimitsInterface ej_limits_interface_
virtual void read(const ros::Time &time, const ros::Duration &period)
bool getSoftJointLimits(urdf::JointConstSharedPtr urdf_joint, SoftJointLimits &soft_limits)
void pos_fb_cb(const sensor_msgs::JointState::ConstPtr &data)
void state_fb_cb(const xarm_msgs::RobotMsg::ConstPtr &data)
const std::string & getNamespace() const
int veloMoveJoint(const std::vector< float > &jnt_v, bool is_sync=true)
std::vector< double > effort_fdb_
void registerHandle(const JointStateHandle &handle)
const std::string xarm_state_topic
JointHandle getHandle(const std::string &name)
static const int VELO_JOINT
std::vector< std::string > jnt_names_
joint_limits_interface::EffortJointSaturationInterface ej_sat_interface_
bool getParam(const std::string &key, std::string &s) const
bool getJointLimits(urdf::JointConstSharedPtr urdf_joint, JointLimits &limits)
ROSCPP_DECL void shutdown()
void clientInit(const std::string &robot_ip, ros::NodeHandle &root_nh)
void init(ros::NodeHandle &nh)
ControlMethod ctrl_method_
const std::string jnt_state_topic
bool hasParam(const std::string &key) const
void _register_joint_limits(ros::NodeHandle &root_nh, std::string joint_name, const ControlMethod ctrl_method)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
ros::Subscriber state_sub_
joint_limits_interface::VelocityJointSaturationInterface vj_sat_interface_
joint_limits_interface::VelocityJointSoftLimitsInterface vj_limits_interface_
ROSCPP_DECL bool waitForService(const std::string &service_name, int32_t timeout)
joint_limits_interface::PositionJointSaturationInterface pj_sat_interface_
int setServoJ(const std::vector< float > &joint_cmd)
virtual void write(const ros::Time &time, const ros::Duration &period)
void _enforce_limits(const ros::Duration &period)
virtual bool init(ros::NodeHandle &root_nh, ros::NodeHandle &robot_hw_nh)