Rosserial with the Maple IDE
I'm trying to set up the new rosserial package to work with the leaflabs Maple board. I tried using the supplied rosserial_client but it seems that its still trying to refer to the ArduinoHardware.h file which confuses me since it is supposed to be the general implementation of the rosserial communication. I have a Arduino board as well and I tested it using the rosserial_arduino package and it works wonderfully but unfortunately the arduino processor isn't powerful enough to handle the wheel encoders I'm using. Has anybody already ported over to the maple board using rosserial? If so can somebody point me to the code. Or maybe shed some light on how to integrate the rosserial_client with the Maple IDE like what they did for the Arduino?
This is my current set of code for the rosserial_client, but I think there is an error with the read/write because the terminal just pops out the message "Lost sync with device, restarting... " after I initialize the node using "rosrun rosserial_python serial_node.py /dev/ttyUSB0".
I have also attempted the Serial2.write() function inplace of the print that I have now and get a different error, which is "Failed to parse subscriber. unpack requires a string argument of length 4" Any help/insight would be appreciated.
*#ifndef MAPLEHARDWARE_H_
#define MAPLEHARDWARE_H_
#include "WProgram.h"
#include <HardwareSerial.h>
class MapleHardware {
public:
MapleHardware(){
baud_ = 57600;
}
void init(){
Serial2.begin(baud_);
}
int read(){
numUnread = Serial2.available();
if (numUnread > 0) {
return Serial2.read();
}
else{return -1;}
}
void write(uint8_t* data, int length){
for(int i=0; i<length; i++) Serial2.write(data[i]);
}
unsigned long time(){return millis();}
protected:
uint32 baud_;
int numUnread;
};
#endif