Robotics StackExchange | Archived questions

How to use the action interface of franka_ros packages

Hello,

first of all: I am an absolute ROS beginner so excuse my silly question. I am trying to operate the Franka Emika Robot Panda using ROS.

Here the documentation: https://frankaemika.github.io/docs/ros_introduction.html

I operated it previously using MoveIt but now i would like to use franka_ros directly for instance to move the gripper. I started the respective node using:

roslaunch franka_gripper franka_gripper.launch robot_ip:=<fci-ip>

In the docu it states that now different action servers can be used e.g. franka_gripper::HomingAction(). But what exactly do I have to do now for example to home the gripper. Do I have to use the code part franka_gripper::HomingAction() and if so where do I have to put it in? Do I have to start an action Server first?

I did some reading but somehow I can't figure out how this basic structure works.. Thanks in advance for any help and explanations!!


Edit: Thanks for your answer. Apparently I was on the right track. However, I was not sure wether I needed to write the action server myself. Now I wrote an action client.

I included the following into my action client:

#include <ros/ros.h>
#include <actionlib/client/simple_action_client.h>
#include <franka_gripper/franka_gripper.h>
#include <franka_gripper/HomingAction.h>

Within the main method I wrote:

ros::init(argc, argv, "ros_test_client";
actionlib::SimpleActionClient<franka_gripper::HomingAction> ac("franka_gripper/homing", true);
ROS_INFO("Waiting for action server to start");
ac.waitForServer();
ROS_INFO("Actin server started, sending goal");

However, when I am running the action client it only gets to the point where it returns "Waiting for action server to start". So apparently the action server is not yet started.

Reading (https://frankaemika.github.io/docs/ros_introduction.html) I thought

roslaunch frankagripper frankagripper.launch robot_ip:=

would do the job. Apparently it is not. I tryed to start the node independly by: rosrun frankagripper frankagrippernode Robotip:= In that case I get the error:

terminate called after throwing an instace of 'ros::InvalidNameException' what(): Character [1] is not valid as the first character in Graph Resour Name

Asked by Krebsileinchen on 2018-04-27 09:21:49 UTC

Comments

I've merged your answer into your question, as it is not an answer, but an update of your question. Please edit your question next time. Use the edit link/button for that.

Also: you keep referring to an Action server, while all your code shows a client.

Asked by gvdhoorn on 2018-04-30 03:36:29 UTC

Thank you. I changed it.

Asked by Krebsileinchen on 2018-04-30 03:46:44 UTC

I still see "action server" at least three times.

Asked by gvdhoorn on 2018-04-30 04:07:44 UTC

Ok. Maybe i misunderstood it. At first I thought I would have to write and action server plus an action client. Now, I am assuming that I only have to write an action client. However one task of that action client is to start the action server (which seems not to work in my case), isn't it?

Asked by Krebsileinchen on 2018-04-30 04:18:03 UTC

However one task of that action client is to start the action server

No. Servers need to be running already for clients to be able to use them. The Franka stack should start the servers. You only write (a) client(s).

Asked by gvdhoorn on 2018-04-30 04:19:29 UTC

Ok. I'll try to change my question accordingly.

Asked by Krebsileinchen on 2018-04-30 04:25:04 UTC

I would also recommend to do the actionlib tutorials and read the wiki page. That should provide you with some more info and background.

Asked by gvdhoorn on 2018-04-30 05:28:22 UTC

re: your deleted comment: waitServer() is there to make sure your client can actually connect to the server. Without the server, your client cannot do anything. waitServer() just provides you with a way to make sure the server has been started and is ready to accept goals (ie: requests).

Asked by gvdhoorn on 2018-04-30 05:29:40 UTC

Thanks.. I already looked through the action lib tutorials and wiki. I tried to follow the tutorial and just adapted it to my case. I Interpret what you wrote in the way that I missed out connecting my client with the server? But comparing my code to the fibonacci example I don't get what's missing.

Asked by Krebsileinchen on 2018-04-30 05:43:40 UTC

Some things to check:

  1. the franka_ros nodes start successfully (can you use any of their examples? Does RViz show your robot? Etc). This would be something to check with Franke Emika themselves
  2. make sure you're using the correct names for action server topics

Especially 2 is important: ..

Asked by gvdhoorn on 2018-04-30 05:46:00 UTC

.. if you're not using the correct names, your clients will wait indefinitely for the action server to come up.

Are you sure panda_Robot is an actual action server?

Asked by gvdhoorn on 2018-04-30 05:46:41 UTC

Thanks. One should be fine. I manipulated the robot previously with moveit. I rather think that 2 is the problem. I tried many opportunities referring to https://frankaemika.github.io/docs/ros_introduction.html . But I never get past the ac.waitForServer();

Asked by Krebsileinchen on 2018-04-30 05:59:44 UTC

I don't see panda_Robot mentioned anywhere in the documentation that you link.

I would suggest to take this up with Franka Emika.

You can get an idea of on-line servers with something like (from #q222748):

rostopic list | grep -o -P '^.*(?=/feedback)'

Asked by gvdhoorn on 2018-04-30 06:05:35 UTC

Thanks for that command. "panda_robot" ist outdated it was from my old version where my own action server had this name. I updated the question. I got "franka_gripper/homing" from the rostopic list. However my problem stays unchanged.

Asked by Krebsileinchen on 2018-04-30 06:17:49 UTC

I don't no what the final error was but after rebooting both my workstation and the robot it is finally working. Thank you so much!

Asked by Krebsileinchen on 2018-04-30 06:48:31 UTC

Answers

franka_gripper is a ROS node that offers action servers. Think of them as designed to be non-blocking long-running services that can be preempted if required. ROS offers topic, services, and actions to communicate between nodes/processes. A good summary can be found here.

So you would need to write a ROS Action Client(in Python/C++) to send a goal to the action servers exposed in franka_gripper. If you are new to ROS I would highly recommend going over the ROS tutorials from 1-16.

If in a hurry go over the tutorials(11, 14 for C++ or 12 -15 for Python) to get a quick look at ROS subscriber/publisher and some basics. Then head over to the actionlib tutorials(beginner) which is exactly what you need to communicate with franka_gripper. You would make changes based on the specification of the action server in franka_gripper.

Asked by robotchicken on 2018-04-27 13:09:33 UTC

Comments