dqrobotics / cpp-interface-vrep

Vrep interface for the dqrobotics in C++
GNU Lesser General Public License v3.0
3 stars 5 forks source link

OP_AUTOMATIC does not work in get_object_translation function with a different second argument #9

Open AndreiCostinescu opened 1 year ago

AndreiCostinescu commented 1 year ago

Bug description The OP_AUTOMATIC flag that is passed by default to the function get_object_translation(const std::string& objectname, const std::string& relative_to_objectname, const OP_MODES& opmode) _(and probably also the get_object_rotation and other similar functions)_ does not work when the second argument is different that the one that was used when the first call to the function happened. Because OP_AUTOMATIC starts an OP_STREAMING operation relative to the first object name, when a different relative object is passed as the second argument, the function will convert the opMode to OP_BUFFER, which breaks the functionality because there is no buffered value relative to the new object name.

To Reproduce Attached is the code I used. issueReplicator.zip

In the main function, please comment line 66, to only run the opMode issue test. The output shows that there is an exception thrown the second time the get_object_pose is called (which internally calls get_object_translation and get_object_rotation).

Expected behavior The expected output would be that the code does not throw an exception and also starts streaming data relative to the new relative object.

Environment:

mmmarinho commented 1 year ago

@AndreiCostinescu Thanks for the report. As I've said in the other issue, I wasn't notified of this.

Interesting behavior, I haven't used relative names that much in CoppeliaSim.

I'll take a look at this when I have the time but you're free to propose a solution as well.

Cheers, Murilo