[ros-users] calling a service in rospy without a type

Rosen Diankov rosen.diankov at gmail.com
Sat Jun 19 00:20:31 UTC 2010


so that's what rosh is all about, awesome ;0)

> As for the other benefits that you mention, they aren't really there,
> per se -- your code still implicitly loads all of the code. By
> removing the explicit imports, all you're doing is increasing the
> potential fragility of your script, plus potentially overlooking
> package dependencies that are important for building.

Given your prowess in python, it is surprising you are arguing for the
strong-typed case. There's advantages and disadvantages to both, and
the user should decide. An algorithm, in its purest form, just
specifies the operations and relations on the objects, leaving the
underlying implementation and mechanics up to the user of the
algorithm.

There are cases where being able to call a service without knowing its
type could make it robust to the plethora of custom messages created
by ROS users.

As for overlooking package dependencies, with python this is not a
problem. If the package path is sent with the type, then rospy can
auto-generate the python class without relying on a pre-generated
class to include; and I'm sure you can come up with a caching scheme
to make this quicker the next time around.

rosen,

2010/6/18 Ken Conley <kwc at willowgarage.com>:
> This is something that is being tested/prototyped in rosh right now to
> see what the implications are for rospy. Both services and topics are
> being tested in this manner and are much like "rostopic echo" and
> "rosservice call".
>
> As for the other benefits that you mention, they aren't really there,
> per se -- your code still implicitly loads all of the code. By
> removing the explicit imports, all you're doing is increasing the
> potential fragility of your script, plus potentially overlooking
> package dependencies that are important for building.
>
>  - Ken
>
> On Fri, Jun 18, 2010 at 3:57 PM, Rosen Diankov <rosen.diankov at gmail.com> wrote:
>> Because service types are passed when the hand shacking between two
>> clients occurs, it seems that it would, theoretically, be possible to
>> call a service from rospy without specifying the topic name:
>>
>> rospy.ServiceProxy('myservice')(myparam=1)
>>
>> The internal rospy mechanics could import the correct service
>> depending on the type.
>>
>> In fact, is it really necessary to specify the python service class if
>> a user doesn't particularly care what the service type is? Not having
>> to declare a service type could reduce the number of explicit imports
>> in a python code, and potentially make python code independent of the
>> types.
>>
>> I guess this argument would also apply to the subscribers of topics..
>>
>> rosen,
>> _______________________________________________
>> ros-users mailing list
>> ros-users at code.ros.org
>> https://code.ros.org/mailman/listinfo/ros-users
>>
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>



More information about the ros-users mailing list