ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
SOLVED: I forget to add the next include:
#define USE_USBCON
It was solved in the teensy forum, thank you to Theremingenieur user: https://forum.pjrc.com/threads/52928-rosserial-bluetooth-teensy-problem
The modified Hello World sample:
/*
* rosserial Publisher Example
* Prints "hello world!"
*/
// Use the following line if you have a Leonardo or MKR1000
#define USE_USBCON
#include <ros.h>
#include <std_msgs/String.h>
//ros::NodeHandle nh;
class NewHardware : public ArduinoHardware
{
public:
NewHardware():ArduinoHardware(&Serial1, 57600){};
};
ros::NodeHandle_<NewHardware> nh;
std_msgs::String str_msg;
ros::Publisher chatter("chatter", &str_msg);
char hello[13] = "hello world!";
void setup()
{
nh.initNode();
nh.advertise(chatter);
}
void loop()
{
str_msg.data = hello;
chatter.publish( &str_msg );
nh.spinOnce();
delay(1000);
}
2 | No.2 Revision |
SOLVED: I forget to add the next include:
#define USE_USBCON
It was solved in the teensy forum, thank you to Theremingenieur user: https://forum.pjrc.com/threads/52928-rosserial-bluetooth-teensy-problem
The modified Hello World sample:
/*
* rosserial Publisher Example
* Prints "hello world!"
*/
// Use the following line if you have a Leonardo or MKR1000
MKR1000
#define USE_USBCON
#define USE_USBCON