0
$\begingroup$

Rosanswers logo

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?


Originally posted by seanarm on ROS Answers with karma: 753 on 2018-05-15

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by PeteBlackerThe3rd with karma: 9529 on 2018-05-15

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by gvdhoorn on 2018-05-15:
Isn't the OP already doing that? req is an explicitly a priori created request instance.

Comment by PeteBlackerThe3rd on 2018-05-15:
True, they are. I miss-read that one.

Comment by seanarm on 2018-05-15:
This helped me out still. Switching to the empty MySrvRequest constructor and filling in the attributes via individual assignment worked fine.

Comment by PeteBlackerThe3rd on 2018-05-15:
Glad you got it working

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.