Go to the documentation of this file.
64 std::string param_name =
"joints";
79 if (!
urdf.initParamWithNodeHandle(
"robot_description", n))
101 urdf::JointConstSharedPtr joint_urdf =
urdf.getJoint(joint_name);
104 ROS_ERROR(
"Could not find joint '%s' in urdf", joint_name.c_str());
112 ROS_ERROR_STREAM(
"Failed to load PID parameters from " << joint_name +
"/pid");
125 std::vector<double> current_positions(
n_joints_, 0.0);
126 for (std::size_t i = 0; i <
n_joints_; ++i)
128 current_positions[i] =
joints_[i].getPosition();
140 double command_position = commands[i];
143 double commanded_effort;
145 double current_position =
joints_[i].getPosition();
160 else if (
joint_urdfs_[i]->type == urdf::Joint::CONTINUOUS)
166 error = command_position - current_position;
173 joints_[i].setCommand(commanded_effort);
181 ROS_ERROR_STREAM(
"Dimension of command (" << msg->data.size() <<
") does not match number of joints (" <<
n_joints_ <<
")! Not executing!");
static double shortest_angular_distance(double from, double to)
#define ROS_ERROR_STREAM(args)
void update(const ros::Time &, const ros::Duration &)
JointHandle getHandle(const std::string &name)
const char * what() const noexcept override
bool getParam(const std::string &key, bool &b) const
ROSLIB_DECL std::string command(const std::string &cmd)
void enforceJointLimits(double &command, unsigned int index)
~JointGroupPositionController()
JointGroupPositionController()
Forward command controller for a set of effort controlled joints (torque or force).
std::vector< std::string > joint_names_
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
Forward command controller for a set of effort controlled joints (torque or force).
Subscriber subscribe(const std::string &topic, uint32_t queue_size, const boost::function< void(C)> &callback, const VoidConstPtr &tracked_object=VoidConstPtr(), const TransportHints &transport_hints=TransportHints())
ros::Subscriber sub_command_
void commandCB(const std_msgs::Float64MultiArrayConstPtr &msg)
bool init(hardware_interface::EffortJointInterface *hw, ros::NodeHandle &n)
std::vector< urdf::JointConstSharedPtr > joint_urdfs_
static bool shortest_angular_distance_with_large_limits(double from, double to, double left_limit, double right_limit, double &shortest_angle)
realtime_tools::RealtimeBuffer< std::vector< double > > commands_buffer_
const std::string & getNamespace() const
std::vector< hardware_interface::JointHandle > joints_
std::vector< control_toolbox::Pid > pid_controllers_
void starting(const ros::Time &)