I'm trying to get the scripts objects in a tree using the function "getObjectsInTree" using CoppeliaSim v4.7.0-rev0. However, it looks like the function is not working.
(There is a default Panda manipulator on the scene, which includes an object script in "Franka/Script".)
Code: Select all
#include "RemoteAPIClient.h"
#include <iostream>
int main()
{
RemoteAPIClient client;
auto sim = client.getObject().sim();
try
{
sim.startSimulation();
auto handle = sim.getObject("/Franka");
std::vector<int64_t> scripthandles = sim.getObjectsInTree(handle,
sim.appobj_script_type,
0);
std::cout<<"Number of scripts: "<<scripthandles.size()<<std::endl;
sim.stopSimulation();
}
catch (const std::runtime_error& e)
{
std::cerr << "Caught a runtime error: " << e.what() << std::endl;
sim.stopSimulation();
}
return 0;
}
Code: Select all
Number of scripts: 0
Code: Select all
Number of scripts: 1
Best regards,
Juan