61 std::string joint_name;
62 if (!n.
getParam(
"joint", joint_name))
92 ROS_ERROR(
"Could not find joint '%s' in urdf", joint_name.c_str());
174 double error, vel_error;
175 double commanded_velocity;
192 else if (
joint_urdf_->type == urdf::Joint::CONTINUOUS)
198 error = command_position - current_position;
263 else if( command < joint_urdf_->limits->lower )
std::string getName() const
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
void setCommandCB(const std_msgs::Float64ConstPtr &msg)
Callback from /command subscriber for setpoint.
URDF_EXPORT bool initParamWithNodeHandle(const std::string ¶m, const ros::NodeHandle &nh=ros::NodeHandle())
~JointPositionController()
control_toolbox::Pid pid_controller_
void update(const ros::Time &time, const ros::Duration &period)
Issues commands to the joint. Should be called at regular intervals.
std::string getJointName()
Get the name of the joint this controller uses.
ros::Subscriber sub_command_
void enforceJointLimits(double &command)
Check that the command is within the hard limits of the joint. Checks for joint type first...
void starting(const ros::Time &time)
This is called from within the realtime thread just before the first call to update.
const std::string & getNamespace() const
double getPosition() const
void setGains(const double &p, const double &i, const double &d, const double &i_max, const double &i_min, const bool &antiwindup=false)
Get the PID parameters.
double getVelocity() const
hardware_interface::JointHandle joint_
double getPosition()
Get the current position of the joint.
def shortest_angular_distance_with_limits(from_angle, to_angle, left_limit, right_limit)
JointHandle getHandle(const std::string &name)
bool init(hardware_interface::VelocityJointInterface *robot, ros::NodeHandle &n)
The init function is called to initialize the controller from a non-realtime thread with a pointer to...
void setCommand(double command)
JointPositionController()
boost::scoped_ptr< realtime_tools::RealtimePublisher< control_msgs::JointControllerState > > controller_state_publisher_
bool getParam(const std::string &key, std::string &s) const
void setCommand(double pos_target)
Give set position of the joint for next update: revolute (angle) and prismatic (position) ...
realtime_tools::RealtimeBuffer< Commands > command_
void printDebug()
Print debug info to console.
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
urdf::JointConstSharedPtr joint_urdf_
Joint Position Controller.
def shortest_angular_distance(from_angle, to_angle)
void getGains(double &p, double &i, double &d, double &i_max, double &i_min)
Get the PID parameters.