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

Revision history [back]

click to hide/show revision 1
initial version

Hello.

It can be read in the documentation here that :

In order to get the current ROS time, you must be connected to ROS.

So maybe you should perform calls to nh.now() only after the connection to ROS has been initialised with nh.initNode(). (Note that I don't have an Arduino to double check this now though).

Hello.

It can be read in the documentation here that :

In order to get the current ROS time, you must be connected to ROS.

So maybe you should perform calls to nh.now() only after the connection to ROS has been initialised with nh.initNode(). (Note that I don't have an Arduino to double check this now though).

Edit 1

Hi. I tried your code on an ESP8266, and managed to get it working after three changes:

  • Manually call the Pulse_Event() function in the loop function (since I don't have an encoder to test).
  • Increasing the default size of the serial buffer in ros.h to 1024 (instead of the default 512). The odometry message seemed to be too big otherwise. Specifically I used typedef NodeHandle_<ArduinoHardware, 10, 10, 1024, 1024> NodeHandle;. You can get more information about this here.
  • Add odom_broadcaster.init(nh); just after nh.initNode(); (as per here)

Don't mind my previous comment. It seems indeed that it makes no difference in practice.

One general advice (if not already done of course): try with a very simple case scenario, publishing only one Float32 message, and see whether you still face the issue. Once you made sure it is working, add complexity bit by bit. It might be easier to isolate problems.

Hello.

It can be read in the documentation here that :

In order to get the current ROS time, you must be connected to ROS.

So maybe you should perform calls to nh.now() only after the connection to ROS has been initialised with nh.initNode(). (Note that I don't have an Arduino to double check this now though).

Edit 1

Hi. I tried your code on an ESP8266, and managed to get it working after three changes:

  • Manually call the Pulse_Event() function in the loop function (since I don't have an encoder to test).
  • Increasing the default size of the serial buffer in ros.h to 1024 (instead of the default 512). The odometry message seemed to be too big otherwise. Specifically I used typedef NodeHandle_<ArduinoHardware, 10, 10, 1024, 1024> NodeHandle;. You can get more information about this here.
  • Add odom_broadcaster.init(nh); just after nh.initNode(); (as per here)

Don't mind my previous comment. comment. It seems indeed that it makes no difference in practice.

One general advice (if not already done of course): try with a very simple case scenario, publishing only one Float32 message, and see whether you still face the issue. Once you made sure it is working, add complexity bit by bit. It might be easier to isolate problems.

Hello.

It can be read in the documentation here that :

In order to get the current ROS time, you must be connected to ROS.

So maybe you should perform calls to nh.now() only after the connection to ROS has been initialised with nh.initNode(). (Note that I don't have an Arduino to double check this now though).

Edit 1

Hi. I tried your code on an ESP8266, and managed to get it working after three changes:

  • Manually call the Pulse_Event() function in the loop function (since I don't have an encoder to test).
  • Increasing the default size of the serial buffer in ros.h to 1024 (instead of the default 512). The odometry message seemed to be too big otherwise. Specifically I used typedef NodeHandle_<ArduinoHardware, 10, 10, 1024, 1024> NodeHandle;. You can get more information about this here.
  • Add odom_broadcaster.init(nh); just after nh.initNode(); (as per here)

Don't mind my previous comment. comment. It seems indeed that it makes no difference in practice.

One general advice (if not already done of course): try with a very simple case scenario, publishing only one Float32 message, and see whether you still face the issue. Once you made sure it is working, add complexity bit by bit. It might be easier to isolate problems.