0
$\begingroup$

Rosanswers logo

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

Originally posted by D_mangus on ROS Answers with karma: 121 on 2011-09-30

Post score: 1


Original comments

Comment by Eric Perko on 2011-09-30:
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.

Comment by D_mangus on 2011-09-30:
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.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by D_mangus with karma: 121 on 2011-10-07

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.