Quantcast

IK run from multiple threads simultaneously seg faults

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

IK run from multiple threads simultaneously seg faults

Evan Herbst
Rosen/all:

I create a bunch of extra environments for IK, but I can't use more than one without getting a seg fault. Partial code below. Any advice?

Thanks.

- Evan

---------------------------
std::vector<OpenRAVE::EnvironmentBasePtr> raveEnvCopies;
for(size_t i = 0; i < numThreads; i++)
{
    raveEnvCopies[i] = env->CloneSelf(OpenRAVE::Clone_Bodies);
}

...

vector<...> poses; //want to run IK for all of these

const size_t numThreads = 1;//raveEnvCopies.size(); //works fine with 1 thread; TODO haven't gotten it to not seg fault when using multiple threads here -- ??
for(size_t m = 0; m < numThreads; m++)
    createThread([m]()
        {
                OpenRAVE::RobotBasePtr robot = raveEnvCopies[m]->GetRobot(robotCamHandler->getRobotName());
                OpenRAVE::RobotBase::ManipulatorPtr manip = robot->GetActiveManipulator();
                for(size_t i = m; i < poses.size(); i += numThreads)
                {
                        const OpenRAVE::IkParameterization ikTgtXform(poses[i], OpenRAVE::IKP_Transform6D);
                        vector<OpenRAVE::dReal> soln;
                  {
                // OpenRAVE::EnvironmentMutex::scoped_lock lock(raveEnvCopies[m]->GetMutex()); // lock environment; I think unnecessary if we use envs we don't also use for anything else
                        manip->FindIKSolution(ikTgtXform, soln, 0);
                  }

                }
        });

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Loading...