how to run rosserial on maple?
I intend to set up the rosserial on maple ide,and i also reference to the previous question here : http://answers.ros.org/question/11383/rosserial-with-the-maple-ide/ http://www.ros.org/wiki/rosserial_client/Tutorials/Adding%20Support%20for%20New%20Hardware talk about my steps:
1.use the rosserialclient,and plus the msgs ,as stdmsgs,sensor_msgs and so on.
2.create a new MapleHardware.h for the maple ide ,as following:
#ifndef ROS_MAPLE_HARDWARE_H_
#define ROS_MAPLE_HARDWARE_H_
#include <maple.h>
#include <WProgram.h>
#include <HardwareSerial.h>
class MapleHardware {
public:
MapleHardware(HardwareSerial* io , long baud= 57600){
iostream = io;
baud_ = baud;
}
MapleHardware()
{
iostream = &Serial1;
baud_ = 57600;
}
MapleHardware(MapleHardware& h){
this->iostream = iostream;
this->baud_ = h.baud_;
}
void setBaud(long baud){
this->baud_= baud;
}
int getBaud(){return baud_;}
void init(){
iostream->begin(baud_);
}
int read(){return iostream->read();};
void write(uint8_t* data, int length){
for(int i=0; i<length; i++)
iostream->write(data[i]);
}
unsigned long time(){return millis();}
protected:
HardwareSerial* iostream;
long baud_;
};
#endif
3 I create the required ros.h,as following:
#ifndef _ROS_H_
#define _ROS_H_
#include "ros/node_handle.h"
#include "MapleHardware.h"
namespace ros
{
/* downsize our buffers */
typedef NodeHandle_<MapleHardware, 6, 6, 150, 150> NodeHandle;
//typedef NodeHandle_<MapleHardware> NodeHandle;
}
#endif
Then I copy the helloworld.pde from the rosserial_arduino example. However ,it doesn't work...
[INFO] [WallTime: 1350648220.197274] ROS Serial Python Node [INFO] [WallTime: 1350648220.197554] Connected on /dev/ttyACM0 at 57600 baud [ERROR] [WallTime: 1350648235.197972] Lost sync with device, restarting... [ERROR] [WallTime: 1350648250.201682] Lost sync with device, restarting... [ERROR] [WallTime: 1350648265.205663] Lost sync with device, restarting...
I suspect that the " typedef NodeHandle_<MapleHardware, 6, 6, 150, 150> NodeHandle;
" may be wrong,or somewhere else. many many thanks for any tips or comments .
Asked by bobliao on 2012-10-19 02:38:55 UTC
Answers
see http://leaflabs.com/docs/lang/api/serialusb.html#lang-serialusb
Asked by kobaan on 2013-01-03 10:22:37 UTC
Comments