0
$\begingroup$

Rosanswers logo

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


Originally posted by donmrsir on ROS Answers with karma: 363 on 2015-11-02

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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++).


Originally posted by zweistein with karma: 231 on 2015-11-02

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by donmrsir on 2015-11-03:
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

Comment by donmrsir on 2015-11-03:
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.

Comment by zweistein on 2015-11-03:
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?

Comment by zweistein on 2015-11-03:
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.

Comment by donmrsir on 2015-11-03:
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.

Comment by donmrsir on 2015-11-03:
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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.