The CollisionsSensor device is thought to be used by other Tango Servers before performing a movement. The following example is only useful for showing how the call to the CheckCollision function has to be done.
/* * example of a client using the CollisionsSensor Server */ #include <tango.h> using namespace Tango; main(unsigned int argc, char **argv) { DeviceData dd; DeviceData dout; long flag_collision; // // create a connection to the CollisionsSensor device // DeviceProxy *device = new DeviceProxy( "test/collisionssensor/1"); DevVarDoubleStringArray *in = new DevVarDoubleStringArray(); in->dvalue.length(1); in->dvalue[0] = (double) 23.9; // Position to check in->svalue.length(2); in->svalue[0] = "100"; in->svalue[1] = "test/mot/1"; dd << in; try { dout = device->command_inout("CheckCollision",dd); dout >> flag_collision; if(flag_collision) cout << "Movement not allowed" << endl; } catch(DevFailed &e) { cout << "Error in command_inout" << endl; } }