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

sync rosserial arduino

asked 2014-12-12 03:08:12 -0500

Wolf gravatar image

There was a couple of seconds a couple of seconds ago a question regarding rosserial arduino I accidentally deleted (I wanted to delete my own comment but accidentally deleted the entire question), sorry.

The issue was after running rosrun rosserial_python serial_node.py _port:=/dev/ttyACM0 the error unable to sync with device occurred.

The code looked quite like the example service client code but with a custom message (does not matter for the issue) and some parts commented out:

/*
 * rosserial Service Client
 */

    #include <ros.h>
    #include <std_msgs/String.h>
    #include <rosserial_arduino/Test.h>

    ros::NodeHandle  nh;
    using rosserial_arduino::Test;

    ros::ServiceClient<Test::Request, Test::Response> client("test_srv");

//    std_msgs::String str_msg;
//    ros::Publisher chatter("chatter", &str_msg);

//    char hello[13] = "hello world!";

    void setup()
    {
      nh.initNode();
      nh.serviceClient(client);
  //    nh.advertise(chatter);
      while(!nh.connected()) nh.spinOnce();
      nh.loginfo("Startup complete");
    }

    void loop()
    {
      Test::Request req;
      Test::Response res;
      req.input = hello;
      client.call(req, res);
   //   str_msg.data = res.output;
   //   chatter.publish( &str_msg );
   //  nh.spinOnce();
      delay(100);
    }
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-12-12 03:09:37 -0500

Wolf gravatar image

updated 2014-12-12 03:09:52 -0500

The issue is caused by commenting out the nh.spinOnce(). It is still needed for topic negotiation between serial_node and device, eventhough the publisher is not used anymore

edit flag offensive delete link more

Comments

Ok , I have uncommented it but still server is not getting the client request .

Mind_hunter gravatar image Mind_hunter  ( 2014-12-12 04:16:44 -0500 )edit

Do you still get the error with "unable to sync with device ... groovy ... hydro " ...

Wolf gravatar image Wolf  ( 2014-12-12 07:29:11 -0500 )edit

" Sync with device lost." this is showing

Mind_hunter gravatar image Mind_hunter  ( 2014-12-13 04:30:27 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-12-12 03:08:12 -0500

Seen: 499 times

Last updated: Dec 12 '14