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

Send action from Js to Python simple action server rosnodejs

asked 2020-04-15 08:07:39 -0500

kopop8 gravatar image

I have a python simple action server that i run and works with a python simple action client.

actionlib.SimpleActionServer('move_to_beacon_action', proximity.msg.BeaconAction, execute_cb=self.execute_cb, auto_start = False)`

now i want to use javascript to send an action to the python simple action server. I'm using rosnodejs but dont know how how to send an action. right now connecting doesn't work either. I tried to look for examples but none worked.

rosnodejs.initNode('my_node', { onTheFly: true })
.then(() => {
    const proximity = rosnodejs.require('proximity');
    const goal = new proximity.msg.BeaconGoal({ address: 'Hello' });
    const ac = new rosnodejs.SimpleActionClient({
        nh: rosnodejs.nh,
        type: proximity.msg.BeaconAction,
        actionServer: 'move_to_beacon_action'
    });
    ac.waitForServer()
  .then(() => {
    rosnodejs.log.info('Connected to action server!');
  })

This doesnt work however. I get the error:

[INFO] [1586955599.210] (ros): Connected to master at http://192.168.2.10:11311! [ERROR] [1586955599.239] (ros.rosnodejs): Exception trying to advertise topic move_to_beacon_action/goal

Does anyone know how to do this? am i doing something wrong? Is this even possible? I' m a big ROS noob and would love help! Thanks for your time and reading :)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-05-01 10:23:53 -0500

kopop8 gravatar image
  const ac = new rosnodejs.SimpleActionClient({
          nh: rosnodejs.nh,
          // the type puts ActionGoal in the end automatically
          type: 'proximity/Beacon',
          actionServer: '/move_to_beacon_action'
      });

So it puts ActionGoal at the end of proxwaimity/Beacon that was my mistake

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2020-04-15 08:07:39 -0500

Seen: 161 times

Last updated: May 01 '20