Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Lost sync with device, restarting

I tried to control servo motors(uart interface) from ros. After the arduino receives the data 5 or 6 times it loses the connection

SoftwareSerial left(10,11), right(8,9); ros::NodeHandle n;

void left_drive(const std_msgs::String& msg) { String left_speed; left_speed = msg.data; left.println(left_speed);

}

void right_drive(const std_msgs::String& msg) { String right_speed; right_speed = msg.data; right.println(right_speed); }

ros::Subscriber<std_msgs::string> left_sub("/left_motor_cmd",left_drive); ros::Subscriber<std_msgs::string> right_sub("/right_motor_cmd",right_drive);

void setup() { left.begin(9600); right.begin(9600); n.initNode(); n.subscribe(left_sub); n.subscribe(right_sub); //pinMode(13,OUTPUT); }

void loop() { n.spinOnce();

}

include <ros.h>

include <std_msgs string.h="">

include <softwareserial.h>

SoftwareSerial left(10,11), right(8,9); ros::NodeHandle n;

void left_drive(const std_msgs::String& msg) { String left_speed; left_speed = msg.data; left.println(left_speed);

}

void right_drive(const std_msgs::String& msg) { String right_speed; right_speed = msg.data; right.println(right_speed); }

ros::Subscriber<std_msgs::string> left_sub("/left_motor_cmd",left_drive); ros::Subscriber<std_msgs::string> right_sub("/right_motor_cmd",right_drive);

void setup() { left.begin(9600); right.begin(9600); n.initNode(); n.subscribe(left_sub); n.subscribe(right_sub); //pinMode(13,OUTPUT); }

void loop() { n.spinOnce();

}

Lost sync with device, restarting

I tried to control servo motors(uart interface) from ros. After the arduino receives the data 5 or 6 times it loses the connection

SoftwareSerial left(10,11), right(8,9); ros::NodeHandle n;

void left_drive(const std_msgs::String& msg) { String left_speed; left_speed = msg.data; left.println(left_speed);

}

void right_drive(const std_msgs::String& msg) { String right_speed; right_speed = msg.data; right.println(right_speed); }

ros::Subscriber<std_msgs::string> left_sub("/left_motor_cmd",left_drive); ros::Subscriber<std_msgs::string> right_sub("/right_motor_cmd",right_drive);

void setup() { left.begin(9600); right.begin(9600); n.initNode(); n.subscribe(left_sub); n.subscribe(right_sub); //pinMode(13,OUTPUT); }

void loop() { n.spinOnce();

}

include <ros.h>

include <std_msgs string.h="">

include <softwareserial.h>

SoftwareSerial left(10,11), right(8,9); ros::NodeHandle n;

void left_drive(const std_msgs::String& msg) { String left_speed; left_speed = msg.data; left.println(left_speed);

}

void right_drive(const std_msgs::String& msg) { String right_speed; right_speed = msg.data; right.println(right_speed); }

ros::Subscriber<std_msgs::string> left_sub("/left_motor_cmd",left_drive); ros::Subscriber<std_msgs::string> right_sub("/right_motor_cmd",right_drive);

void setup() { left.begin(9600); right.begin(9600); n.initNode(); n.subscribe(left_sub); n.subscribe(right_sub); //pinMode(13,OUTPUT); }

void loop() { n.spinOnce();

}

Lost sync with device, restarting

I tried to control servo motors(uart interface) from ros. After the arduino receives the data 5 or 6 times it loses the connection

SoftwareSerial left(10,11), right(8,9);
ros::NodeHandle n;

n;

void left_drive(const std_msgs::String& msg) { String left_speed; left_speed = msg.data; left.println(left_speed);

left.println(left_speed); }

}

void right_drive(const std_msgs::String& msg) { String right_speed; right_speed = msg.data; right.println(right_speed); }

} ros::Subscriber<std_msgs::String> left_sub("/left_motor_cmd",left_drive); ros::Subscriber<std_msgs::String> right_sub("/right_motor_cmd",right_drive);

ros::Subscriber<std_msgs::string> left_sub("/left_motor_cmd",left_drive); ros::Subscriber<std_msgs::string> right_sub("/right_motor_cmd",right_drive);

void setup() { left.begin(9600); right.begin(9600); n.initNode(); n.subscribe(left_sub); n.subscribe(right_sub); //pinMode(13,OUTPUT); }

}

void loop() { n.spinOnce();

n.spinOnce();

}

}

Lost sync with device, restarting

I tried to control servo motors(uart interface) from ros. After the arduino receives the data 5 or 6 times it loses the connection

SoftwareSerial left(10,11), right(8,9);
ros::NodeHandle n;

void left_drive(const std_msgs::String& msg)
{ 
  String left_speed; 
  left_speed = msg.data;
  left.println(left_speed);

 }

 void right_drive(const std_msgs::String& msg)
{ 
  String right_speed; 
  right_speed = msg.data;
  right.println(right_speed);
 }

ros::Subscriber<std_msgs::String> left_sub("/left_motor_cmd",left_drive);
ros::Subscriber<std_msgs::String> right_sub("/right_motor_cmd",right_drive);

void setup() {
  left.begin(9600);
  right.begin(9600);
  n.initNode();
  n.subscribe(left_sub);
  n.subscribe(right_sub);
  //pinMode(13,OUTPUT);
  }

void loop() {
 n.spinOnce();

}