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

Using MoveGroup in different nodes (moveit!)

asked 2015-11-02 06:58:50 -0500

donmrsir gravatar image

Hi!,

Right now im working with a custom robot and moveit!, and what Im trying to do, is to generate some services nodes, and use them to move my robot using moveit!.

The problem is that for optimization reasons, i dont want to have to initialize a MoveGroup in my node services every time i call one of them, as i have to do right now. However i couldnt find any way to send an already defined MoveGroup to another node, and work with it.

So the question is, Is ther anyway to do this? To work with the same defined MoveGroup in different nodes?

Thank you in advance! any help will be welcome :D

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-11-02 08:55:37 -0500

updated 2015-11-03 06:35:25 -0500

There is a solution. Create a class that has a MoveGroup attribute, initialized with the constructor. Moreover you can implement several service functions in that class which are acting on the same move_group attribute.

This is my post and answer related how to do it.

Here is my working example for a cyton gamma 1500 robot arm.

EDIT

If you really want to share objects through applications have a look at this (not really related to ROS but c++).

edit flag offensive delete link more

Comments

Ty for the answer! It looks to me (If i correctly undestood your code/answer), that this not the solution for my problem, since what you get doing that is that the move_group class is defined for all of the services and fuctions in your node

donmrsir gravatar image donmrsir  ( 2015-11-03 05:50:36 -0500 )edit

My problem is that i want to use the same move_group in different nodes . Right now i have to init a new move_group every time i call a new node, that takes a lot of time, also i dont know if this can cause any problems.

donmrsir gravatar image donmrsir  ( 2015-11-03 05:53:52 -0500 )edit

I can't see the reason to have multiple nodes having the same move_group class. I doubt that you can share this object over multiple nodes (source codes c++ or python). Why do you need more than one node to control the arm?

zweistein gravatar image zweistein  ( 2015-11-03 06:19:55 -0500 )edit
1

By using multi-threading in a node, you can have multiple services (service servers) running in parallel. You can even define multiple node handles and run them asynchronously. Hence, you don't need more than one node. An object created in a program is not designed to get shared as a resource.

zweistein gravatar image zweistein  ( 2015-11-03 06:27:26 -0500 )edit

The reason why i needed to use more than one node, was because this way my system would work in a more intuitive way. But yes maybe is better to just use one node with a lot of services for simplicity, i will give it a try.

donmrsir gravatar image donmrsir  ( 2015-11-03 08:15:01 -0500 )edit

Anyway im taking this question as the correct one, since the link you posted seems to me like a good point to start researching about this problem.

donmrsir gravatar image donmrsir  ( 2015-11-03 08:16:28 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2015-11-02 06:58:50 -0500

Seen: 921 times

Last updated: Nov 03 '15