Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a Kinbody after an environment has been loaded by cartesianserver or testravebot. #33

Closed
serna92 opened this issue May 19, 2017 · 5 comments
Assignees

Comments

@serna92
Copy link
Contributor

serna92 commented May 19, 2017

Hello,

I need to add an object depending on the task I want to simulate with the robot asibot.

As you can see the environment and the objects that I use are in different files:

Another possible solution is to have 3 environment (1 per implemented task) and launch cartesianserver / testravebot with one of these environments as argument. In that case, how can I launch them inside a python file instead of command line?

Thanks and sorry by the inconveniences.

@jgvictores
Copy link
Member

"Adding a Kinbody after an environment has been loaded by cartesianserver or testravebot" would be implemented in a WorldRpcResponder plugin that should be ported/created as part of roboticslab-uc3m/openrave-yarp-plugins#27

@jgvictores
Copy link
Member

PS: You could actually implement that as part of the current WorldRpcResponder.cpp as part of the mk command.

@serna92
Copy link
Contributor Author

serna92 commented May 19, 2017

I added this in mk command on WorldRpcResponder:

            } else if (in.get(2).asString() == "obj") {
                { // lock the environment!           
                OpenRAVE::EnvironmentMutex::scoped_lock lock(pEnv->GetMutex());
                KinBodyPtr objKinBodyPtr = RaveCreateKinBody(pEnv,"");
                pEnv->ReadKinBodyXMLFile(objKinBodyPtr, in.get(3).asString().c_str());
                pEnv->Add(objKinBodyPtr,true);
                }  // the environment is not locked anymore
                out.addVocab(VOCAB_OK);

and after reinstall asibot-main again and execute this in my python script it worked as expected:

cmd3 = yarp.Bottle()

   cmd3.addString('world')
   cmd3.addString('mk')
   cmd3.addString('obj')
   cmd3.addString('AsibotSimulation/entornoAsibot/redCan.kinbody.xml')

   rpc.write(cmd3, res)

Should it be commited?

@jgvictores
Copy link
Member

Should it be commited?

Yes, that looks good (you should always commit, see https://github.com/roboticslab-uc3m/best-practices!).

Please commit the lines of each file on branches (or branch of fork if you do not have permissions) to later create Pull Request(s) (PR) or merge directly if functional across PCs.

@PeterBowman
Copy link
Member

Looks like #34 solved this, feel free to re-open if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants