- Flask Document
- Flask页面蓝图
- 项目文件架构: ROS架构, Flask Application Factory
- Flask 菜鸟教程
- Flask-Security
- 数据库:SQLAlchemy, Flask-SQLAlchemy
- 相关教程:login
参照ROS教程
mkdir -p Project-IOT-Platform-AGV-APP/src
cd Project-IOT-Platform-AGV-APP/src
git clone git@github.com:Reinhardt2019/Project-IOT-Platform-AGV-APP.git
cd Project-IOT-Platform-AGV-APP/application/scripts
python3 setup.py build
python3 setup.py install
cd Project-IOT-Platform-AGV-APP
catkin_make
. devel/setup.bash
运行APP时,先ssh登录小车,在AGV端输入如下指令打开AGV端服务器
roslaunch delivery_navigation delivery.launch
再使用继续在虚拟机端运行
roslaunch application start_server.launch
若想在本地单独运行Flask,建议使用Ubuntu中的pycharm 需要注释程序中与ROS相关的代码,如下:
line 11:
from application.srv import *
import rospy
import threading
from std_msgs.msg import String
line 30:
threading.Thread(target=lambda: rospy.init_node('test_node', disable_signals=True)).start()
service = rospy.ServiceProxy('delivery', ClientPose)
line 8:
from . import order_datastore, merchandise_manager, service, position_manager中去掉service
运行wsgi.py
python3 run wsgi.py
文件运行后会自动连接AGV_APP/db.sqlite3数据库,若在该路径下无此文件,会自动创建,路径配置在config.py文件。
由于时间有限,目前配置为当前虚拟机的绝对路径,若用其他虚拟机运行需要更改路径,后续开发过程中可以尝试改成相对路径
运行程序会对其初始化,初始化详细内容见models.py
需要注册账号: lucidchart
相关文件集合在utils文件夹中,代码注释中已标注功能及参数类型。开发以上utils类的目的是为程序提供数据库接口,避免在app代码中重复使用底层函数,如model.query.filter_by().first()
等。在后续开发中,如遇到类似场景,应考虑开发新的类集成datastore,或在已有的类中添加新的函数,避免代码重复。
1.小车刚开机时需要一段时间初始化并连接网络,出现ssh: connect to host 10.20.240.247 port 22: No route to host属于正常现象,等待即可
2.只有在数据库order表中订单completed后,才可下达下一个订单