Ask Your Question
0

Advanced tutorial for rospy services?

asked 2018-05-15 10:51:15 -0500

seanarm gravatar image

updated 2018-05-15 10:54:05 -0500

Please don't link me to the beginner tutorial. This is beyond the provided examples. Let's define MySrv.srv as:

geometry_msgs/Point p
geometry_msgs/Vector3 v
float64 f
bool b
---
bool success

Then I perform the following:

p = Point()
v = Vector3()
req = MySrvRequest(p, v, -1, False)                                                                                                                                                                                                                                                       
rsp = myServiceProxy(req)

I always get the error: DeserializationError cannot deserialize: 'Point' object attribute 'x' is read-only. What am I doing wrong?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-05-15 11:04:10 -0500

I think your service structure is too complex for the calling method described in the tutorials. This question from a while may help solve your problem. You may have to construct the request object beforehand and then call the service.

Hope this helps.

edit flag offensive delete link more

Comments

Isn't the OP already doing that? req is an explicitly a priori created request instance.

gvdhoorn gravatar image gvdhoorn  ( 2018-05-15 11:06:16 -0500 )edit

True, they are. I miss-read that one.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-05-15 12:09:47 -0500 )edit
1

This helped me out still. Switching to the empty MySrvRequest constructor and filling in the attributes via individual assignment worked fine.

seanarm gravatar image seanarm  ( 2018-05-15 15:06:04 -0500 )edit

Glad you got it working

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-05-15 16:09:04 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2018-05-15 10:51:15 -0500

Seen: 184 times

Last updated: May 15 '18