ros-drivers / rosserial

A ROS client library for small, embedded devices, such as Arduino. See: http://wiki.ros.org/rosserial
518 stars 524 forks source link

Arduino advertiseService seems not to work (using rosserial_server) #135

Open meuchel opened 10 years ago

meuchel commented 10 years ago

On arduino establishing a service with advertiseService seems not to work. (publishing to topics is working) Using Ubuntu 14.04, ROS indigo and rosserial_server.

During running rosserial_server with connected arduino on the ros shell I get: ros@host1:~$ rosservice call test_srv ERROR: Service [/test_srv] is not available. or ros@host1:~$ rosservice list | grep test_srv -> nothing

Followed parts of the used arduino code: ... ros::NodeHandle n; using rosserial_arduino::Test; ... void callback(const Test::Request& req, Test::Response& res) { } .. ros::ServiceServer<Test::Request, Test::Response> server("test_srv", &callback); ... // within setup() function n.advertiseService(server); ... // within loop() n.spinOnce(); ...

Debug output ROS rosserial_server $ rosrun rosserial_server serial_node _port:=/dev/ttyUSB0 ... [ WARN] [1408282930.980026602]: Sync with device lost. [DEBUG] [1408282930.980114241]: Sending request topics message for VER1 protocol. [DEBUG] [1408282931.967271682]: Transferred 1 byte(s). [DEBUG] [1408282931.967487837]: Transferred 1 byte(s). [ INFO] [1408282931.968251663]: Attached client is using protocol VER2 (hydro) [DEBUG] [1408282931.968618145]: Transferred 5 byte(s). [DEBUG] [1408282931.968739498]: Received message header with length 8 and topic_id=10 [DEBUG] [1408282931.972466624]: Transferred 9 byte(s). [DEBUG] [1408282931.973043951]: Received body of length 9 for message on topic 10. [DEBUG] [1408282931.973268694]: Transferred 1 byte(s). [DEBUG] [1408282931.973476377]: Transferred 1 byte(s). [DEBUG] [1408282931.973857756]: Transferred 5 byte(s). [DEBUG] [1408282931.974185812]: Received message header with length 92 and topic_id=0 [DEBUG] [1408282931.987177746]: Transferred 93 byte(s). [DEBUG] [1408282931.987250675]: Received body of length 93 for message on topic 0. [ INFO] [1408282931.988780531]: waitForService: Service [/message_info] has not been advertised, waiting... [ WARN] [1408282937.000114349]: Timed out waiting for message_info service to become available. [ WARN] [1408282937.001678883]: Failed to call message_info service. Proceeding without full message definition. [ WARN] [1408282937.001761870]: Advertising on topic [/rc_pwm_ctrl] with an empty message definition. Some tools (e.g. rosbag) may not work correctly. [DEBUG] [1408282937.163508271]: Transferred 1 byte(s). [DEBUG] [1408282937.163926482]: Transferred 1 byte(s). [DEBUG] [1408282937.164142715]: Transferred 5 byte(s). [DEBUG] [1408282937.164216055]: Received message header with length 80 and topic_id=2 [DEBUG] [1408282937.164317208]: Transferred 81 byte(s). [DEBUG] [1408282937.164364865]: Received body of length 81 for message on topic 2. [ WARN] [1408282937.164422962]: Received message with unrecognized topicId (2). [DEBUG] [1408282937.164489911]: Transferred 1 byte(s). [DEBUG] [1408282937.164546070]: Transferred 1 byte(s). [DEBUG] [1408282937.164596651]: Transferred 5 byte(s). [DEBUG] [1408282937.164635033]: Received message header with length 80 and topic_id=3 [DEBUG] [1408282937.164722232]: Transferred 81 byte(s). [DEBUG] [1408282937.164783754]: Received body of length 81 for message on topic 3. [ WARN] [1408282937.164812821]: Received message with unrecognized topicId (3). [DEBUG] [1408282937.164847839]: Transferred 1 byte(s). [DEBUG] [1408282937.164876989]: Transferred 1 byte(s). [DEBUG] [1408282937.164902795]: Transferred 5 byte(s). [DEBUG] [1408282937.164918670]: Received message header with length 59 and topic_id=125 ...

mikepurvis commented 10 years ago

Hi @meuchel,

The C++ rosserial_server is still experimental— it doesn't include service serving, and a preliminary service client was only recently merged to the repo (ie, not yet released to debs). There's a brief discussion of this on its wiki page.

henoSH commented 8 years ago

hi @mikepurvis , i tried also to use ServiceClient but i got the same error : waitForService: Service [/message_info] has not been advertised, waiting... have you find a solution?