Gripper closing but not opening (Pr2/gazebo)
Hey Guys, I am following this tutorial: http://wiki.ros.org/pr2_controllers/T... I have everything set up and running. I am using Gazebo on Ubuntu 12.04 and Ros Hydro. My code looks exactly the same as the tutorial. The problem is the gripper always fails to open but looks like it closes (even though it was already closed and didn't open to close again)...
[ INFO] [1422403954.415261925, 433.873000000]: Sending open goal
[ INFO] [1422403955.782608686, 434.379000000]: The gripper failed to open.
[ INFO] [1422403955.782764580, 434.379000000]: Sending squeeze goal
[ INFO] [1422403955.807454463, 434.389000000]: The gripper closed!
Do anyone know what could be causing this?
I believe this tutorials is pretty old, isn't it? I can open the gripper publishing the following on a terminal:
rostopic pub r_gripper_controller/command pr2_controllers_msgs/Pr2GripperCommand "{position: 0.06, max_effort: 100.0}"
but not with the code provided in the tutorial...
UPDATE: (SOLVED)
Wrote my own code.
#include <ros/ros.h>
#include <pr2_controllers_msgs/Pr2GripperCommand.h>
#include <actionlib/client/simple_action_client.h>
class Gripper{
private:
ros::NodeHandle nh_;
ros::Publisher r_gripper_;
public:
//Action client initialization
Gripper(ros::NodeHandle &nh){
nh_ = nh;
r_gripper_ = nh_.advertise<pr2_controllers_msgs::Pr2GripperCommand>("/r_gripper_controller/command", 1);
}
~Gripper(){
}
//Open the gripper
void open(){
pr2_controllers_msgs::Pr2GripperCommand gripper_cmd;
gripper_cmd.position = 0.06;
gripper_cmd.max_effort = 100.0;
while (nh_.ok())
{
r_gripper_.publish(gripper_cmd);
}
}
//Close the gripper
void close(){
pr2_controllers_msgs::Pr2GripperCommand gripper_cmd;
gripper_cmd.position = 0.0;
gripper_cmd.max_effort = 100.0;
while (nh_.ok())
{
r_gripper_.publish(gripper_cmd);
}
}
};
int main(int argc, char** argv){
ros::init(argc, argv, "simple_gripper");
ros::NodeHandle nh;
Gripper gripper(nh);
gripper.open();
gripper.close();
return 0;
}
Nice! I was going to do the same! and seems like i have no other choice left. However, i'd like to suggest that you publish appropriate messages to the "/r_gripper_controller/gripper_action/goal" topic so you can get feedback from "/r_gripper_controller/gripper_action/[result | feedback]" topics
@Fred Ferreira@mexomagno Does this answer solve the issue?