Home | Tutorials | Wiki | Issues
Ask Your Question

How to control different haptix robot arms in gazebo?

asked 2017-04-27 02:32:11 -0600

shin gravatar image

Haptix is a famous project of gazebo, which is to simulate a robot arm. Up to now, I can use environment variables to control different arms as I want. However, I can only control one arm in each time point because the environment variable is unique in each time point. If I want to control two or more arms in the same time, how to do that? I try to use the function hx_connection(...), but I can not find its implementation, so it is difficult for me to use it. Could anyone give me some more ideas? Thank you very much!

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2017-05-01 19:47:14 -0600

Carlos Agüero gravatar image

We use Ignition Transport services for communicating between the HAPTIX client code and Gazebo/real arm. It's not possible to send a single request that reaches multiple services, it's only received by one of the Gazebo instances. There's a slightly different behavior when using the keyboard teleoperation because we're publishing messages that can be received by multiple Gazebo instances. So the behavior that you observe is expected.

If you really want to control more that one arm at the same time you could:

  • Launch Gazebo on a terminal with IGN_PARTITION=gazebo1
  • Open a new terminal, set IGN_PARTITION=gazebo1 . At this point, a controller (controller_1) running here will talk with gazebo1.
  • Launch Gazebo on a terminal with IGN_PARTITION=gazebo2
  • Open a new terminal, set IGN_PARTITION=gazebo2 . At this point, a controller (controller_2) running here will talk with gazebo1.
  • You would need to modify your controllers for accepting (via Ignition Transport, raw sockets, shared memory, or any other IPC mechanism) commands from your master controller. Your controller_1 and controller_2 will receive the command and redirect it to its Gazebo instance.

                       +------------> controller_1 ------------> Gazebo_1
    master_controller  +
                       +------------> controller_2 ------------> Gazebo_2
edit flag offensive delete link more


I have checked the source codes, and I found that the function hx_connection does nothing, just return hxOK, I do not know why. Does it exists some ways to modify this function to implement my request?

shin gravatar imageshin ( 2017-05-01 20:42:30 -0600 )edit

This function exists in the code to be compatible with the Haptix protocol but, as you noticed, our implementation doesn't require it, so it's empty. We use a discovery mechanism for locating the resources that we need. The system is not designed to have multiple Gazebo instances controlled by a single controller at the same time. If you want to do it, you'll need to implement something similar to what I suggested in my answer.

Carlos Agüero gravatar imageCarlos Agüero ( 2017-05-02 19:00:30 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-04-27 02:32:11 -0600

Seen: 73 times

Last updated: May 01 '17