Ask Your Question
0

How to call a service with a char argument

asked 2016-03-13 17:54:28 -0600

Cerin gravatar image

How do you pass a char to rosservice call?

I have a srv file like:

uint8 id
string data
---

exposed as /myservice which I'd like to call like rosservice call /myservice m '!!str mydata' but this gives me a Python traceback to the autogenerated code for my srv class:

UnboundLocalError: local variable '_x' referenced before assignment

presumably because it doesn't convert "m" to the uint8 value 109. The docs declare char is deprecated because it's essentially the same thing as uint8.

Is there a way to explicitly declare this type, or do I have to pass in a literal int value?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-03-13 19:59:46 -0600

Arowana gravatar image

I am not familiar with the way you call the service. I usually do it this way

rosservice call /myservice '{id: A, data: ok}'

edit flag offensive delete link more

Comments

I tried that hash notation, but that gives me the error, "expected [id, data]. I guess it assumes a list notation for custom services?

Cerin gravatar imageCerin ( 2016-03-13 23:30:04 -0600 )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

1 follower

Stats

Asked: 2016-03-13 17:54:28 -0600

Seen: 233 times

Last updated: Mar 13 '16