GAAS学习(一)Offboard基本控制
开源项目GAAS:
https://github.com/generalized-intelligence/GAAS
一、确保环境安装配置完成
ROS
Firmware
Mavros
Gazebo
及相关依赖
修改环境变量bashrc
sudo gedit ~/.bashrc
添加如下内容
source ~/Firmware/Tools/setup_gazebo.bash ~/Firmware/ ~/Firmware/build/posix_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/Firmware
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/Firmware/Tools/sitl_gazebo
检测:
出现如下界面,即环境没有问题
roslaunch px4 mavros_posix_sitl.launch
查看当前mavros状态
rostopic echo /mavros/state
其中 connected为 True,为连接成功
二、使用Gaas相关代码
git clone git@github.com:generalized-intelligence/GAAS.git
运行px4_mavros_run.py,起飞3m
python px4_mavros_run.py
主要部分代码如下:
def start(self):
#初始化节点
rospy.init_node("offboard_node")
#等待
for i in range(10):
if self.current_heading is not None:
break
else:
print("Waiting for initialization.")
time.sleep(0.5)