/Project-IOT-Platform-AGV-APP

This is the source code of the AGV APP, a part of the intern IOT Platform (AGV/Robot) Project

Primary LanguagePython

Project-IOT-Platform-AGV-APP: Auto-Move

参考资料 (很重要很重要很重要)

  1. Flask Document
  2. Flask页面蓝图
  3. 项目文件架构: ROS架构, Flask Application Factory
  4. Flask 菜鸟教程
  5. Flask-Security
  6. 数据库:SQLAlchemy, Flask-SQLAlchemy
  7. 相关教程:login

运行APP

安装ROS

参照ROS教程

创建workspace

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

安装Python依赖包

cd Project-IOT-Platform-AGV-APP/application/scripts
python3 setup.py build
python3 setup.py install

编译ROS(虚拟机端)

cd Project-IOT-Platform-AGV-APP
catkin_make
. devel/setup.bash

运行APP

运行Flask与ROS

运行APP时,先ssh登录小车,在AGV端输入如下指令打开AGV端服务器

roslaunch delivery_navigation delivery.launch 

再使用继续在虚拟机端运行

roslaunch application start_server.launch

单独运行Flask

若想在本地单独运行Flask,建议使用Ubuntu中的pycharm 需要注释程序中与ROS相关的代码,如下:

init.py:

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)

order.py:

line 8:

from . import order_datastore, merchandise_manager, service, position_manager中去掉service

运行wsgi.py

python3 run wsgi.py

整体软件框架

structure

数据库设计

文件运行后会自动连接AGV_APP/db.sqlite3数据库,若在该路径下无此文件,会自动创建,路径配置在config.py文件。

由于时间有限,目前配置为当前虚拟机的绝对路径,若用其他虚拟机运行需要更改路径,后续开发过程中可以尝试改成相对路径

运行程序会对其初始化,初始化详细内容见models.py

需要注册账号: lucidchart

软件功能

已开发功能

class UML

UML

相关文件集合在utils文件夹中,代码注释中已标注功能及参数类型。开发以上utils类的目的是为程序提供数据库接口,避免在app代码中重复使用底层函数,如model.query.filter_by().first()等。在后续开发中,如遇到类似场景,应考虑开发新的类集成datastore,或在已有的类中添加新的函数,避免代码重复。

未开发功能

future plan 及SWD中提及的其他功能

注意

1.小车刚开机时需要一段时间初始化并连接网络,出现ssh: connect to host 10.20.240.247 port 22: No route to host属于正常现象,等待即可

2.只有在数据库order表中订单completed后,才可下达下一个订单