ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Roslibjs for a client to communicate with simple action Server

asked 2015-02-16 11:17:58 -0500

pexison gravatar image

updated 2018-09-25 09:42:40 -0500

130s gravatar image

Hello, I made a simple action server and client guided by the tutorials, I was able to make everything work. I wanted to take one step more and try to make the action client using roslibjs, then this Error came up:

[INFO] [WallTime: 1424105276.754999] Client connected.  1 clients total.
[ERROR] [WallTime: 1424105276.766179] [Client 0] [id: advertise:/control/goal:1] advertise: gamma/src/control/ControlActionGoal is not a valid type string
[INFO] [WallTime: 1424105276.921603] [Client 0] Subscribed to /control/status
[ERROR] [WallTime: 1424105276.925383] [Client 0] [id: subscribe:/control/feedback:4] subscribe: gamma/src/control/ControlActionFeedback is not a valid type string
[ERROR] [WallTime: 1424105276.930062] [Client 0] [id: subscribe:/control/result:5] subscribe: gamma/src/control/ControlActionResult is not a valid type string

I think that this Error is associated to the actionName field when ROSLIB.ActionClient is called. The route to the .action file is: ~/Desktop/gamma/src/control/Control.action

The html file with the client is here:

<!DOCTYPE html>                                                                
  <title> Control client </title>                                                              
  <meta charset="utf-8"/>
  <script type="text/javascript" src=""></script>
  <script type="text/javascript" src=""></script>

  <script type="text/javascript" type="text/javascript">

  //connect to ROS
  var ros = new ROSLIB.Ros({ url: 'ws://localhost:9090' });

  //emit the error on the backend if exist
  ros.on('error', function(error) {
    document.getElementById('connecting').style.display = 'none';
    document.getElementById('connected').style.display = 'none';
    document.getElementById('closed').style.display = 'none';
    document.getElementById('error').style.display = 'inline';

  // Find out exactly when we made a connection.
  ros.on('connection', function() {
    console.log('Connection made!');
    document.getElementById('connecting').style.display = 'none';
    document.getElementById('error').style.display = 'none';
    document.getElementById('closed').style.display = 'none';
    document.getElementById('connected').style.display = 'inline';

  ros.on('close', function() {
    console.log('Connection closed.');
    document.getElementById('connecting').style.display = 'none';
    document.getElementById('connected').style.display = 'none';
    document.getElementById('closed').style.display = 'inline';

  //Action Client

  // Conect to the server on charge of the mobile control of the turtlebot                     
  var controlClient = new ROSLIB.ActionClient({                                                
    ros : ros,
    serverName: '/control',
    actionName: 'gamma/src/control/ControlAction'                                      

  //Created function to move foward the turtlebot                                              
  function pubMessage() {
    //Create the variable that will be associated to the goal                                  
    var twist = new ROSLIB.Message ({                                                          
      linear : {                                                                               
        x : 0.1,                                                                               
        y : 0.0,                                                                               
        z : 0.0 
      angular : { 
        x : 0.0,                                                                               
        y : 0.0, 
        z : 0.0
   //Create the goal
    var goal = new ROSLIB.Goal({
      actionClient : controlClient,
      goalMessage : twist 

    //Send the goal to the server to execute the callbacks
    console.log("Goal sent forward");
    return true;



  <div id="statusIndicator">
    <p id="connecting">
      Connecting to rosbridge...
    <p id="connected" style="color:#00D600; display:none">
    <p id="error" style="color:#FF0000; display:none">
      Error in the backend!
    <p id="closed" style="display:none">
      Connection closed.

  <div> <button id="forward" type="action" onclick="pubMessage()">Forward</button> </div>


The error is reported in the rosbridge terminal ... (more)

edit retag flag offensive close merge delete


Is your action server set up correctly? That is, are you able to call the action natively in ROS?

rtoris288 gravatar image rtoris288  ( 2015-02-17 07:36:58 -0500 )edit

yes, the action server is working and I am able to call the action natively in ROS (I did it changing the Tutorials)

pexison gravatar image pexison  ( 2015-02-17 08:14:40 -0500 )edit

Is there a specific folder that the HTML file needs to be saved ? Don't get me wrong, I am not very familiar with ROS. Usually I use a web server , which there is a folder to place it. When I am running the server so I will be able to call the HTML via localhost as an example.

Johan gravatar image Johan  ( 2015-03-21 09:11:14 -0500 )edit

The HTML can be hosted anywhere, it is independent of the ROS system. The client will make a connection to ROS via rosbridge over websockets.

rtoris288 gravatar image rtoris288  ( 2015-03-23 10:14:46 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-02-17 00:58:54 -0500

jbinney gravatar image

The actionName won't be a path.. I think it will be just the root name of the action type; in this place "Control", or if that isn't unique then the package_name/action_name (control/Control). Then rosbridge will have to find that action. So make sure that the control package is built, and you've sourced the devel/setup.bash in the workspace where you built it before you run rosbridge. If you need help building your ros workspace, see this tutorial:

edit flag offensive delete link more


Already sourced, and the problem continue. I tried your sugesstion but that made a Unable to load the manifest for package control error, I have modified my qustion

pexison gravatar image pexison  ( 2015-02-17 02:36:51 -0500 )edit

What is the actual package name and is the package.xml file defined correctly? Can you post it somewhere?

rtoris288 gravatar image rtoris288  ( 2015-02-17 07:25:32 -0500 )edit

Question Tools

1 follower


Asked: 2015-02-16 11:17:58 -0500

Seen: 2,012 times

Last updated: Sep 25 '18