Ask Your Question
0

how to run rosserial on maple? [closed]

asked 2012-10-19 02:38:55 -0500

bobliao gravatar image

updated 2012-10-19 17:50:06 -0500

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 rosserial_client,and plus the msgs ,as std_msgs,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

4. 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 .

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2015-09-28 01:13:08.356085

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-01-03 09:22:37 -0500

kobaan gravatar image

see http://leaflabs.com/docs/lang/api/serialusb.html#lang-serialusb

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-10-19 02:38:55 -0500

Seen: 204 times

Last updated: Jan 03 '13

Related questions