unable to use custom messages on arduino
Hi Guys,
I'm trying to write a ros publisher on an arduino Uno using a custom message type and am running into compile errors for the arduino code. I followed the instructions here: link:http://ros.org/wiki/rosserial_arduino/Tutorials/Adding%20Custom%20Messages#Adding_Custom_Messages.28Generating_Message_Header_File.29 (Rosserial_arduino custom messages) and I'm able to include the generated header file. I then get the following error when I try to instantiate a variable of the message type:
I2C_Send_and_Receive.cpp:21:25: error: cannot declare variable ‘encoders’ to be of abstract type ‘GCRobotics::Encoder_msg’
In file included from I2C_Send_and_Receive.cpp:7:0:
/home/josh/sketchbook/libraries/ros_lib/GCRobotics/Encoder_msg.h:12:9: note: because the following virtual functions are pure within ‘GCRobotics::Encoder_msg’:
In file included from /home/josh/sketchbook/libraries/ros_lib/std_msgs/Time.h:7:0,
from /home/josh/sketchbook/libraries/ros_lib/ros/node_handle.h:38,
from /home/josh/sketchbook/libraries/ros_lib/ros.h:38,
from I2C_Send_and_Receive.cpp:5:
/home/josh/sketchbook/libraries/ros_lib/ros/msg.h:44:19: note: virtual int ros::Msg::serialize(unsigned char*) const
/home/josh/sketchbook/libraries/ros_lib/ros/msg.h:47:28: note: virtual const char* ros::Msg::getMD5()
My code for creating it looks like this:
#include <ros.h>
#include <Wire.h>
#include <GCRobotics/Encoder_msg.h>
#include <GCRobotics/i2cData.h>
#include <std_msgs/String.h>
#include <TimerOne.h>
ros::NodeHandle n;
//std_msgs::String encoders;
GCRobotics::Encoder_msg encoders;
ros::Publisher pub("EncoderData", &encoders);
Im using Groovy and arduino 1.0.1, Any ideas on what I'm doing wrong or missing?
Thanks!