Test Apps
The Dronecode Camera Manager (DCM) test apps (/test) provide a simple mechanism to test/validate different DCM functionality.
Build the Test Apps
Enter the following command from the DCM root directory to build the test apps:
make test
The tests are then run as described in the following sections.
Test Stream Discovery (test-rtsp-udp-stream-discovery)
This test validates RTSP and UDP stream discovery. It outputs all RTSP streams being published by Avahi.
To run this test app:
Start the DCM for your platform:
./dcm -c samples/config/ubuntu.conf
Use the DCM Configuration File for your platform (above we use the Ubuntu configuration).
In a separate terminal (or on another computer connected to the target drone on the same network) run the test app:
./test/test-rtsp-udp-stream-discovery
The program will output all published DCM streams. Below we show example output for a system with a single camera attached:
Service resolved: '/video0' (rtsp://10.0.2.15:8554/video0)
TXT: ["name=VirtualBox Webcam - Integrated " "frame_size[0]=MJPG(640x480,160x120,320x180,320x240,424x240,640x360,848x480,960x540,1280x720,1920x1080)"]
Test MAVLink Protocol (test-mavlink-protocol)
This is an interactive test of MAVLink stream publishing. The available streams are listed and the selected stream, with the selected resolution, is played.
To run this app:
- Start the DCM for your platform:
./dcm -c samples/config/ubuntu.conf
Use the DCM Configuration File for your platform (above we use the Ubuntu configuration).
- In a separate terminal (or on another computer connected to the target drone on the same network) run the test app:
./test/test-mavlink-protocol
The output will be similar to:
Open UDP [5]
Bind UDP [5] 0.0.0.0:14550
Dronecode Camera Manager found: sysid: 1
Streams found:
1 - Integrated_Webcam_HD
Please make your selection (type stream number):
1
Select Horizontal resolution (0 for default):
0
Select Vertical resolution (0 for default):
0
Stream Information:
Status: not streaming
Resolution: 1280x720
URI: rtsp://192.168.8.1:8554//video0
And if gstreamer client gst-launch-1.0 is installed, the selected video will be played.
Test Custom Streams (test-custom-stream)
This test app demonstrates how to extend DCM by adding extra streams. This app exports all streams exported by DCM and one extra stream with a dummy video generated by the videotestsrc gstreamer plugin.
The test source code accompanies the guide material in: Extend DCM > Camera Sample Custom.
To test it:
Run the example using configuration for your platform:
./test/test-custom-stream -c samples/config/ubuntu.conf
Use the DCM Configuration File for your platform (above we use the Ubuntu configuration).
Watch the video identified by /custom using vlc, for example:
vlc rtsp://192.168.1.1:8554/custom
- (Optional) Use the
-h
argument to list the test app's other command line options:./test/test-custom-stream -h
Unit Tests
Test Camera Parameters (test-camera-parameters)
This is a unit test for the camera parameters class. It verifies the storage and retrieval of different data types (stored as string) from map DS works well.
To run this app:
- Start the DCM for your platform:
./dcm -c samples/config/ubuntu.conf
Use the DCM Configuration File for your platform (above we use the Ubuntu configuration).
In a separate terminal (or on another computer connected to the target drone on the same network) run the test app:
./test/test-camera-parameters
The output will be similar to:
0: EXIT 1: Test Set-Get 2: Set Param 3: Get Param 99: Test uint32<->string conversion Please enter selection or enter 0 to exit
- Enter a selection. Depending on the selection you'll be prompted for a parameter ID string, type and/or value. Use these to test the round-trip behaviour for setting parameters.