# HuaShan_Algorithm **Repository Path**: luojiong666/huashan_algorithm ## Basic Information - **Project Name**: HuaShan_Algorithm - **Description**: 完成px4在环规划+控制仿真 - **Primary Language**: Python - **License**: AGPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-05-31 - **Last Updated**: 2023-05-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # min_drone_ws ## 1 About This project (as a ROS workspace) provides a minimum trajectory planning and tracking demo with PX4 SITL. ![demo](https://raw.githubusercontent.com/Amos-Chen98/Image_bed/main/2023/202305241206250.gif) ## 2 Installation ### 2.1 Prerequisites 1. Install required framework and softwares. Before using this project, please make sure the following dependencies have been successfully installed and configured. * ROS1 with Gazebo: https://wiki.ros.org/noetic/Installation/Ubuntu * PX4-Autopilot: ```bash git clone https://github.com/PX4/PX4-Autopilot.git cd PX4-Autopilot git checkout v1.13.2 git submodule update --init --recursive bash Tools/setup/ubuntu.sh make px4_sitl gazebo ``` Ref: https://docs.px4.io/main/en/dev_setup/dev_env_linux_ubuntu.html * Mavros: https://docs.px4.io/main/en/ros/mavros_installation.html * QGC: https://docs.qgroundcontrol.com/master/en/getting_started/download_and_install.html **Note: Remember to enable Virtual Joystick in Application Settings in QGC, otherwise, the drone will refuse to enter OFFBOARD mode.** 2. Install required packages ``` pip install pyquaternion pip install scipy pip install transitions ``` ### 2.2 Install this project (as a ROS workspace) 1. Clone and build this repo: ``` git clone https://gitee.com/bhswift/min_drone_ws.git cd min_drone_ws catkin build ``` 2. Configure the environment variables: Add the following lines to `.bashrc` ```bash source /devel/setup.bash source ~/PX4-Autopilot/Tools/setup_gazebo.bash ~/PX4-Autopilot ~/PX4-Autopilot/build/px4_sitl_default export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/PX4-Autopilot export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/PX4-Autopilot/Tools/sitl_gazebo export GAZEBO_PLUGIN_PATH=$GAZEBO_PLUGIN_PATH:/usr/lib/x86_64-linux-gnu/gazebo-11/plugins ``` ## 3 Usage First, launch QGC with Virtual Joystick enabled, then launch the simulator: ```bash roslaunch traj_generator sim_empty.launch ``` In one terminal, run planner node: ``` rosrun traj_generator traj_planner_node.py ``` In another terminal, run manager node: ``` rosrun traj_generator manager_node.py ``` if you want to publish dynamic environment imformation(such as obstacle and goal position): ``` rosrun traj_generator dyc_env_pub.py ``` When the manager node starts, the drone will take off immediately. The manager node holds an FSM, please pay attention to the status output by the manager node. Now use the `2D Nav Goal` to set a few waypoints in RViz. When the number of waypoints reaches the predefined number (default is 8), trajectory generation will be triggered automatically and you will see the drone tracking the trajectory. If you find this repository useful, please kindly leave a star ⭐, thanks!😀