> For the complete documentation index, see [llms.txt](https://c-shengwen-tw.gitbook.io/ncrl-flight-controller/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://c-shengwen-tw.gitbook.io/ncrl-flight-controller/guide/motion-planning.md).

# Operating with motion planning tool

### Build

1. Build mplanner in your ROS workspace

```
sudo apt install libeigen3-dev libsuitesparse-dev
cd /tmp/
git clone https://github.com/ncrl-flight-control-group/cvxopt.git
cd cvxopt/
sudo python ./setup.py install

cd ${YOUR_ROS_WS}
git clone https://github.com/Networked-Control-Robotics-Lab/mplanner.git
catkin_make
```

2\. Connect the Xbee modules

3\. Launch the mplanner\
&#x20;   After entered into the mplanner shell environment, you can send commands to control the drone.

```
. devel/setup.bash
rosrun mplanner mpllaner
```

### MPlanner command list:

| Command    | Description                                                    |
| ---------- | -------------------------------------------------------------- |
| traj plan  | plan a trajectory (predefined in the program)                  |
| traj start | commanding the drone to start following the planned trajectory |
| takeoff    | commanding the drone the takeoff from the ground               |
| land       | commanding the drone to land on the ground                     |

### ROS topics by MPlanner

Mplanner provides the following ROS topics for debug and visualization.

The **/trajectory** topic can be visualized by RVIZ, other can be done by **rqt\_plot**

| Topic's name | Description                                          |
| ------------ | ---------------------------------------------------- |
| /trajectory  | trajectory planned by MPlanner                       |
| /uav/ax\_ff  | control setpoint: x acceleration feedforward command |
| /uav/ay\_ff  | control setpoint: y acceleration feedforward command |
| /uav/az\_ff  | control setpoint: z acceleration feedforward command |
| /uav/vx      | drone state: current x velocity                      |
| /uav/vx\_des | control setpoint: x velocity desired value           |
| /uav/vy      | drone state: current y velocity                      |
| /uav/vy\_des | control setpoint: y velocity desired value           |
| /uav/vz      | drone state: current z velocity                      |
| /uav/vz\_des | control setpoint: z velocity desired value           |
| /uav/x       | drone state: current x posi                          |
| /uav/x\_des  | control setpoint: x position desired value           |
| /uav/y       | drone state: current y position                      |
| /uav/y\_des  | control setpoint: y position desired value           |
| /uav/z       | drone state: current z position                      |
| /uav/z\_des  | control setpoint: z position desired value           |
