ROS Kinetic Architecture
It is notable that all the nodes are converging into the /mainCode, which is where all the necessary control algorithm for the drone is placed. This is the node that is responsible to connect the pixhawk to the raspberry pi via MAVLink with the use of DroneKit-Python.
/serial_node is responsible for obtaining the location of the teddy bear via wireless transmission using a Lora telemetry module. The node /arduinoListener will subscribe to the topic /Location, which will generate a set of algorithm to process the information into usable data before publishing the /longitude and the /latitude to the /mainCode.
/terarangerone node(s) will converge into /teraListener, in which it processes all the necessary parameters for obstacle avoidance. It will publish a string that contains the status of the obstacle to the topic /obstacleStatus to the /mainCode.
/px4flow/opt_flow provides information such as flow_X, flow_Y, velocity_X, velocity_Y, ground_distance and the live images. All this information is used by the /mainCode for control purposes.
/current_vel provides the current velocity to determine the safety radius meant for obstacle avoidance.
roslaunch
Without using roslaunch, the user I required to run several nodes manually and this can be an absolute eye-sore as shown:
A launch file is created for the convenience of the user as it simplifies the whole process of starting up the nodes required for the application.
Before the use of roslaunch, it is required to run all the nodes below manually, one after another.
roscore
rosrun rosserial_python serial_node.py _portname:=/dev/ttyAMA0 _baudrate:=9600
python arduinoListener.py
rosrun terarangerone terarangerone_node _portname:=/dev/ttyUSB0
rosrun terarangerone2 terarangerone_node2 _portname:=/dev/ttyUSB1
rosrun terarangerone3 terarangerone_node3 _portname:=/dev/ttyUSB2
rosrun terarangerone4 terarangerone_node4 _portname:=/dev/ttyUSB3
python terarangerListener.py
rosrun px4flow opt_flow
rosrun image_view image_view image:=/px4flow/camera/image
python ROSmainCode2.py
However, roslaunch simplifies all the nodes by running:
roslaunch < -- package name -- > < -- launchfile.launch -- >
From within the roslaunch files, all the required nodes will be launched as shown:
In our case, we have created a ros package called < drone development > , with a launch file named < drone.launch >
Hence, we run the following command to startup roscore and all relevant nodes.
$roslaunch drone_development drone.launch