Documentation/P600 UAV WikiEnglish · Allspark2
Browse documentation
Additional documentation

GX40 Gimbal QR Code Click-to-Land

Familiarity with outdoor position hold flight is required first. The following demonstration uses Windows.

5 min read · English documentation
  • Familiarity with outdoor position-hold flight is required first.
  • The following demonstration uses Windows.
Note:
Due to the publication date of this tutorial and upgrades to product features and code:
1. The ground station version may differ from the version shown in this tutorial.
2. The names and order of custom demos in the function scripts may differ slightly.
3. The following tutorial assumes that the communication link, RTK/MID360 positioning, and Prometheus ground station are ready.

Check Whether the UAV Status Is Normal

Start RTK Positioning

  • Connect to the UAV in Connection Settings (the positioning source must be switched to RTK positioning).
  1. The status bar displays the current UAV status (whether the UAV flight controller is connected, the current flight mode, control status, RTK positioning status, whether the UAV is armed, etc.).
  2. The x, y, and z positions should be around 0, indicating that the positioning data is normal.
  3. A red Prometheus status indicator means that the status is abnormal. The figure below shows a normal status.

image.png

Check the Data

  1. It is normal for the initial position data to be close to 0.
  2. An excessive error in the initial position data, greater than 0.5, is abnormal (usually caused by an initial data-fusion error or accumulated error after multiple flights).

RTK positioning is normal

image.png

Note:
1. The following two scripts, ekf2 stop and ekf2 start, reinitialize EKF2 fusion for the flight controller's position data when the initial data is abnormal or the error is excessive under RTK/MID360 positioning.
2. Run these scripts while checking the data before takeoff. Do not click or use them during flight, as doing so may cause loss of positioning and a crash. (This will be updated later to prevent accidental activation; refer to the official release notes for the applicable behavior.)

Handling Abnormal Initial Data

  1. Click Function Scripts in the ground station.
  2. Click ekf2 stop.
  3. Click ekf2 start.

image.png

Start the Function Demo

  1. Click Function Scripts.
  2. Click GX40 Gimbal QR Code Landing.
  • The onboard command is: /home/amov/p600_experiment/src/p600_experiment/scripts/gimbalx_aruco_with_landing.sh
  1. A message confirming that the corresponding function demo has started appears.
Description
  1. After the function demo runs, the list of ROS nodes currently running on the onboard computer is displayed.
  2. The current CPU usage and CPU temperature are displayed.
Description

Retrieve the Gimbal Video

View the Stream URL

  1. Click System Settings.
  2. Click Streaming Settings.
  3. The default video stream URL is: rtsp://192.168.144.60:8554/live
    • The default configuration can be used.
Description

Display the Image in Video Monitoring

  1. Click Main Interface.
  2. Click Video Monitoring.
  3. Click Play to retrieve the video stream.
  4. The video stream is retrieved successfully.
Description

Take Off

  • The higher the UAV flies, the farther away it should be from the landing QR code.
GX40 gimbal zoom 1
Flight altitude 2.5 ~ 5 m
Distance from the landing QR code 2 ~ 4 m
  1. Move SW1 to the bottom position to arm the UAV. SW2, SW3, and SW4 should be in the top position at this time.
  2. The current Prometheus control status is INIT, which corresponds to the flight controller's POSITION mode.
  3. The UAV video is normal, and general-object recognition begins.
Description
  1. Move SW2 to the middle position.
  2. The current Prometheus control status is RC_POS_CONTROL, which is the flight controller's OFFBOARD mode.
Description
  1. Move SW2 to the bottom position. SW3 and SW4 should be in the top position at this time.
  2. The current Prometheus control status is COMMAND_CONTROL, which is also the flight controller's OFFBOARD mode.
  • The UAV will hover at its current position.
Description
Note:
1. While in POSITION mode, you can first manually point the gimbal toward the QR code and then click the target QR code to put the gimbal into recognition mode. Then switch to Prometheus-controlled COMMAND_CONTROL mode.
2. Alternatively, after switching to Prometheus-controlled COMMAND_CONTROL mode, manually point the gimbal toward the QR code and then click the target QR code. The UAV will immediately move toward the QR code.
3. After entering Prometheus-controlled COMMAND_CONTROL mode, the UAV responds to control commands from the onboard computer. You do not need to operate the remote controller at this time and can set it aside while continuing to monitor the flight.
4. If the UAV status becomes abnormal, take manual control with the remote controller, move SW2 to the top position, and land the UAV manually.

Adjust the Gimbal View

  1. Click Manual Control.
  2. In the video, press and hold the left mouse button and drag up, down, left, or right to rotate the gimbal in the corresponding direction.
  • Adjust the gimbal view to ensure that the QR code is visible in the video.
Description

Run the Gimbal Landing Function

  1. Click Click.
  2. Recognized targets are enclosed in boxes and labeled with their QR code IDs. (The system is in recognition mode at this point and has not started tracking.)
Description
  • Click the recognized target. The UAV enters tracking mode, moves toward the target QR code, and begins the automatic landing procedure.
Description
  • The UAV automatically flies above the landing QR code.
Description
  • After descending to a certain height above the QR code, the UAV begins horizontal alignment and continues descending once aligned.
Description

Cancel the Gimbal Landing Function

  • After the UAV automatically flies above the landing QR code but before the gimbal angle is commanded to point downward, the UAV remains in QR-code recognition mode. In this state, you can cancel the QR-code landing function while the UAV is under onboard-program control.
  1. Select Click.
  2. Right-click in the video to cancel tracking. The UAV will hover at its current position.
Description
  • A UAV in OFFBOARD mode can be switched to POSITION mode at any time for manual takeover. You can then restart the program.

Handling Abnormal UAV States

Unable to Recognize the Landing QR Code

  1. Method 1: Manually fly close to the QR code.
  2. Method 2: Manually adjust the gimbal angle to ensure that it points toward the QR code.
Description

The Gimbal Keeps Rotating After Recognizing the QR Code, and the UAV Cannot Land

  • Land manually and then run the function again.

Function Parameters

  • The script used by this function is:
`/home/amov/p600_experiment/src/p600_experiment/scripts/gimbalx_aruco_with_landing.sh`
  • The script contents are as follows:
gnome-terminal --window -e 'bash -c "roslaunch p600_experiment gimbalx_server.launch; exec bash"' \
--tab -e 'bash -c "sleep 2; roslaunch p600_experiment gx40_aruco_clicked_tracking.launch; exec bash"' \
--tab -e 'bash -c "sleep 4; roslaunch p600_experiment gimbalx_aruco_with_landing.launch; exec bash"' \

Gimbal Driver

  • The contents of gimbalx_server.launch are as follows:
  • File path:

/home/amov/p600_experiment/src/p600_experiment/launch_spirecv/gimbalx_server.launch

<launch>
    <node pkg="spirecv_ros" type="gimbal_server" name="gimbal_server" output="screen">
        <param name="Type" type="string" value="GX40" />
        <param name="Port" type="string" value="/dev/ttyTHS1" />
        <param name="camera" type="string" value="192.168.144.108" />
        <param name="FPS" type="int" value="30" />
        <param name="H" type="int" value="720" />
        <param name="W" type="int" value="1280" />
    </node>
</launch>

Gimbal Tracking

  • The contents of gx40_aruco_clicked_tracking.launch are as follows:
  • File path:

/home/amov/p600_experiment/src/p600_experiment/launch_spirecv/gx40_aruco_clicked_tracking.launch

<launch>
    <node pkg="spirecv_ros" type="gimbal_aruco_clicked_tracking" name="gimbal_aruco_clicked_tracking" output="screen">
        <param name="uav_id" type="int" value="1" />
        <param name="camera_parameters" type="string" value="$(find spirecv_ros)/camera_params/calib_gx40_720.yaml" />
        <param name="local_saving_path" type="string" value="$(find spirecv_ros)" />
        <param name="input_image_topic" type="string" value="/uav1/gimbal/image_original" />
	    <param name="output_image_topic" type="string" value="/uav1/spirecv/image_det" />
    </node>
</launch>

UAV Landing

  • The contents of gimbalx_aruco_with_landing.launch are as follows:
  • File path:

/home/amov/p600_experiment/src/p600_experiment/launch_spirecv/gimbalx_aruco_with_landing.launch

<launch>
    <node pkg="p600_mission" type="gimbal_aruco_landing" name="gimbal_aruco_landing" output="screen">
		<param name="uav_id" value="1" />
		
            	<param name="kp_x" type="double" value="0.4" />
            	
            	<param name="kp_z" type="double" value="0.5" />
            	
            	<param name="kp_gimbal" type="double" value="1.0" />
            	
            	<param name="max_velocity" type="double" value="2.5" />
            	
            	<param name="max_yaw_rate" type="double" value="40" />
            	
            	<param name="ignore_error_pitch" type="double" value="5.0" />
            	
            	<param name="land_height" type="double" value="0.7" />
            	
            	<param name="max_height" type="double" value="5.0" />
            	
            	<param name="max_lost_time" type="double" value="10.0" />
            	
            	<param name="min_lost_time" type="double" value="1.0" />	
            	
            	<param name="static_vel_thresh" type="double" value="0.03" />
            	
            	<param name="gimbal_offset" type="double" value="0.1" />
	</node>
</launch>