Inter-plugin communication

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Inter-plugin communication

Tobias Kunz
Dear Rosen,

I want to write an openrave plugin that makes use of the functionality
provided by the basemanipulation plugin. However, it seems like the only
way to interact with the basemanipulation plugin is through sending
string commands.

Different plugins communicating through string commands instead of just
calling a function does not seem right to me and I am wondering whether
I am doing something wrong.

Is the basemanipulation plugin (or ProblemInstance plugins in general)
supposed to be called by other plugins? How can I avoid writing a lot of
code for serializing and deserializing parameters when calling other
plugins?

Thanks,
Tobias

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

Re: Inter-plugin communication

Rosen Diankov
Administrator
hi tobias,

This is an excellent question!

First, can you offer a better solution?

In the C++ world, calling a function means you need to know its
prototype, which means you need to know he existence of the other
plugin and its exact functions when writing/compiling your own plugin.
If BaseManipulation had publicly exposed C++ methods for its planning
techniques, it would break the design.

With serialization, you even gain the ability to call the commands
through the network, or pass them across languages (for example, the
python interfaces.BaseManipulation class).

If you really must pass pointers for large amounts of data, then you
can always overload the istream class, it doesn't always have to be a
string.

rosen,



2010/11/11 Tobias Kunz <[hidden email]>:

> Dear Rosen,
>
> I want to write an openrave plugin that makes use of the functionality
> provided by the basemanipulation plugin. However, it seems like the only
> way to interact with the basemanipulation plugin is through sending
> string commands.
>
> Different plugins communicating through string commands instead of just
> calling a function does not seem right to me and I am wondering whether
> I am doing something wrong.
>
> Is the basemanipulation plugin (or ProblemInstance plugins in general)
> supposed to be called by other plugins? How can I avoid writing a lot of
> code for serializing and deserializing parameters when calling other
> plugins?
>
> Thanks,
> Tobias
>
> ------------------------------------------------------------------------------
> Centralized Desktop Delivery: Dell and VMware Reference Architecture
> Simplifying enterprise desktop deployment and management using
> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
> client virtualization framework. Read more!
> http://p.sf.net/sfu/dell-eql-dev2dev
> _______________________________________________
> Openrave-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openrave-users
>

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

Re: Inter-plugin communication

Mike Stilman
Rosen,

hmm - I think what Tobias is asking is specifically related to the
benefit/drawbacks of using OpenRave given that the user is a pure C/C++
programmer.

>From what you say, the only way to interact with the provided codebase is
by formatting strings. However, suppose one wants to get access to a lower
level of the plan (such as the time it took to compute it, the objects
the planner collided with while it was planning etc. etc.) - then one
would have to first add such functionality to the BaseManipulation
(class/plugin) then add a function that gets it, then add a serializer
that turns into a string, then add a parser that gets it out and finally
create one's own plugin that uses it. Is that right?

This is not much different than generating a function prototype in C++.
However, you actually have to do it twice and the serializer/parser is
actually significantly more difficult to write than a function header.

The difficulty we're having is that the serialization/parsing may be the
most time consuming element of the entire process. Not only in terms of
computation time - but (more importantly) implementation time.

Due to this, it appears that the only advantage to the design of OpenRave
is that it supports multiple languages and network operation. If the user
was to purely program in C++ on a single computer then it seems like Rave
requires a lot of extra work that would not be necessary without it. Could
you let us know if there are easier ways of interacting with OpenRave
functionality or is this a fundamental limitation due to the goal of
maintaining generality?

Thanks,

Mike


On Fri, 12 Nov 2010, Rosen Diankov wrote:

> hi tobias,
>
> This is an excellent question!
>
> First, can you offer a better solution?
>
> In the C++ world, calling a function means you need to know its
> prototype, which means you need to know he existence of the other
> plugin and its exact functions when writing/compiling your own plugin.
> If BaseManipulation had publicly exposed C++ methods for its planning
> techniques, it would break the design.
>
> With serialization, you even gain the ability to call the commands
> through the network, or pass them across languages (for example, the
> python interfaces.BaseManipulation class).
>
> If you really must pass pointers for large amounts of data, then you
> can always overload the istream class, it doesn't always have to be a
> string.
>
> rosen,
>
>
>
> 2010/11/11 Tobias Kunz <[hidden email]>:
>> Dear Rosen,
>>
>> I want to write an openrave plugin that makes use of the functionality
>> provided by the basemanipulation plugin. However, it seems like the only
>> way to interact with the basemanipulation plugin is through sending
>> string commands.
>>
>> Different plugins communicating through string commands instead of just
>> calling a function does not seem right to me and I am wondering whether
>> I am doing something wrong.
>>
>> Is the basemanipulation plugin (or ProblemInstance plugins in general)
>> supposed to be called by other plugins? How can I avoid writing a lot of
>> code for serializing and deserializing parameters when calling other
>> plugins?
>>
>> Thanks,
>> Tobias
>>
>> ------------------------------------------------------------------------------
>> Centralized Desktop Delivery: Dell and VMware Reference Architecture
>> Simplifying enterprise desktop deployment and management using
>> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
>> client virtualization framework. Read more!
>> http://p.sf.net/sfu/dell-eql-dev2dev
>> _______________________________________________
>> Openrave-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/openrave-users
>>
>

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

Re: Inter-plugin communication

Rosen Diankov
Administrator
hi mike,

The basemanipulation plugin is there to show off how planners get
initialized and used. It has a very simple string command interface.
If you would like to get custom information from a plan, there are
three recommended ways:

1.

implement the SendCommand function in your planner. Once a user has
the planner pointer, they can just call planner->SendCommand and get
their desired output. For example, getting a list of doubles from a
planner involves the following C++ code from the user side:

#include <sstream>
#include <iostream>

stringstream command("get_my_reals"), output;
planner->SendCommand(output,command);
vector<dReal> v = vector<dReal>((istream_iterator<dReal>(output)),
istream_iterator<dReal>());

This requires all your classes to support
serialization/deserialization methods. In my opinion, this is
something necessary anyway for writing logs..

2.

Instead of send command, you can send a pointer to a std::ostream
object into the PlannerBase::PlanPath function. For example:

boost::shared_ptr<stringstream> output(new stringstream());
planner->PlanPath(ptraj, output);

This has the advantage of recording statistics only for the current plan.

3.

You can set your own user data into the planner, the planner will then
record everything in that class. For example:

class A{
 vector<int> mydata;
};

boost::shared_ptr<A> a(new A());
planner->SetUserData(a);

Internally in the planner you can use:
boost::shared_ptr<A> a = boost::static_pointer_cast<A> (GetUserData());

to get your class pointer back.

This is by far the simplest method to implement, but it means that
users who want to use the data need to know what A is.

hope this helps,
rosen,


2010/11/12 Mike Stilman <[hidden email]>:

> Rosen,
>
> hmm - I think what Tobias is asking is specifically related to the
> benefit/drawbacks of using OpenRave given that the user is a pure C/C++
> programmer.
>
> From what you say, the only way to interact with the provided codebase is by
> formatting strings. However, suppose one wants to get access to a lower
> level of the plan (such as the time it took to compute it, the objects the
> planner collided with while it was planning etc. etc.) - then one would have
> to first add such functionality to the BaseManipulation (class/plugin) then
> add a function that gets it, then add a serializer that turns into a string,
> then add a parser that gets it out and finally create one's own plugin that
> uses it. Is that right?
>
> This is not much different than generating a function prototype in C++.
> However, you actually have to do it twice and the serializer/parser is
> actually significantly more difficult to write than a function header.
>
> The difficulty we're having is that the serialization/parsing may be the
> most time consuming element of the entire process. Not only in terms of
> computation time - but (more importantly) implementation time.
>
> Due to this, it appears that the only advantage to the design of OpenRave is
> that it supports multiple languages and network operation. If the user was
> to purely program in C++ on a single computer then it seems like Rave
> requires a lot of extra work that would not be necessary without it. Could
> you let us know if there are easier ways of interacting with OpenRave
> functionality or is this a fundamental limitation due to the goal of
> maintaining generality?
>
> Thanks,
>
> Mike
>
>
> On Fri, 12 Nov 2010, Rosen Diankov wrote:
>
>> hi tobias,
>>
>> This is an excellent question!
>>
>> First, can you offer a better solution?
>>
>> In the C++ world, calling a function means you need to know its
>> prototype, which means you need to know he existence of the other
>> plugin and its exact functions when writing/compiling your own plugin.
>> If BaseManipulation had publicly exposed C++ methods for its planning
>> techniques, it would break the design.
>>
>> With serialization, you even gain the ability to call the commands
>> through the network, or pass them across languages (for example, the
>> python interfaces.BaseManipulation class).
>>
>> If you really must pass pointers for large amounts of data, then you
>> can always overload the istream class, it doesn't always have to be a
>> string.
>>
>> rosen,
>>
>>
>>
>> 2010/11/11 Tobias Kunz <[hidden email]>:
>>>
>>> Dear Rosen,
>>>
>>> I want to write an openrave plugin that makes use of the functionality
>>> provided by the basemanipulation plugin. However, it seems like the only
>>> way to interact with the basemanipulation plugin is through sending
>>> string commands.
>>>
>>> Different plugins communicating through string commands instead of just
>>> calling a function does not seem right to me and I am wondering whether
>>> I am doing something wrong.
>>>
>>> Is the basemanipulation plugin (or ProblemInstance plugins in general)
>>> supposed to be called by other plugins? How can I avoid writing a lot of
>>> code for serializing and deserializing parameters when calling other
>>> plugins?
>>>
>>> Thanks,
>>> Tobias
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Centralized Desktop Delivery: Dell and VMware Reference Architecture
>>> Simplifying enterprise desktop deployment and management using
>>> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
>>> client virtualization framework. Read more!
>>> http://p.sf.net/sfu/dell-eql-dev2dev
>>> _______________________________________________
>>> Openrave-users mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/openrave-users
>>>
>>
>

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

Re: Inter-plugin communication

Rosen Diankov
Administrator
Hi Mike,

I forgot to mention that all 3 methods imply that you generate your
copy the code you are interested from basemanipulation and generate
your own PlannerParameters structures.

The PlannerParameters structure itself can be derived in a
interoperable way to give a planner custom parameters that other
parameters can interpret. You can find several samples of custom
parameters in the rmanipulation/commonmanipluation.h file. This is
what allows the basemanipulation planner to pass custom commands to
the grasper planner without really knowing what structures the grasper
planner is using (obviously parameter names are agreed upon).

rosen,

2010/11/12 Rosen Diankov <[hidden email]>:

> hi mike,
>
> The basemanipulation plugin is there to show off how planners get
> initialized and used. It has a very simple string command interface.
> If you would like to get custom information from a plan, there are
> three recommended ways:
>
> 1.
>
> implement the SendCommand function in your planner. Once a user has
> the planner pointer, they can just call planner->SendCommand and get
> their desired output. For example, getting a list of doubles from a
> planner involves the following C++ code from the user side:
>
> #include <sstream>
> #include <iostream>
>
> stringstream command("get_my_reals"), output;
> planner->SendCommand(output,command);
> vector<dReal> v = vector<dReal>((istream_iterator<dReal>(output)),
> istream_iterator<dReal>());
>
> This requires all your classes to support
> serialization/deserialization methods. In my opinion, this is
> something necessary anyway for writing logs..
>
> 2.
>
> Instead of send command, you can send a pointer to a std::ostream
> object into the PlannerBase::PlanPath function. For example:
>
> boost::shared_ptr<stringstream> output(new stringstream());
> planner->PlanPath(ptraj, output);
>
> This has the advantage of recording statistics only for the current plan.
>
> 3.
>
> You can set your own user data into the planner, the planner will then
> record everything in that class. For example:
>
> class A{
>  vector<int> mydata;
> };
>
> boost::shared_ptr<A> a(new A());
> planner->SetUserData(a);
>
> Internally in the planner you can use:
> boost::shared_ptr<A> a = boost::static_pointer_cast<A> (GetUserData());
>
> to get your class pointer back.
>
> This is by far the simplest method to implement, but it means that
> users who want to use the data need to know what A is.
>
> hope this helps,
> rosen,
>
>
> 2010/11/12 Mike Stilman <[hidden email]>:
>> Rosen,
>>
>> hmm - I think what Tobias is asking is specifically related to the
>> benefit/drawbacks of using OpenRave given that the user is a pure C/C++
>> programmer.
>>
>> From what you say, the only way to interact with the provided codebase is by
>> formatting strings. However, suppose one wants to get access to a lower
>> level of the plan (such as the time it took to compute it, the objects the
>> planner collided with while it was planning etc. etc.) - then one would have
>> to first add such functionality to the BaseManipulation (class/plugin) then
>> add a function that gets it, then add a serializer that turns into a string,
>> then add a parser that gets it out and finally create one's own plugin that
>> uses it. Is that right?
>>
>> This is not much different than generating a function prototype in C++.
>> However, you actually have to do it twice and the serializer/parser is
>> actually significantly more difficult to write than a function header.
>>
>> The difficulty we're having is that the serialization/parsing may be the
>> most time consuming element of the entire process. Not only in terms of
>> computation time - but (more importantly) implementation time.
>>
>> Due to this, it appears that the only advantage to the design of OpenRave is
>> that it supports multiple languages and network operation. If the user was
>> to purely program in C++ on a single computer then it seems like Rave
>> requires a lot of extra work that would not be necessary without it. Could
>> you let us know if there are easier ways of interacting with OpenRave
>> functionality or is this a fundamental limitation due to the goal of
>> maintaining generality?
>>
>> Thanks,
>>
>> Mike
>>
>>
>> On Fri, 12 Nov 2010, Rosen Diankov wrote:
>>
>>> hi tobias,
>>>
>>> This is an excellent question!
>>>
>>> First, can you offer a better solution?
>>>
>>> In the C++ world, calling a function means you need to know its
>>> prototype, which means you need to know he existence of the other
>>> plugin and its exact functions when writing/compiling your own plugin.
>>> If BaseManipulation had publicly exposed C++ methods for its planning
>>> techniques, it would break the design.
>>>
>>> With serialization, you even gain the ability to call the commands
>>> through the network, or pass them across languages (for example, the
>>> python interfaces.BaseManipulation class).
>>>
>>> If you really must pass pointers for large amounts of data, then you
>>> can always overload the istream class, it doesn't always have to be a
>>> string.
>>>
>>> rosen,
>>>
>>>
>>>
>>> 2010/11/11 Tobias Kunz <[hidden email]>:
>>>>
>>>> Dear Rosen,
>>>>
>>>> I want to write an openrave plugin that makes use of the functionality
>>>> provided by the basemanipulation plugin. However, it seems like the only
>>>> way to interact with the basemanipulation plugin is through sending
>>>> string commands.
>>>>
>>>> Different plugins communicating through string commands instead of just
>>>> calling a function does not seem right to me and I am wondering whether
>>>> I am doing something wrong.
>>>>
>>>> Is the basemanipulation plugin (or ProblemInstance plugins in general)
>>>> supposed to be called by other plugins? How can I avoid writing a lot of
>>>> code for serializing and deserializing parameters when calling other
>>>> plugins?
>>>>
>>>> Thanks,
>>>> Tobias
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Centralized Desktop Delivery: Dell and VMware Reference Architecture
>>>> Simplifying enterprise desktop deployment and management using
>>>> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
>>>> client virtualization framework. Read more!
>>>> http://p.sf.net/sfu/dell-eql-dev2dev
>>>> _______________________________________________
>>>> Openrave-users mailing list
>>>> [hidden email]
>>>> https://lists.sourceforge.net/lists/listinfo/openrave-users
>>>>
>>>
>>
>

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

GetEnvironmentName

Daniel Leidner-2
Hi Rosen,

is there a way to get the name of the current loaded environmentname?

Daniel

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

Re: GetEnvironmentName

Rosen Diankov
Administrator
hi daniel,

That is an excellent question.

First, environments do not have names, but they can have unique ids.
Although each environment gets registered with the openrave runtime,
there is no mechanism to query the environment's unique id yet. We
could definitely add this if you think it is necessary.

Otherwise, you can use the raw pointer for an id. Recently a
RaveGetEnvironments function was added that will return all the
registered environments. Given the raw pointer of an environment, you
can always get check the current loaded environments. This can be done
without dereferencing the pointer, so it is safe.

What do you think?
rosen,

2010/11/12 Daniel Leidner <[hidden email]>:

> Hi Rosen,
>
> is there a way to get the name of the current loaded environmentname?
>
> Daniel
>
> ------------------------------------------------------------------------------
> Centralized Desktop Delivery: Dell and VMware Reference Architecture
> Simplifying enterprise desktop deployment and management using
> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
> client virtualization framework. Read more!
> http://p.sf.net/sfu/dell-eql-dev2dev
> _______________________________________________
> Openrave-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openrave-users
>

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

Re: GetEnvironmentName

Rosen Diankov
Administrator
Hi Daniel,

Creating such a method would be very difficult to get right since
multiple scenes can be loaded, or objects added. Therefore the
environment will rarely reflect what it was initialized with.

Currently we've been trying to store the resource name for interfaces
(ie InterfaceBase::GetXMLFilename), and that is proving to be a
challenge.

Anyway, it seems like you are looking for a way to differentiate your
environments. How about we add SetUserData/GetUserData functions?

rosen,

2010/11/12 Daniel Leidner <[hidden email]>:

> Hi Rosen,
>
> seems like we have a little misunderstanding here because i was not
> clear enough.
> what i want to have is the name of the xml file loaded to the
> viewer/openrave.
> i have multiple instances of rave running (c++) and i want to
> synchronize them.
> therefore they first have to now what file was loaded initially.
> is it possible to get that "lab1.env.xml" name somehow?
>
> daniel
>
> Rosen Diankov wrote:
>> hi daniel,
>>
>> That is an excellent question.
>>
>> First, environments do not have names, but they can have unique ids.
>> Although each environment gets registered with the openrave runtime,
>> there is no mechanism to query the environment's unique id yet. We
>> could definitely add this if you think it is necessary.
>>
>> Otherwise, you can use the raw pointer for an id. Recently a
>> RaveGetEnvironments function was added that will return all the
>> registered environments. Given the raw pointer of an environment, you
>> can always get check the current loaded environments. This can be done
>> without dereferencing the pointer, so it is safe.
>>
>> What do you think?
>> rosen,
>>
>> 2010/11/12 Daniel Leidner <[hidden email]>:
>>
>>> Hi Rosen,
>>>
>>> is there a way to get the name of the current loaded environmentname?
>>>
>>> Daniel
>>>
>>> ------------------------------------------------------------------------------
>>> Centralized Desktop Delivery: Dell and VMware Reference Architecture
>>> Simplifying enterprise desktop deployment and management using
>>> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
>>> client virtualization framework. Read more!
>>> http://p.sf.net/sfu/dell-eql-dev2dev
>>> _______________________________________________
>>> Openrave-users mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/openrave-users
>>>
>>>
>
>

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

Re: GetEnvironmentName

Daniel Leidner-2
hi Rosen,

You are right, its not easy to deal with that, but i want to add the
ability to and and remove objects later on...
at least those who have an xml file, objects which where created from
points is another thing... But im on it ;-)

Anyway, i think SetUserData and GetUserData will satisfy my needs. I
could just save the name in the beginning and then load it later.
But there should be a python binding for it, so i can save the name on
starting my python script and load it with my plugin.

Daniel

Rosen Diankov wrote:

> Hi Daniel,
>
> Creating such a method would be very difficult to get right since
> multiple scenes can be loaded, or objects added. Therefore the
> environment will rarely reflect what it was initialized with.
>
> Currently we've been trying to store the resource name for interfaces
> (ie InterfaceBase::GetXMLFilename), and that is proving to be a
> challenge.
>
> Anyway, it seems like you are looking for a way to differentiate your
> environments. How about we add SetUserData/GetUserData functions?
>
> rosen,
>
> 2010/11/12 Daniel Leidner <[hidden email]>:
>  
>> Hi Rosen,
>>
>> seems like we have a little misunderstanding here because i was not
>> clear enough.
>> what i want to have is the name of the xml file loaded to the
>> viewer/openrave.
>> i have multiple instances of rave running (c++) and i want to
>> synchronize them.
>> therefore they first have to now what file was loaded initially.
>> is it possible to get that "lab1.env.xml" name somehow?
>>
>> daniel
>>
>> Rosen Diankov wrote:
>>    
>>> hi daniel,
>>>
>>> That is an excellent question.
>>>
>>> First, environments do not have names, but they can have unique ids.
>>> Although each environment gets registered with the openrave runtime,
>>> there is no mechanism to query the environment's unique id yet. We
>>> could definitely add this if you think it is necessary.
>>>
>>> Otherwise, you can use the raw pointer for an id. Recently a
>>> RaveGetEnvironments function was added that will return all the
>>> registered environments. Given the raw pointer of an environment, you
>>> can always get check the current loaded environments. This can be done
>>> without dereferencing the pointer, so it is safe.
>>>
>>> What do you think?
>>> rosen,
>>>
>>> 2010/11/12 Daniel Leidner <[hidden email]>:
>>>
>>>      
>>>> Hi Rosen,
>>>>
>>>> is there a way to get the name of the current loaded environmentname?
>>>>
>>>> Daniel
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Centralized Desktop Delivery: Dell and VMware Reference Architecture
>>>> Simplifying enterprise desktop deployment and management using
>>>> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
>>>> client virtualization framework. Read more!
>>>> http://p.sf.net/sfu/dell-eql-dev2dev
>>>> _______________________________________________
>>>> Openrave-users mailing list
>>>> [hidden email]
>>>> https://lists.sourceforge.net/lists/listinfo/openrave-users
>>>>
>>>>
>>>>        
>>    


------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

Re: GetEnvironmentName

Rosen Diankov
Administrator
Hi Daniel,

Ok, added (r1835).

In order to support storing python objects as C++ user data, the
openrave user data semantics had to change a little. Now there is a
dummy UserData class, and SetUserData takes
boost::shared_ptr<UserData>.  These changes apply to InterfaceBase and
EnvironmentBase. Theoretically, old code using
InterfaceBase::SetUserData(boost::shared_ptr<void>) should still work
since C++ will do the type cast intrinsically.

rosen,

2010/11/12 Daniel Leidner <[hidden email]>:

> hi Rosen,
>
> You are right, its not easy to deal with that, but i want to add the
> ability to and and remove objects later on...
> at least those who have an xml file, objects which where created from
> points is another thing... But im on it ;-)
>
> Anyway, i think SetUserData and GetUserData will satisfy my needs. I
> could just save the name in the beginning and then load it later.
> But there should be a python binding for it, so i can save the name on
> starting my python script and load it with my plugin.
>
> Daniel
>
> Rosen Diankov wrote:
>> Hi Daniel,
>>
>> Creating such a method would be very difficult to get right since
>> multiple scenes can be loaded, or objects added. Therefore the
>> environment will rarely reflect what it was initialized with.
>>
>> Currently we've been trying to store the resource name for interfaces
>> (ie InterfaceBase::GetXMLFilename), and that is proving to be a
>> challenge.
>>
>> Anyway, it seems like you are looking for a way to differentiate your
>> environments. How about we add SetUserData/GetUserData functions?
>>
>> rosen,
>>
>> 2010/11/12 Daniel Leidner <[hidden email]>:
>>
>>> Hi Rosen,
>>>
>>> seems like we have a little misunderstanding here because i was not
>>> clear enough.
>>> what i want to have is the name of the xml file loaded to the
>>> viewer/openrave.
>>> i have multiple instances of rave running (c++) and i want to
>>> synchronize them.
>>> therefore they first have to now what file was loaded initially.
>>> is it possible to get that "lab1.env.xml" name somehow?
>>>
>>> daniel
>>>
>>> Rosen Diankov wrote:
>>>
>>>> hi daniel,
>>>>
>>>> That is an excellent question.
>>>>
>>>> First, environments do not have names, but they can have unique ids.
>>>> Although each environment gets registered with the openrave runtime,
>>>> there is no mechanism to query the environment's unique id yet. We
>>>> could definitely add this if you think it is necessary.
>>>>
>>>> Otherwise, you can use the raw pointer for an id. Recently a
>>>> RaveGetEnvironments function was added that will return all the
>>>> registered environments. Given the raw pointer of an environment, you
>>>> can always get check the current loaded environments. This can be done
>>>> without dereferencing the pointer, so it is safe.
>>>>
>>>> What do you think?
>>>> rosen,
>>>>
>>>> 2010/11/12 Daniel Leidner <[hidden email]>:
>>>>
>>>>
>>>>> Hi Rosen,
>>>>>
>>>>> is there a way to get the name of the current loaded environmentname?
>>>>>
>>>>> Daniel
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Centralized Desktop Delivery: Dell and VMware Reference Architecture
>>>>> Simplifying enterprise desktop deployment and management using
>>>>> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
>>>>> client virtualization framework. Read more!
>>>>> http://p.sf.net/sfu/dell-eql-dev2dev
>>>>> _______________________________________________
>>>>> Openrave-users mailing list
>>>>> [hidden email]
>>>>> https://lists.sourceforge.net/lists/listinfo/openrave-users
>>>>>
>>>>>
>>>>>
>>>
>
>
> ------------------------------------------------------------------------------
> Centralized Desktop Delivery: Dell and VMware Reference Architecture
> Simplifying enterprise desktop deployment and management using
> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
> client virtualization framework. Read more!
> http://p.sf.net/sfu/dell-eql-dev2dev
> _______________________________________________
> Openrave-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openrave-users
>

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

Re: Inter-plugin communication

Mike Stilman
In reply to this post by Rosen Diankov
Hey Rosen,

I see. That helps me understand it a lot better! Thank you very much for
the info and the quick response!

Mike


On Fri, 12 Nov 2010, Rosen Diankov wrote:

> Hi Mike,
>
> I forgot to mention that all 3 methods imply that you generate your
> copy the code you are interested from basemanipulation and generate
> your own PlannerParameters structures.
>
> The PlannerParameters structure itself can be derived in a
> interoperable way to give a planner custom parameters that other
> parameters can interpret. You can find several samples of custom
> parameters in the rmanipulation/commonmanipluation.h file. This is
> what allows the basemanipulation planner to pass custom commands to
> the grasper planner without really knowing what structures the grasper
> planner is using (obviously parameter names are agreed upon).
>
> rosen,
>
> 2010/11/12 Rosen Diankov <[hidden email]>:
>> hi mike,
>>
>> The basemanipulation plugin is there to show off how planners get
>> initialized and used. It has a very simple string command interface.
>> If you would like to get custom information from a plan, there are
>> three recommended ways:
>>
>> 1.
>>
>> implement the SendCommand function in your planner. Once a user has
>> the planner pointer, they can just call planner->SendCommand and get
>> their desired output. For example, getting a list of doubles from a
>> planner involves the following C++ code from the user side:
>>
>> #include <sstream>
>> #include <iostream>
>>
>> stringstream command("get_my_reals"), output;
>> planner->SendCommand(output,command);
>> vector<dReal> v = vector<dReal>((istream_iterator<dReal>(output)),
>> istream_iterator<dReal>());
>>
>> This requires all your classes to support
>> serialization/deserialization methods. In my opinion, this is
>> something necessary anyway for writing logs..
>>
>> 2.
>>
>> Instead of send command, you can send a pointer to a std::ostream
>> object into the PlannerBase::PlanPath function. For example:
>>
>> boost::shared_ptr<stringstream> output(new stringstream());
>> planner->PlanPath(ptraj, output);
>>
>> This has the advantage of recording statistics only for the current plan.
>>
>> 3.
>>
>> You can set your own user data into the planner, the planner will then
>> record everything in that class. For example:
>>
>> class A{
>>  vector<int> mydata;
>> };
>>
>> boost::shared_ptr<A> a(new A());
>> planner->SetUserData(a);
>>
>> Internally in the planner you can use:
>> boost::shared_ptr<A> a = boost::static_pointer_cast<A> (GetUserData());
>>
>> to get your class pointer back.
>>
>> This is by far the simplest method to implement, but it means that
>> users who want to use the data need to know what A is.
>>
>> hope this helps,
>> rosen,
>>
>>
>> 2010/11/12 Mike Stilman <[hidden email]>:
>>> Rosen,
>>>
>>> hmm - I think what Tobias is asking is specifically related to the
>>> benefit/drawbacks of using OpenRave given that the user is a pure C/C++
>>> programmer.
>>>
>>> From what you say, the only way to interact with the provided codebase is by
>>> formatting strings. However, suppose one wants to get access to a lower
>>> level of the plan (such as the time it took to compute it, the objects the
>>> planner collided with while it was planning etc. etc.) - then one would have
>>> to first add such functionality to the BaseManipulation (class/plugin) then
>>> add a function that gets it, then add a serializer that turns into a string,
>>> then add a parser that gets it out and finally create one's own plugin that
>>> uses it. Is that right?
>>>
>>> This is not much different than generating a function prototype in C++.
>>> However, you actually have to do it twice and the serializer/parser is
>>> actually significantly more difficult to write than a function header.
>>>
>>> The difficulty we're having is that the serialization/parsing may be the
>>> most time consuming element of the entire process. Not only in terms of
>>> computation time - but (more importantly) implementation time.
>>>
>>> Due to this, it appears that the only advantage to the design of OpenRave is
>>> that it supports multiple languages and network operation. If the user was
>>> to purely program in C++ on a single computer then it seems like Rave
>>> requires a lot of extra work that would not be necessary without it. Could
>>> you let us know if there are easier ways of interacting with OpenRave
>>> functionality or is this a fundamental limitation due to the goal of
>>> maintaining generality?
>>>
>>> Thanks,
>>>
>>> Mike
>>>
>>>
>>> On Fri, 12 Nov 2010, Rosen Diankov wrote:
>>>
>>>> hi tobias,
>>>>
>>>> This is an excellent question!
>>>>
>>>> First, can you offer a better solution?
>>>>
>>>> In the C++ world, calling a function means you need to know its
>>>> prototype, which means you need to know he existence of the other
>>>> plugin and its exact functions when writing/compiling your own plugin.
>>>> If BaseManipulation had publicly exposed C++ methods for its planning
>>>> techniques, it would break the design.
>>>>
>>>> With serialization, you even gain the ability to call the commands
>>>> through the network, or pass them across languages (for example, the
>>>> python interfaces.BaseManipulation class).
>>>>
>>>> If you really must pass pointers for large amounts of data, then you
>>>> can always overload the istream class, it doesn't always have to be a
>>>> string.
>>>>
>>>> rosen,
>>>>
>>>>
>>>>
>>>> 2010/11/11 Tobias Kunz <[hidden email]>:
>>>>>
>>>>> Dear Rosen,
>>>>>
>>>>> I want to write an openrave plugin that makes use of the functionality
>>>>> provided by the basemanipulation plugin. However, it seems like the only
>>>>> way to interact with the basemanipulation plugin is through sending
>>>>> string commands.
>>>>>
>>>>> Different plugins communicating through string commands instead of just
>>>>> calling a function does not seem right to me and I am wondering whether
>>>>> I am doing something wrong.
>>>>>
>>>>> Is the basemanipulation plugin (or ProblemInstance plugins in general)
>>>>> supposed to be called by other plugins? How can I avoid writing a lot of
>>>>> code for serializing and deserializing parameters when calling other
>>>>> plugins?
>>>>>
>>>>> Thanks,
>>>>> Tobias
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Centralized Desktop Delivery: Dell and VMware Reference Architecture
>>>>> Simplifying enterprise desktop deployment and management using
>>>>> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
>>>>> client virtualization framework. Read more!
>>>>> http://p.sf.net/sfu/dell-eql-dev2dev
>>>>> _______________________________________________
>>>>> Openrave-users mailing list
>>>>> [hidden email]
>>>>> https://lists.sourceforge.net/lists/listinfo/openrave-users
>>>>>
>>>>
>>>
>>
>
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

Re: Inter-plugin communication

Rosen Diankov
Administrator
hi mike,

Glad that helped! There is currently one C++ example showing how to
construct the planner parameters:

http://openrave.programmingvision.com/ordocs/en/html/orplanning_planner_8cpp-example.html

If you have any request for new C++ samples showing off custom data,
please send an email.

rosen,

2010/11/13 Mike Stilman <[hidden email]>:

> Hey Rosen,
>
> I see. That helps me understand it a lot better! Thank you very much for the
> info and the quick response!
>
> Mike
>
>
> On Fri, 12 Nov 2010, Rosen Diankov wrote:
>
>> Hi Mike,
>>
>> I forgot to mention that all 3 methods imply that you generate your
>> copy the code you are interested from basemanipulation and generate
>> your own PlannerParameters structures.
>>
>> The PlannerParameters structure itself can be derived in a
>> interoperable way to give a planner custom parameters that other
>> parameters can interpret. You can find several samples of custom
>> parameters in the rmanipulation/commonmanipluation.h file. This is
>> what allows the basemanipulation planner to pass custom commands to
>> the grasper planner without really knowing what structures the grasper
>> planner is using (obviously parameter names are agreed upon).
>>
>> rosen,
>>
>> 2010/11/12 Rosen Diankov <[hidden email]>:
>>>
>>> hi mike,
>>>
>>> The basemanipulation plugin is there to show off how planners get
>>> initialized and used. It has a very simple string command interface.
>>> If you would like to get custom information from a plan, there are
>>> three recommended ways:
>>>
>>> 1.
>>>
>>> implement the SendCommand function in your planner. Once a user has
>>> the planner pointer, they can just call planner->SendCommand and get
>>> their desired output. For example, getting a list of doubles from a
>>> planner involves the following C++ code from the user side:
>>>
>>> #include <sstream>
>>> #include <iostream>
>>>
>>> stringstream command("get_my_reals"), output;
>>> planner->SendCommand(output,command);
>>> vector<dReal> v = vector<dReal>((istream_iterator<dReal>(output)),
>>> istream_iterator<dReal>());
>>>
>>> This requires all your classes to support
>>> serialization/deserialization methods. In my opinion, this is
>>> something necessary anyway for writing logs..
>>>
>>> 2.
>>>
>>> Instead of send command, you can send a pointer to a std::ostream
>>> object into the PlannerBase::PlanPath function. For example:
>>>
>>> boost::shared_ptr<stringstream> output(new stringstream());
>>> planner->PlanPath(ptraj, output);
>>>
>>> This has the advantage of recording statistics only for the current plan.
>>>
>>> 3.
>>>
>>> You can set your own user data into the planner, the planner will then
>>> record everything in that class. For example:
>>>
>>> class A{
>>>  vector<int> mydata;
>>> };
>>>
>>> boost::shared_ptr<A> a(new A());
>>> planner->SetUserData(a);
>>>
>>> Internally in the planner you can use:
>>> boost::shared_ptr<A> a = boost::static_pointer_cast<A> (GetUserData());
>>>
>>> to get your class pointer back.
>>>
>>> This is by far the simplest method to implement, but it means that
>>> users who want to use the data need to know what A is.
>>>
>>> hope this helps,
>>> rosen,
>>>
>>>
>>> 2010/11/12 Mike Stilman <[hidden email]>:
>>>>
>>>> Rosen,
>>>>
>>>> hmm - I think what Tobias is asking is specifically related to the
>>>> benefit/drawbacks of using OpenRave given that the user is a pure C/C++
>>>> programmer.
>>>>
>>>> From what you say, the only way to interact with the provided codebase
>>>> is by
>>>> formatting strings. However, suppose one wants to get access to a lower
>>>> level of the plan (such as the time it took to compute it, the objects
>>>> the
>>>> planner collided with while it was planning etc. etc.) - then one would
>>>> have
>>>> to first add such functionality to the BaseManipulation (class/plugin)
>>>> then
>>>> add a function that gets it, then add a serializer that turns into a
>>>> string,
>>>> then add a parser that gets it out and finally create one's own plugin
>>>> that
>>>> uses it. Is that right?
>>>>
>>>> This is not much different than generating a function prototype in C++.
>>>> However, you actually have to do it twice and the serializer/parser is
>>>> actually significantly more difficult to write than a function header.
>>>>
>>>> The difficulty we're having is that the serialization/parsing may be the
>>>> most time consuming element of the entire process. Not only in terms of
>>>> computation time - but (more importantly) implementation time.
>>>>
>>>> Due to this, it appears that the only advantage to the design of
>>>> OpenRave is
>>>> that it supports multiple languages and network operation. If the user
>>>> was
>>>> to purely program in C++ on a single computer then it seems like Rave
>>>> requires a lot of extra work that would not be necessary without it.
>>>> Could
>>>> you let us know if there are easier ways of interacting with OpenRave
>>>> functionality or is this a fundamental limitation due to the goal of
>>>> maintaining generality?
>>>>
>>>> Thanks,
>>>>
>>>> Mike
>>>>
>>>>
>>>> On Fri, 12 Nov 2010, Rosen Diankov wrote:
>>>>
>>>>> hi tobias,
>>>>>
>>>>> This is an excellent question!
>>>>>
>>>>> First, can you offer a better solution?
>>>>>
>>>>> In the C++ world, calling a function means you need to know its
>>>>> prototype, which means you need to know he existence of the other
>>>>> plugin and its exact functions when writing/compiling your own plugin.
>>>>> If BaseManipulation had publicly exposed C++ methods for its planning
>>>>> techniques, it would break the design.
>>>>>
>>>>> With serialization, you even gain the ability to call the commands
>>>>> through the network, or pass them across languages (for example, the
>>>>> python interfaces.BaseManipulation class).
>>>>>
>>>>> If you really must pass pointers for large amounts of data, then you
>>>>> can always overload the istream class, it doesn't always have to be a
>>>>> string.
>>>>>
>>>>> rosen,
>>>>>
>>>>>
>>>>>
>>>>> 2010/11/11 Tobias Kunz <[hidden email]>:
>>>>>>
>>>>>> Dear Rosen,
>>>>>>
>>>>>> I want to write an openrave plugin that makes use of the functionality
>>>>>> provided by the basemanipulation plugin. However, it seems like the
>>>>>> only
>>>>>> way to interact with the basemanipulation plugin is through sending
>>>>>> string commands.
>>>>>>
>>>>>> Different plugins communicating through string commands instead of
>>>>>> just
>>>>>> calling a function does not seem right to me and I am wondering
>>>>>> whether
>>>>>> I am doing something wrong.
>>>>>>
>>>>>> Is the basemanipulation plugin (or ProblemInstance plugins in general)
>>>>>> supposed to be called by other plugins? How can I avoid writing a lot
>>>>>> of
>>>>>> code for serializing and deserializing parameters when calling other
>>>>>> plugins?
>>>>>>
>>>>>> Thanks,
>>>>>> Tobias
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Centralized Desktop Delivery: Dell and VMware Reference Architecture
>>>>>> Simplifying enterprise desktop deployment and management using
>>>>>> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
>>>>>> client virtualization framework. Read more!
>>>>>> http://p.sf.net/sfu/dell-eql-dev2dev
>>>>>> _______________________________________________
>>>>>> Openrave-users mailing list
>>>>>> [hidden email]
>>>>>> https://lists.sourceforge.net/lists/listinfo/openrave-users
>>>>>>
>>>>>
>>>>
>>>
>

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

Re: GetEnvironmentName

Daniel Leidner-2
In reply to this post by Rosen Diankov
Hi Rosen,

i cant see how this works... how can i store my string with python?
and how does i read if after this with my plugin? it seems that i have
to create a class derived from UserData?

and then i have some logical problems with it: aren't those those two
complete different instances?
how can one of them post some information while the other instance can
read it after all?

this is kind of confusing for me. could you probably post an example? or
just code snippets?

Daniel

Rosen Diankov wrote:

> Hi Daniel,
>
> Ok, added (r1835).
>
> In order to support storing python objects as C++ user data, the
> openrave user data semantics had to change a little. Now there is a
> dummy UserData class, and SetUserData takes
> boost::shared_ptr<UserData>.  These changes apply to InterfaceBase and
> EnvironmentBase. Theoretically, old code using
> InterfaceBase::SetUserData(boost::shared_ptr<void>) should still work
> since C++ will do the type cast intrinsically.
>
> rosen,
>
> 2010/11/12 Daniel Leidner <[hidden email]>:
>  
>> hi Rosen,
>>
>> You are right, its not easy to deal with that, but i want to add the
>> ability to and and remove objects later on...
>> at least those who have an xml file, objects which where created from
>> points is another thing... But im on it ;-)
>>
>> Anyway, i think SetUserData and GetUserData will satisfy my needs. I
>> could just save the name in the beginning and then load it later.
>> But there should be a python binding for it, so i can save the name on
>> starting my python script and load it with my plugin.
>>
>> Daniel
>>
>> Rosen Diankov wrote:
>>    
>>> Hi Daniel,
>>>
>>> Creating such a method would be very difficult to get right since
>>> multiple scenes can be loaded, or objects added. Therefore the
>>> environment will rarely reflect what it was initialized with.
>>>
>>> Currently we've been trying to store the resource name for interfaces
>>> (ie InterfaceBase::GetXMLFilename), and that is proving to be a
>>> challenge.
>>>
>>> Anyway, it seems like you are looking for a way to differentiate your
>>> environments. How about we add SetUserData/GetUserData functions?
>>>
>>> rosen,
>>>
>>> 2010/11/12 Daniel Leidner <[hidden email]>:
>>>
>>>      
>>>> Hi Rosen,
>>>>
>>>> seems like we have a little misunderstanding here because i was not
>>>> clear enough.
>>>> what i want to have is the name of the xml file loaded to the
>>>> viewer/openrave.
>>>> i have multiple instances of rave running (c++) and i want to
>>>> synchronize them.
>>>> therefore they first have to now what file was loaded initially.
>>>> is it possible to get that "lab1.env.xml" name somehow?
>>>>
>>>> daniel
>>>>
>>>> Rosen Diankov wrote:
>>>>
>>>>        
>>>>> hi daniel,
>>>>>
>>>>> That is an excellent question.
>>>>>
>>>>> First, environments do not have names, but they can have unique ids.
>>>>> Although each environment gets registered with the openrave runtime,
>>>>> there is no mechanism to query the environment's unique id yet. We
>>>>> could definitely add this if you think it is necessary.
>>>>>
>>>>> Otherwise, you can use the raw pointer for an id. Recently a
>>>>> RaveGetEnvironments function was added that will return all the
>>>>> registered environments. Given the raw pointer of an environment, you
>>>>> can always get check the current loaded environments. This can be done
>>>>> without dereferencing the pointer, so it is safe.
>>>>>
>>>>> What do you think?
>>>>> rosen,
>>>>>
>>>>> 2010/11/12 Daniel Leidner <[hidden email]>:
>>>>>
>>>>>
>>>>>          
>>>>>> Hi Rosen,
>>>>>>
>>>>>> is there a way to get the name of the current loaded environmentname?
>>>>>>
>>>>>> Daniel
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Centralized Desktop Delivery: Dell and VMware Reference Architecture
>>>>>> Simplifying enterprise desktop deployment and management using
>>>>>> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
>>>>>> client virtualization framework. Read more!
>>>>>> http://p.sf.net/sfu/dell-eql-dev2dev
>>>>>> _______________________________________________
>>>>>> Openrave-users mailing list
>>>>>> [hidden email]
>>>>>> https://lists.sourceforge.net/lists/listinfo/openrave-users
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>> ------------------------------------------------------------------------------
>> Centralized Desktop Delivery: Dell and VMware Reference Architecture
>> Simplifying enterprise desktop deployment and management using
>> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
>> client virtualization framework. Read more!
>> http://p.sf.net/sfu/dell-eql-dev2dev
>> _______________________________________________
>> Openrave-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/openrave-users
>>
>>    


------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

Re: GetEnvironmentName

Rosen Diankov
Administrator
hi daniel,

Sure, in python it would look like:

env.SetUserData('teststring')

mystring = env.GetUserData()

rosen,

2010/11/15 Daniel Leidner <[hidden email]>:

> Hi Rosen,
>
> i cant see how this works... how can i store my string with python?
> and how does i read if after this with my plugin? it seems that i have
> to create a class derived from UserData?
>
> and then i have some logical problems with it: aren't those those two
> complete different instances?
> how can one of them post some information while the other instance can
> read it after all?
>
> this is kind of confusing for me. could you probably post an example? or
> just code snippets?
>
> Daniel
>
> Rosen Diankov wrote:
>> Hi Daniel,
>>
>> Ok, added (r1835).
>>
>> In order to support storing python objects as C++ user data, the
>> openrave user data semantics had to change a little. Now there is a
>> dummy UserData class, and SetUserData takes
>> boost::shared_ptr<UserData>.  These changes apply to InterfaceBase and
>> EnvironmentBase. Theoretically, old code using
>> InterfaceBase::SetUserData(boost::shared_ptr<void>) should still work
>> since C++ will do the type cast intrinsically.
>>
>> rosen,
>>
>> 2010/11/12 Daniel Leidner <[hidden email]>:
>>
>>> hi Rosen,
>>>
>>> You are right, its not easy to deal with that, but i want to add the
>>> ability to and and remove objects later on...
>>> at least those who have an xml file, objects which where created from
>>> points is another thing... But im on it ;-)
>>>
>>> Anyway, i think SetUserData and GetUserData will satisfy my needs. I
>>> could just save the name in the beginning and then load it later.
>>> But there should be a python binding for it, so i can save the name on
>>> starting my python script and load it with my plugin.
>>>
>>> Daniel
>>>
>>> Rosen Diankov wrote:
>>>
>>>> Hi Daniel,
>>>>
>>>> Creating such a method would be very difficult to get right since
>>>> multiple scenes can be loaded, or objects added. Therefore the
>>>> environment will rarely reflect what it was initialized with.
>>>>
>>>> Currently we've been trying to store the resource name for interfaces
>>>> (ie InterfaceBase::GetXMLFilename), and that is proving to be a
>>>> challenge.
>>>>
>>>> Anyway, it seems like you are looking for a way to differentiate your
>>>> environments. How about we add SetUserData/GetUserData functions?
>>>>
>>>> rosen,
>>>>
>>>> 2010/11/12 Daniel Leidner <[hidden email]>:
>>>>
>>>>
>>>>> Hi Rosen,
>>>>>
>>>>> seems like we have a little misunderstanding here because i was not
>>>>> clear enough.
>>>>> what i want to have is the name of the xml file loaded to the
>>>>> viewer/openrave.
>>>>> i have multiple instances of rave running (c++) and i want to
>>>>> synchronize them.
>>>>> therefore they first have to now what file was loaded initially.
>>>>> is it possible to get that "lab1.env.xml" name somehow?
>>>>>
>>>>> daniel
>>>>>
>>>>> Rosen Diankov wrote:
>>>>>
>>>>>
>>>>>> hi daniel,
>>>>>>
>>>>>> That is an excellent question.
>>>>>>
>>>>>> First, environments do not have names, but they can have unique ids.
>>>>>> Although each environment gets registered with the openrave runtime,
>>>>>> there is no mechanism to query the environment's unique id yet. We
>>>>>> could definitely add this if you think it is necessary.
>>>>>>
>>>>>> Otherwise, you can use the raw pointer for an id. Recently a
>>>>>> RaveGetEnvironments function was added that will return all the
>>>>>> registered environments. Given the raw pointer of an environment, you
>>>>>> can always get check the current loaded environments. This can be done
>>>>>> without dereferencing the pointer, so it is safe.
>>>>>>
>>>>>> What do you think?
>>>>>> rosen,
>>>>>>
>>>>>> 2010/11/12 Daniel Leidner <[hidden email]>:
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Hi Rosen,
>>>>>>>
>>>>>>> is there a way to get the name of the current loaded environmentname?
>>>>>>>
>>>>>>> Daniel
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> Centralized Desktop Delivery: Dell and VMware Reference Architecture
>>>>>>> Simplifying enterprise desktop deployment and management using
>>>>>>> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
>>>>>>> client virtualization framework. Read more!
>>>>>>> http://p.sf.net/sfu/dell-eql-dev2dev
>>>>>>> _______________________________________________
>>>>>>> Openrave-users mailing list
>>>>>>> [hidden email]
>>>>>>> https://lists.sourceforge.net/lists/listinfo/openrave-users
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>> ------------------------------------------------------------------------------
>>> Centralized Desktop Delivery: Dell and VMware Reference Architecture
>>> Simplifying enterprise desktop deployment and management using
>>> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
>>> client virtualization framework. Read more!
>>> http://p.sf.net/sfu/dell-eql-dev2dev
>>> _______________________________________________
>>> Openrave-users mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/openrave-users
>>>
>>>
>
>

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

Re: GetEnvironmentName

Rosen Diankov
Administrator
hi daniel,

that's because calling SetUserData from python stores a python object,
not a string object.

In order to read it from C++, you'll need to include the boost python
library and do the type casting yourself, something that i do not
recommend.

You can also try to create a C++ object from python and pass that in.
In order to do that, you'll need to again use boost python to expose
the C++ class.

In other words, sharing arbitrary user data between python and C++ is
difficult ;0)

In situation, the simplest thing to do is to create a list somewhere
that stores environment/filename pairs. In order to make this
possible, several functions were added (r1839):

RaveGetEnvironmentId(env) - get the environment's unique id using

RaveGetEnvironment(int) - get an environment using its id

You would serialize your int/string  pairs into a string, and
implement a custom SendCommand function to recive the string-based
list to the C++ world.

rosen,

2010/11/16 Daniel Leidner <[hidden email]>:

> Hi Rosen,
>
> sory that im still not comfortable with the UserData class...
> this is what i tried:
>
> i have a python script where i wanted to Set the UserData like this:
>     env = Environment()
>     env.SetUserData('data/lab1.env.xml')
>
> then i have a Plugin, where i want to get the UserData like this:
>     UserDataPtr ud;;
>     ud = penv->GetUserData();
>     char* fileName = (char*) malloc(sizeof(*ud)+1);
>     memcpy(&fileName[0], &*ud, sizeof(*ud));
>     cout << fileName << endl;
>
> But i only receive nonsense... could you please help me once more and tell
> me why this does not work?
> And propably how you would deal with that?
>
> Daniel
>
>
> Rosen Diankov wrote:
>
> there is a little magic underneath though, which is why i think you
> got confused ;0)
>
> 2010/11/15 Daniel Leidner <[hidden email]>:
>
>
> Hey Rosen,
>
> thank you! i thought i have to create an extra interface class for this!
>
> Daniel
>
> Rosen Diankov wrote:
>
>
> hi daniel,
>
> Sure, in python it would look like:
>
> env.SetUserData('teststring')
>
> mystring = env.GetUserData()
>
> rosen,
>
> 2010/11/15 Daniel Leidner <[hidden email]>:
>
>
>
> Hi Rosen,
>
> i cant see how this works... how can i store my string with python?
> and how does i read if after this with my plugin? it seems that i have
> to create a class derived from UserData?
>
> and then i have some logical problems with it: aren't those those two
> complete different instances?
> how can one of them post some information while the other instance can
> read it after all?
>
> this is kind of confusing for me. could you probably post an example? or
> just code snippets?
>
> Daniel
>
> Rosen Diankov wrote:
>
>
>
> Hi Daniel,
>
> Ok, added (r1835).
>
> In order to support storing python objects as C++ user data, the
> openrave user data semantics had to change a little. Now there is a
> dummy UserData class, and SetUserData takes
> boost::shared_ptr<UserData>.  These changes apply to InterfaceBase and
> EnvironmentBase. Theoretically, old code using
> InterfaceBase::SetUserData(boost::shared_ptr<void>) should still work
> since C++ will do the type cast intrinsically.
>
> rosen,
>
> 2010/11/12 Daniel Leidner <[hidden email]>:
>
>
>
>
> hi Rosen,
>
> You are right, its not easy to deal with that, but i want to add the
> ability to and and remove objects later on...
> at least those who have an xml file, objects which where created from
> points is another thing... But im on it ;-)
>
> Anyway, i think SetUserData and GetUserData will satisfy my needs. I
> could just save the name in the beginning and then load it later.
> But there should be a python binding for it, so i can save the name on
> starting my python script and load it with my plugin.
>
> Daniel
>
> Rosen Diankov wrote:
>
>
>
>
> Hi Daniel,
>
> Creating such a method would be very difficult to get right since
> multiple scenes can be loaded, or objects added. Therefore the
> environment will rarely reflect what it was initialized with.
>
> Currently we've been trying to store the resource name for interfaces
> (ie InterfaceBase::GetXMLFilename), and that is proving to be a
> challenge.
>
> Anyway, it seems like you are looking for a way to differentiate your
> environments. How about we add SetUserData/GetUserData functions?
>
> rosen,
>
> 2010/11/12 Daniel Leidner <[hidden email]>:
>
>
>
>
>
> Hi Rosen,
>
> seems like we have a little misunderstanding here because i was not
> clear enough.
> what i want to have is the name of the xml file loaded to the
> viewer/openrave.
> i have multiple instances of rave running (c++) and i want to
> synchronize them.
> therefore they first have to now what file was loaded initially.
> is it possible to get that "lab1.env.xml" name somehow?
>
> daniel
>
> Rosen Diankov wrote:
>
>
>
>
>
> hi daniel,
>
> That is an excellent question.
>
> First, environments do not have names, but they can have unique ids.
> Although each environment gets registered with the openrave runtime,
> there is no mechanism to query the environment's unique id yet. We
> could definitely add this if you think it is necessary.
>
> Otherwise, you can use the raw pointer for an id. Recently a
> RaveGetEnvironments function was added that will return all the
> registered environments. Given the raw pointer of an environment, you
> can always get check the current loaded environments. This can be done
> without dereferencing the pointer, so it is safe.
>
> What do you think?
> rosen,
>
> 2010/11/12 Daniel Leidner <[hidden email]>:
>
>
>
>
>
>
> Hi Rosen,
>
> is there a way to get the name of the current loaded environmentname?
>
> Daniel
>
> ------------------------------------------------------------------------------
> Centralized Desktop Delivery: Dell and VMware Reference Architecture
> Simplifying enterprise desktop deployment and management using
> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
> client virtualization framework. Read more!
> http://p.sf.net/sfu/dell-eql-dev2dev
> _______________________________________________
> Openrave-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openrave-users
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Centralized Desktop Delivery: Dell and VMware Reference Architecture
> Simplifying enterprise desktop deployment and management using
> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
> client virtualization framework. Read more!
> http://p.sf.net/sfu/dell-eql-dev2dev
> _______________________________________________
> Openrave-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openrave-users
>
>
>
>
>
>
>

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users