robot upstart 问题

1.启动后在记录文件发现左轮节点未启动:

   因为左边的类未实例化,不会去订阅消息然后初始化

2.两个节点均可以启动后,发现启动后又死掉

   因为在程序里有getenv(“HOME”)然后付给string,getenv返回为NULL时程序会报错死掉

3.robot upstart 的用户权限比较低,没有权限操作串口(使用chmod 777 /dev/ttyS*,重启后失效)

   通过udev修改权限,具体如下:

   在/etc/udev/rules.d/文件夹下添加文件50-chmod-tty.rules,内容如下:

   KERNEL=="ttyS[0-9]*",  SUBSYSTEM=="tty",  GROUP="dialout",  MODE="0666"

4.最后发现具备了操作串口的权限,但打开串口失败,修改如下:

 

int left_wheel_motor::UART0_Open(char *port) 

{ int fdd;

fdd = open( port, O_RDWR|O_NOCTTY|O_NDELAY); 

if (FALSE == fdd) 

{ 

perror("Can't Open Serial Port"); 

return(FALSE); 

} 



if(fcntl(fdd, F_SETFL, 0) < 0) //if and else: set as block

{ 

printf("fcntl failed!\n"); 

return(FALSE); 

} 

else 

{ 

printf("fcntl=%d\n",fcntl(fdd, F_SETFL,0)); 

} 



if(0 == isatty(STDIN_FILENO)) 

{ 

printf("standard input is not a terminal device\n"); 

return(FALSE); 

} 

else 

{ 

printf("isatty success!\n"); 

} 

printf("fd->open=%d\n",fdd); 

return fdd; 

}



改为:



int left_wheel_motor::UART0_Open(char *port) 

{ int fdd;

fdd = open( port, O_RDWR|O_NOCTTY); 

if (FALSE == fdd) 

{ 

perror("Can't Open Serial Port"); 

return(FALSE); 

} 

printf("fd->open=%d\n",fdd); 

return fdd; 

}

1. apt-get install ros_indigo_robot_upstart

2. rosrun robot_upstart install bzrobot_bringup/launch/base.launch

3. sudo service bzrobot start

4.  sudo nano /var/log/upstart/bzrobot.log

5. sudo service bzrobot stop

6. rosrun robot_upstart uninstall bzrobot

7.  sudo rm -f /var/log/upstart/bzrobot.log

你可能感兴趣的:(start)