Instructions
- Disconnect the Mlink-esp Wi-fi module from the FanciSwarm drone.
- The ESP Wi-fi module uses an 8-pin UART protocol for setting up communication through AT commands (Hayes-style command set).
Connect the Mlink-esp Wi-fi module to the Mlink-esp debugger with the long side of the Wi-fi module (the side without pins) facing in the same direction as the USB of the debugger.
Open a serial monitor (e.g. Arduino IDE serial monitor, PuTTY) and configure the serial port connection (find the matching COM port or tty equivalent, depending on the OS).
Set the baud rate to 115200.
- Note that the
fcu_bridge_00X.cppfiles use a functional baud rate of 460800, while the networking module uses 115200. Do not change the functional baud rate to 115200, as this will cause errors.
Once configured, send the following AT commands:
AT+RSTto restart the module.AT+RESTOREto restore factory settings.AT+CWMODE_DEF=1to set to station mode (from the default AP mode).AT+CWJAP_DEF="WiFi Name","WiFi Password"to set the router name and password.AT+CIFSRto query and verify the IP address assigned to the Mlink networking module.
Select one of the six
fcu_bridge_00XC++ files, whereXis the number associated with one drone.In the chosen bridge file, refactor the IP address to match the IP address of your desired drone. You can find the IP address pointer on line 27, which will look something like
static char* DRONE_IP = "192.168.X.X";. After any changes, save your code.
Verify that you are refactoring the source code that is to be run in the Docker-ROS environment, and not a copy of the repository.
If you receive an error message later saying you’re not connected to bridge
X, it may be because you refactored a copy of the operating repository. You can debug and troubleshoot this problem by opening thesrcdirectory and tracing thefcu_corefiles withvim. If the code has not been edited, change it directly in the console withvimand save your changes withESC + w. To quitvim, runESC + q.
Verify that your machine is connected to the router Wi-fi as well.
Build a new Docker container for your ROS-based software repository and run
docker run -it --env="DISPLAY=$DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" --net=host -v $(pwd):/<project_directory> osrf/ros:noetic-desktop-full bashfrom the current project directory or change$(pwd)to a different path relative to your current directory.
- If you already have a Docker container build with all required dependencies to run the source code in a ROS environment, you may use
docker start <container_name>ordocker start <container ID>to avoid building multiple copies.
Run
apt updatethenapt install ros-noetic-serialandapt install libeigen3-devto install dependencies for the build requirements.apt install tmuxto install the terminal multiplexer, then runtmuxto launch it.Ctrl + Bthen%to split the session into two terminals.Ctrl + Bthen<-arrow key to move to the left terminal.Run
roscoreto set up the ROS network and configure communication between nodes.Ctrl + Bthen->to move to the right terminal.Repeat step 6, then compile the source code by running
catkin_makewhile in the root directory.Source the setup file by running
source setup.bashin your/develdirectory to configure environment variables for ROS.Launch the compiled software with
roslaunch fcu_core fcu_core.launchand verify all connections are functional.
- If you only refactored the bridge file for one drone, then you may receive warning logs in the console about other drone bridge networks that have not yet been connected.