Custom Message on Arduino
I am using ROS Indigo and an Arduino Uno. I am having issues using a custom message that is part of my firmware. The firmware compiles and uploads fine, but I receive the following error when trying to connect to the node.
$ rosrun rosserial_python serial_node.py /dev/ttyACM1
[INFO] [WallTime: 1448735717.440960] ROS Serial Python Node
[INFO] [WallTime: 1448735717.454322] Connecting to /dev/ttyACM1 at 57600 baud
[ERROR] [WallTime: 1448735720.172786] Creation of publisher failed: ros_arduino_wiichuck
ROS path [0]=/opt/ros/indigo/share/ros
ROS path [1]=/opt/ros/indigo/share
ROS path [2]=/opt/ros/indigo/stacks
[ERROR] [WallTime: 1448735721.135189] Tried to publish before configured, topic id 125
[ERROR] [WallTime: 1448735722.154916] Tried to publish before configured, topic id 125
Here is my custom message
Header header
uint8 joyX
uint8 joyY
bool buttonZ
bool buttonC
float32 accelX
float32 accelY
float32 accelZ
Here is my firmware code
#include <Arduino.h>
#include <ros.h>
#include <ros_arduino_wiichuck/WiiChuck.h>
#include "WiiChuck.h"
WiiChuck chuck = WiiChuck();
ros::NodeHandle nh;
ros_arduino_wiichuck::WiiChuck chuck_msg;
ros::Publisher chuckPub("chuck", &chuck_msg);
char hello[13] = "hello world!";
void setup() {
nh.initNode();
nh.advertise(chuckPub);
chuck.begin();
chuck.update();
}
void loop() {
delay(20);
chuck.update();
chuck_msg.joyX = chuck.readJoyX();
chuck_msg.joyY = chuck.readJoyY();
chuck_msg.buttonZ = chuck.buttonZ;
chuck_msg.buttonC = chuck.buttonC;
chuck_msg.accelX = chuck.readAccelX();
chuck_msg.accelY = chuck.readAccelY();
chuck_msg.accelZ = chuck.readAccelZ();
chuckPub.publish(&chuck_msg);
nh.spinOnce();
delay(1000);
}