本文整理汇总了C++中SerialPort::closePort方法的典型用法代码示例。如果您正苦于以下问题:C++ SerialPort::closePort方法的具体用法?C++ SerialPort::closePort怎么用?C++ SerialPort::closePort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerialPort
的用法示例。
在下文中一共展示了SerialPort::closePort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
ros::init(argc, argv, "crustcrawler_server");
ros::NodeHandle n;
#if(DEBUG_MODE)
ROS_INFO("crustcrawler_arm is in debug mode");
#endif
#if(SERIAL_ON)
lsc.setPort(port);
lsc.setBaudRate(B115200);
if(!lsc.openPort())
{
ROS_INFO("Unable to open serial port for crustcrawler_server");
return 1;
}
ROS_INFO("Serial port open");
#endif
ros::ServiceServer ssp_service = n.advertiseService("set_servo_position", ssp);
ROS_INFO("set_servo_position service started");
ros::ServiceServer sap_service = n.advertiseService("set_all_servo_positions", sap);
ROS_INFO("set_all_servo_positions service started");
ros::ServiceServer set_position_service = n.advertiseService("set_position", set_position);
ROS_INFO("set_position service started");
ros::ServiceServer gsp_service = n.advertiseService("get_servo_position", gsp);
ROS_INFO("get_servo_position service started");
ros::ServiceServer init_servo_service = n.advertiseService("init_servo",init_servo);
ros::ServiceServer get_light_service = n.advertiseService("get_light",light);
ros::ServiceServer send_init_message_service = n.advertiseService("send_init_message",send_init_message);
ROS_INFO("init_servo service started");
ros::spin();
#if(SERIAL_ON)
lsc.closePort();
ROS_INFO("Serial port closed");
#endif
return 0;
}