Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

I'm assuming that you want to use the HAPTIX protocol.

1) How to get the position (x,y,z coordinates) of the arm and the cube with some programming languages, maybe C language ?

The HAPTIX protocol is defined in two header files: haptix.h and haptix_sim.h. haptix_sim.h contains specific simulation aids that are useful for debugging and controlling the arm in simulation only. haptix.h contains the functions for controlling the motors of the arm and accessing its sensors both for simulated and real arms. In your case, you can use haptix_sim.h as you're interested in simulation. The function hxs_sim_info() returns a C struct with all the information that you need: models and their position and orientation in the global world coordinate. This tutorial explains all the functions included in haptix_sim.h.

2) How to control the whole arm with C API ?

As I mentioned before, you can use the functions included in haptix.h. Here's the corresponding tutorial. As you noticed, this will control the motors of the arm in the same way you'd do it with the real arm. If you want to move the entire arm as the keyboard teleoperation is doing, you can use the functions hxs_set_linear_velocity() and hxs_set_angular_velocity() from haptix_sim.h.

Here are all the HAPTIX tutorials in case you need extra help.