13,825
社区成员
发帖
与我相关
我的任务
分享
while(ros::ok()){
serial_msgs::serial msg;
ros::spinOnce();
if(ser.available()){sleep(1);
ofile.open("/home/gkk/abc.txt",ios::app);
ROS_INFO_STREAM("Reading from serial port");
//ofstream ofile;
//ofile.open("/home/gkk/abc.txt");
ofile<<"Reading from serial port"<<endl;
ser.read(r_buffer,rBUFFERSIZE);
for(int i=0;i<rBUFFERSIZE;i++)
{
ROS_INFO("[0x%02x]",r_buffer[i]);
ofile<<r_buffer[i]<<endl;
}
ROS_INFO_STREAM("End reading from serial port");
ofile<<"End reading from serial port"<<endl;
ofile.close();