ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Rosserial with the Maple IDE

asked 2011-09-30 07:18:42 -0600

D_mangus gravatar image

updated 2011-11-07 06:44:02 -0600

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
edit retag flag offensive close merge delete

Comments

Never mind I found the http://www.ros.org/wiki/rosserial_client/Tutorials/Porting%20ROSSerial%20Client which is what I was needing to understand. It just was not under the tutorials for the overall package just under the rosserial_client package.
D_mangus gravatar image D_mangus  ( 2011-09-30 08:01:46 -0600 )edit
If that is a good "answer" to your question, please post it as an answer and one of the admins can come along and mark it as accepted.
Eric Perko gravatar image Eric Perko  ( 2011-09-30 12:39:55 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2011-10-07 06:12:41 -0600

D_mangus gravatar image

I found the http://www.ros.org/wiki/rosserial_client/Tutorials/Porting%20ROSSerial%20Client which is what I was needing to understand. It was not under the tutorials for the overall package, but instead just under the rosserial_client package.

edit flag offensive delete link more
0

answered 2011-10-07 10:24:43 -0600

fergs gravatar image

When did you checkout the code? There was a ros.h accidently checked in until Sep 18th -- but there shouldn't now be any arduino-related code in rosserial_client, if you find something, please file a ticket to have it removed.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2011-09-30 07:18:42 -0600

Seen: 695 times

Last updated: Nov 07 '11