ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

publish a char [closed]

asked 2014-02-04 19:29:56 -0500

sonyfuchs gravatar image

updated 2014-02-04 21:22:30 -0500

hey community, im a ROS beginner, and my question is how can i publish a char manualy in a rostopic? i have published a string with

rostopic pub -1 my_topic std_msgs/String x

but the comand

rostopic pub -1 my_topic std_msgs/Char x

fails

edit:

when i try:

fhduser@fhduser:~/catkin_ws/src/sekuria$ rostopic pub -1 my_topic std_msgs/Char a

i get: [WARN] [WallTime: 1391591690.683859] Inbound TCP/IP connection failed: global name '_x' is not defined

when i try:

fhduser@fhduser:~/catkin_ws/src/sekuria$ rostopic pub -1 my_topic std_msgs/Char data: a

i get:

ERROR: Too many arguments:

  • Given: [{'data': None}, 'a']

  • Expected: ['data']

Args are: [data]

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by sonyfuchs
close date 2014-02-06 18:18:56

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-02-05 04:39:00 -0500

updated 2014-02-05 04:39:38 -0500

This looks like a bug with how std_msgs/msg/_Char.py is generated. Indeed, _x is never defined, whereas in std_msgs/msg/_String.py, it is defined in the serialize function. I would suggest submitting a bug report against ros_comm.

edit flag offensive delete link more
0

answered 2014-02-05 20:51:46 -0500

sonyfuchs gravatar image

updated 2014-02-05 20:58:57 -0500

perhaps, but yesterday, by experiment, I found that the following entry is possible:

fhduser@fhduser:~/catkin_ws/src/sekuria$ rostopic pub -1 asdf std_msgs/Char '123'

the echo shows:

data: 123

but when y try [...]Char '1a2' i also get

[WARN] [WallTime: 1391676362.069089] Inbound TCP/IP connection failed: global name '_x' is not defined

it also makes an error for everything over 255. could it be ascii?

edit flag offensive delete link more

Comments

0 to 255 is the range of char; to use ascii use atoi() function (ascii to integer) or equivalent to make a char.

David Galdeano gravatar image David Galdeano  ( 2014-02-05 21:10:14 -0500 )edit

Could You please update Your question instead adding extra info in answers. Also would be really appreciated if You'd format Your question and code provided properly. It's really messy to read and understand Your point. Thanks :)

Kamiccolo gravatar image Kamiccolo  ( 2014-02-05 23:17:37 -0500 )edit

Question Tools

Stats

Asked: 2014-02-04 19:29:56 -0500

Seen: 1,345 times

Last updated: Feb 05 '14