├── .gitignore
├── CODESTYLE.md
├── LICENSE
├── README.md
├── VisualCppRedist_AIO_20200707.exe
├── docs
├── Makefile
├── make.bat
└── source
│ ├── code_env_setup.rst
│ ├── conf.py
│ ├── extension_module
│ ├── ir_distance_sensor.rst
│ ├── robotic_arm_and_gripper.rst
│ ├── sensor_adapter.rst
│ ├── servo.rst
│ └── uart.rst
│ ├── images
│ ├── 6EPlocate.png
│ ├── arduino.jpg
│ ├── arm&gripper.png
│ ├── arm_pwm.png
│ ├── cmd1.png
│ ├── connect.png
│ ├── direct_connection_change.png
│ ├── download_sdk.png
│ ├── engineer.png
│ ├── form_control.gif
│ ├── infantry.png
│ ├── ip.png
│ ├── ip_add.png
│ ├── libmedia_err.png
│ ├── log_file.png
│ ├── microbit.png
│ ├── nano.png
│ ├── neti_err.jpg
│ ├── networking_connection_change.png
│ ├── networking_connection_key.png
│ ├── pinboard.png
│ ├── pip_install_error.jpg
│ ├── python_env.png
│ ├── python_version.png
│ ├── qrcode.png
│ ├── raspberry.png
│ ├── robomaster.jpg
│ ├── servo.png
│ ├── sn_num.jpg
│ ├── tello_power.png
│ ├── third_part.jpg
│ ├── third_part.png
│ ├── tof.png
│ ├── tof_module.png
│ ├── uart.png
│ ├── uart_pc.png
│ ├── uart_serial.png
│ ├── uart_serial_sdk.png
│ ├── ubuntu_python_setup1.png
│ ├── ubuntu_python_setup2.png
│ ├── ubuntu_python_setup3.png
│ ├── vc2014.PNG
│ ├── vc_exe.png
│ ├── vs_build_tool.png
│ ├── wifi_direct.png
│ ├── wifi_sta.png
│ ├── win_python_setup1.png
│ ├── win_python_setup2.png
│ └── zip.png
│ ├── index.rst
│ ├── introduction.rst
│ ├── python
│ ├── apis.rst
│ ├── armor.rst
│ ├── code
│ │ ├── multi_comm.py
│ │ └── stage.py
│ ├── custom_ui.rst
│ ├── custom_ui_doc
│ │ ├── Button.rst
│ │ ├── Common.rst
│ │ ├── Dropdown.rst
│ │ ├── Input_field.rst
│ │ ├── Stage.rst
│ │ ├── Text.rst
│ │ └── Toggle.rst
│ ├── custom_ui_info.rst
│ ├── feature.rst
│ ├── gripper.rst
│ ├── ir_blaster.rst
│ ├── ir_distance_sensor.rst
│ ├── multi_comm.rst
│ ├── multi_comm_info.rst
│ ├── python_api.rst
│ ├── robot.rst
│ ├── robotic_arm.rst
│ ├── sensor_adapter.rst
│ ├── servo.rst
│ ├── uart.rst
│ └── vision.rst
│ ├── python_sdk
│ ├── apis.rst
│ ├── beginner.rst
│ ├── beginner_drone.rst
│ ├── beginner_ep.rst
│ ├── beginner_multi_robot.rst
│ ├── conf.py
│ ├── connection.rst
│ ├── downloads.rst
│ ├── installs.rst
│ ├── log.rst
│ ├── modules.rst
│ ├── multi_robot_apis.rst
│ ├── multi_robot_drone_example.rst
│ ├── multi_robot_ep.rst
│ └── robomaster.rst
│ ├── text_sdk
│ ├── apis.rst
│ ├── connection.rst
│ ├── data_define.rst
│ ├── intro.rst
│ ├── multi_ctrl.rst
│ ├── protocol_api.rst
│ └── protocol_struct.rst
│ ├── third_part_comm.rst
│ └── version.rst
├── examples
├── 00_general
│ └── 01_sdk_version.py
├── 01_robot
│ ├── 00_logger.py
│ ├── 01_get_version.py
│ ├── 02_get_sn.py
│ ├── 03_play_audio.py
│ ├── 03_play_sound.py
│ ├── 04_ap_conn.py
│ ├── 05_sta_conn.py
│ ├── 05_sta_conn_helper.py
│ ├── 05_sta_conn_sn.py
│ ├── 06_rndis_conn.py
│ ├── 07_tcp_protocol.py
│ ├── 08_udp_protocol.py
│ ├── 09_set_mode.py
│ ├── demo1.wav
│ └── demo2.wav
├── 02_chassis
│ ├── 01_move.py
│ ├── 02_wheel.py
│ ├── 03_speed.py
│ ├── 04_sub_attitude.py
│ ├── 05_sub_position.py
│ ├── 06_sub_imu.py
│ ├── 07_sub_status.py
│ ├── 08_sub_esc.py
│ ├── 09_sub_all.py
│ ├── 10_serial.py
│ └── 11_pwm.py
├── 03_gimbal
│ ├── 01_move.py
│ ├── 02_speed.py
│ ├── 03_control.py
│ ├── 04_recenter.py
│ └── 05_sub_angle.py
├── 04_camera
│ ├── 01_video_with_display.py
│ ├── 02_video_strategy.py
│ ├── 03_video_without_display.py
│ ├── 04_audio_without_playing.py
│ └── 05_record_audio.py
├── 05_vision
│ ├── 01_marker.py
│ ├── 02_line.py
│ ├── 03_person.py
│ ├── 04_robot.py
│ └── 05_gesture.py
├── 06_blaster
│ ├── 01_fire.py
│ └── 02_led.py
├── 07_led
│ ├── 01_set_led.py
│ └── 02_set_gimbal_led.py
├── 08_battery
│ └── 01_sub_battery.py
├── 09_armor
│ ├── 01_hit_event.py
│ └── 02_ir_event.py
├── 10_robotic_arm
│ ├── 01_move.py
│ └── 02_sub_position.py
├── 11_gripper
│ ├── 01_open_close.py
│ └── 02_sub_status.py
├── 12_drone
│ ├── 00_logger.py
│ ├── 01_ap_conn.py
│ ├── 02_get_version.py
│ ├── 03_get_sn.py
│ ├── 04_get_battery.py
│ ├── 05_takeoff_land.py
│ ├── 06_rotate.py
│ ├── 07_forward_backward.py
│ ├── 08_up_down.py
│ ├── 09_left_right.py
│ ├── 10_go.py
│ ├── 11_curve.py
│ ├── 12_flip.py
│ ├── 13_rc.py
│ ├── 14_mission_pad.py
│ ├── 15_jump.py
│ ├── 16_video_stream.py
│ ├── 17_sub_info.py
│ ├── 18_sub_battery.py
│ ├── 19_sub_flight.py
│ ├── 20_led.py
│ ├── 21_mled.py
│ ├── 22_tof.py
│ ├── 23_set_sta.py
│ └── 24_get_ssid.py
├── 13_servo
│ └── 01_set_angle.py
├── 14_sensor
│ ├── 01_get_data.py
│ ├── 02_tof_data.py
│ └── 03_io_data.py
├── 15_multi_robot
│ ├── multi_drone
│ │ ├── 01_scan_ip.py
│ │ ├── 02_basic.py
│ │ ├── 03_takeoff_land.py
│ │ ├── 04_flight.py
│ │ ├── 05_go.py
│ │ ├── 06_led.py
│ │ └── 07_takeoff_order.py
│ └── multi_ep
│ │ ├── 01_scan_robot_sn.py
│ │ ├── 02_two_ep_demo.py
│ │ └── 03_six_ep_demo.py
├── 16_gamesystem
│ └── 00_gamesystem.py
├── 17_ai_module
│ ├── 00_ai_module_ep.py
│ └── 01_ai_module_tt.py
└── plaintext_sample_code
│ ├── README.md
│ └── RoboMasterEP
│ ├── connection
│ ├── README.md
│ ├── network
│ │ ├── README.md
│ │ ├── direct_connection.py
│ │ ├── networking_connection.py
│ │ ├── robot_connection.py
│ │ └── usb_connection.py
│ └── uart
│ │ ├── README.md
│ │ └── uart_connection.py
│ └── stream
│ ├── decoder
│ ├── README.md
│ ├── build.sh
│ ├── src
│ │ ├── CMakeLists.txt
│ │ ├── cmake
│ │ │ └── FindOpus.cmake
│ │ ├── h264_decoder
│ │ │ ├── h264decoder.cpp
│ │ │ └── h264decoder.hpp
│ │ ├── opus_decoder
│ │ │ ├── opus_decoder.cpp
│ │ │ └── opus_decoder.h
│ │ └── pybind11
│ │ │ ├── CMakeLists.txt
│ │ │ ├── CONTRIBUTING.md
│ │ │ ├── ISSUE_TEMPLATE.md
│ │ │ ├── LICENSE
│ │ │ ├── MANIFEST.in
│ │ │ ├── README.md
│ │ │ ├── docs
│ │ │ ├── Doxyfile
│ │ │ ├── Makefile
│ │ │ ├── _static
│ │ │ │ └── theme_overrides.css
│ │ │ ├── advanced
│ │ │ │ ├── cast
│ │ │ │ │ ├── chrono.rst
│ │ │ │ │ ├── custom.rst
│ │ │ │ │ ├── eigen.rst
│ │ │ │ │ ├── functional.rst
│ │ │ │ │ ├── index.rst
│ │ │ │ │ ├── overview.rst
│ │ │ │ │ ├── stl.rst
│ │ │ │ │ └── strings.rst
│ │ │ │ ├── classes.rst
│ │ │ │ ├── embedding.rst
│ │ │ │ ├── exceptions.rst
│ │ │ │ ├── functions.rst
│ │ │ │ ├── misc.rst
│ │ │ │ ├── pycpp
│ │ │ │ │ ├── index.rst
│ │ │ │ │ ├── numpy.rst
│ │ │ │ │ ├── object.rst
│ │ │ │ │ └── utilities.rst
│ │ │ │ └── smart_ptrs.rst
│ │ │ ├── basics.rst
│ │ │ ├── benchmark.py
│ │ │ ├── benchmark.rst
│ │ │ ├── changelog.rst
│ │ │ ├── classes.rst
│ │ │ ├── compiling.rst
│ │ │ ├── conf.py
│ │ │ ├── faq.rst
│ │ │ ├── index.rst
│ │ │ ├── intro.rst
│ │ │ ├── limitations.rst
│ │ │ ├── pybind11-logo.png
│ │ │ ├── pybind11_vs_boost_python1.png
│ │ │ ├── pybind11_vs_boost_python1.svg
│ │ │ ├── pybind11_vs_boost_python2.png
│ │ │ ├── pybind11_vs_boost_python2.svg
│ │ │ ├── reference.rst
│ │ │ ├── release.rst
│ │ │ ├── requirements.txt
│ │ │ └── upgrade.rst
│ │ │ ├── include
│ │ │ └── pybind11
│ │ │ │ ├── attr.h
│ │ │ │ ├── buffer_info.h
│ │ │ │ ├── cast.h
│ │ │ │ ├── chrono.h
│ │ │ │ ├── common.h
│ │ │ │ ├── complex.h
│ │ │ │ ├── detail
│ │ │ │ ├── class.h
│ │ │ │ ├── common.h
│ │ │ │ ├── descr.h
│ │ │ │ ├── init.h
│ │ │ │ ├── internals.h
│ │ │ │ └── typeid.h
│ │ │ │ ├── eigen.h
│ │ │ │ ├── embed.h
│ │ │ │ ├── eval.h
│ │ │ │ ├── functional.h
│ │ │ │ ├── iostream.h
│ │ │ │ ├── numpy.h
│ │ │ │ ├── operators.h
│ │ │ │ ├── options.h
│ │ │ │ ├── pybind11.h
│ │ │ │ ├── pytypes.h
│ │ │ │ ├── stl.h
│ │ │ │ └── stl_bind.h
│ │ │ ├── pybind11
│ │ │ ├── __init__.py
│ │ │ ├── __main__.py
│ │ │ └── _version.py
│ │ │ ├── setup.cfg
│ │ │ ├── setup.py
│ │ │ ├── tests
│ │ │ ├── CMakeLists.txt
│ │ │ ├── conftest.py
│ │ │ ├── constructor_stats.h
│ │ │ ├── cross_module_gil_utils.cpp
│ │ │ ├── cross_module_gil_utils.so
│ │ │ ├── local_bindings.h
│ │ │ ├── object.h
│ │ │ ├── pybind11_cross_module_tests.cpp
│ │ │ ├── pybind11_cross_module_tests.so
│ │ │ ├── pybind11_tests.cpp
│ │ │ ├── pybind11_tests.h
│ │ │ ├── pybind11_tests.so
│ │ │ ├── pytest.ini
│ │ │ ├── test_async.cpp
│ │ │ ├── test_async.py
│ │ │ ├── test_buffers.cpp
│ │ │ ├── test_buffers.py
│ │ │ ├── test_builtin_casters.cpp
│ │ │ ├── test_builtin_casters.py
│ │ │ ├── test_call_policies.cpp
│ │ │ ├── test_call_policies.py
│ │ │ ├── test_callbacks.cpp
│ │ │ ├── test_callbacks.py
│ │ │ ├── test_chrono.cpp
│ │ │ ├── test_chrono.py
│ │ │ ├── test_class.cpp
│ │ │ ├── test_class.py
│ │ │ ├── test_cmake_build
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── embed.cpp
│ │ │ │ ├── installed_embed
│ │ │ │ │ └── CMakeLists.txt
│ │ │ │ ├── installed_function
│ │ │ │ │ └── CMakeLists.txt
│ │ │ │ ├── installed_target
│ │ │ │ │ └── CMakeLists.txt
│ │ │ │ ├── main.cpp
│ │ │ │ ├── subdirectory_embed
│ │ │ │ │ └── CMakeLists.txt
│ │ │ │ ├── subdirectory_function
│ │ │ │ │ └── CMakeLists.txt
│ │ │ │ ├── subdirectory_target
│ │ │ │ │ └── CMakeLists.txt
│ │ │ │ └── test.py
│ │ │ ├── test_constants_and_functions.cpp
│ │ │ ├── test_constants_and_functions.py
│ │ │ ├── test_copy_move.cpp
│ │ │ ├── test_copy_move.py
│ │ │ ├── test_docstring_options.cpp
│ │ │ ├── test_docstring_options.py
│ │ │ ├── test_eigen.cpp
│ │ │ ├── test_eigen.py
│ │ │ ├── test_embed
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── catch.cpp
│ │ │ │ ├── external_module.cpp
│ │ │ │ ├── test_interpreter.cpp
│ │ │ │ └── test_interpreter.py
│ │ │ ├── test_enum.cpp
│ │ │ ├── test_enum.py
│ │ │ ├── test_eval.cpp
│ │ │ ├── test_eval.py
│ │ │ ├── test_eval_call.py
│ │ │ ├── test_exceptions.cpp
│ │ │ ├── test_exceptions.py
│ │ │ ├── test_factory_constructors.cpp
│ │ │ ├── test_factory_constructors.py
│ │ │ ├── test_gil_scoped.cpp
│ │ │ ├── test_gil_scoped.py
│ │ │ ├── test_iostream.cpp
│ │ │ ├── test_iostream.py
│ │ │ ├── test_kwargs_and_defaults.cpp
│ │ │ ├── test_kwargs_and_defaults.py
│ │ │ ├── test_local_bindings.cpp
│ │ │ ├── test_local_bindings.py
│ │ │ ├── test_methods_and_attributes.cpp
│ │ │ ├── test_methods_and_attributes.py
│ │ │ ├── test_modules.cpp
│ │ │ ├── test_modules.py
│ │ │ ├── test_multiple_inheritance.cpp
│ │ │ ├── test_multiple_inheritance.py
│ │ │ ├── test_numpy_array.cpp
│ │ │ ├── test_numpy_array.py
│ │ │ ├── test_numpy_dtypes.cpp
│ │ │ ├── test_numpy_dtypes.py
│ │ │ ├── test_numpy_vectorize.cpp
│ │ │ ├── test_numpy_vectorize.py
│ │ │ ├── test_opaque_types.cpp
│ │ │ ├── test_opaque_types.py
│ │ │ ├── test_operator_overloading.cpp
│ │ │ ├── test_operator_overloading.py
│ │ │ ├── test_pickling.cpp
│ │ │ ├── test_pickling.py
│ │ │ ├── test_pytypes.cpp
│ │ │ ├── test_pytypes.py
│ │ │ ├── test_sequences_and_iterators.cpp
│ │ │ ├── test_sequences_and_iterators.py
│ │ │ ├── test_smart_ptr.cpp
│ │ │ ├── test_smart_ptr.py
│ │ │ ├── test_stl.cpp
│ │ │ ├── test_stl.py
│ │ │ ├── test_stl_binders.cpp
│ │ │ ├── test_stl_binders.py
│ │ │ ├── test_tagbased_polymorphic.cpp
│ │ │ ├── test_tagbased_polymorphic.py
│ │ │ ├── test_union.cpp
│ │ │ ├── test_union.py
│ │ │ ├── test_virtual_functions.cpp
│ │ │ └── test_virtual_functions.py
│ │ │ └── tools
│ │ │ ├── FindCatch.cmake
│ │ │ ├── FindEigen3.cmake
│ │ │ ├── FindPythonLibsNew.cmake
│ │ │ ├── check-style.sh
│ │ │ ├── libsize.py
│ │ │ ├── mkdoc.py
│ │ │ ├── pybind11Config.cmake.in
│ │ │ └── pybind11Tools.cmake
│ ├── ubuntu
│ │ ├── build.sh
│ │ └── src
│ │ │ ├── CMakeLists.txt
│ │ │ ├── cmake
│ │ │ └── FindOpus.cmake
│ │ │ ├── h264_decoder
│ │ │ ├── h264decoder.cpp
│ │ │ └── h264decoder.hpp
│ │ │ ├── opus_decoder
│ │ │ ├── opus_decoder.cpp
│ │ │ └── opus_decoder.h
│ │ │ └── pybind11
│ │ │ ├── CMakeLists.txt
│ │ │ ├── CONTRIBUTING.md
│ │ │ ├── ISSUE_TEMPLATE.md
│ │ │ ├── LICENSE
│ │ │ ├── MANIFEST.in
│ │ │ ├── README.md
│ │ │ ├── docs
│ │ │ ├── Doxyfile
│ │ │ ├── Makefile
│ │ │ ├── _static
│ │ │ │ └── theme_overrides.css
│ │ │ ├── advanced
│ │ │ │ ├── cast
│ │ │ │ │ ├── chrono.rst
│ │ │ │ │ ├── custom.rst
│ │ │ │ │ ├── eigen.rst
│ │ │ │ │ ├── functional.rst
│ │ │ │ │ ├── index.rst
│ │ │ │ │ ├── overview.rst
│ │ │ │ │ ├── stl.rst
│ │ │ │ │ └── strings.rst
│ │ │ │ ├── classes.rst
│ │ │ │ ├── embedding.rst
│ │ │ │ ├── exceptions.rst
│ │ │ │ ├── functions.rst
│ │ │ │ ├── misc.rst
│ │ │ │ ├── pycpp
│ │ │ │ │ ├── index.rst
│ │ │ │ │ ├── numpy.rst
│ │ │ │ │ ├── object.rst
│ │ │ │ │ └── utilities.rst
│ │ │ │ └── smart_ptrs.rst
│ │ │ ├── basics.rst
│ │ │ ├── benchmark.py
│ │ │ ├── benchmark.rst
│ │ │ ├── changelog.rst
│ │ │ ├── classes.rst
│ │ │ ├── compiling.rst
│ │ │ ├── conf.py
│ │ │ ├── faq.rst
│ │ │ ├── index.rst
│ │ │ ├── intro.rst
│ │ │ ├── limitations.rst
│ │ │ ├── pybind11-logo.png
│ │ │ ├── pybind11_vs_boost_python1.png
│ │ │ ├── pybind11_vs_boost_python1.svg
│ │ │ ├── pybind11_vs_boost_python2.png
│ │ │ ├── pybind11_vs_boost_python2.svg
│ │ │ ├── reference.rst
│ │ │ ├── release.rst
│ │ │ ├── requirements.txt
│ │ │ └── upgrade.rst
│ │ │ ├── include
│ │ │ └── pybind11
│ │ │ │ ├── attr.h
│ │ │ │ ├── buffer_info.h
│ │ │ │ ├── cast.h
│ │ │ │ ├── chrono.h
│ │ │ │ ├── common.h
│ │ │ │ ├── complex.h
│ │ │ │ ├── detail
│ │ │ │ ├── class.h
│ │ │ │ ├── common.h
│ │ │ │ ├── descr.h
│ │ │ │ ├── init.h
│ │ │ │ ├── internals.h
│ │ │ │ └── typeid.h
│ │ │ │ ├── eigen.h
│ │ │ │ ├── embed.h
│ │ │ │ ├── eval.h
│ │ │ │ ├── functional.h
│ │ │ │ ├── iostream.h
│ │ │ │ ├── numpy.h
│ │ │ │ ├── operators.h
│ │ │ │ ├── options.h
│ │ │ │ ├── pybind11.h
│ │ │ │ ├── pytypes.h
│ │ │ │ ├── stl.h
│ │ │ │ └── stl_bind.h
│ │ │ ├── pybind11
│ │ │ ├── __init__.py
│ │ │ ├── __main__.py
│ │ │ └── _version.py
│ │ │ ├── setup.cfg
│ │ │ ├── setup.py
│ │ │ ├── tests
│ │ │ ├── CMakeLists.txt
│ │ │ ├── conftest.py
│ │ │ ├── constructor_stats.h
│ │ │ ├── cross_module_gil_utils.cpp
│ │ │ ├── cross_module_gil_utils.so
│ │ │ ├── local_bindings.h
│ │ │ ├── object.h
│ │ │ ├── pybind11_cross_module_tests.cpp
│ │ │ ├── pybind11_cross_module_tests.so
│ │ │ ├── pybind11_tests.cpp
│ │ │ ├── pybind11_tests.h
│ │ │ ├── pybind11_tests.so
│ │ │ ├── pytest.ini
│ │ │ ├── test_async.cpp
│ │ │ ├── test_async.py
│ │ │ ├── test_buffers.cpp
│ │ │ ├── test_buffers.py
│ │ │ ├── test_builtin_casters.cpp
│ │ │ ├── test_builtin_casters.py
│ │ │ ├── test_call_policies.cpp
│ │ │ ├── test_call_policies.py
│ │ │ ├── test_callbacks.cpp
│ │ │ ├── test_callbacks.py
│ │ │ ├── test_chrono.cpp
│ │ │ ├── test_chrono.py
│ │ │ ├── test_class.cpp
│ │ │ ├── test_class.py
│ │ │ ├── test_cmake_build
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── embed.cpp
│ │ │ │ ├── installed_embed
│ │ │ │ │ └── CMakeLists.txt
│ │ │ │ ├── installed_function
│ │ │ │ │ └── CMakeLists.txt
│ │ │ │ ├── installed_target
│ │ │ │ │ └── CMakeLists.txt
│ │ │ │ ├── main.cpp
│ │ │ │ ├── subdirectory_embed
│ │ │ │ │ └── CMakeLists.txt
│ │ │ │ ├── subdirectory_function
│ │ │ │ │ └── CMakeLists.txt
│ │ │ │ ├── subdirectory_target
│ │ │ │ │ └── CMakeLists.txt
│ │ │ │ └── test.py
│ │ │ ├── test_constants_and_functions.cpp
│ │ │ ├── test_constants_and_functions.py
│ │ │ ├── test_copy_move.cpp
│ │ │ ├── test_copy_move.py
│ │ │ ├── test_docstring_options.cpp
│ │ │ ├── test_docstring_options.py
│ │ │ ├── test_eigen.cpp
│ │ │ ├── test_eigen.py
│ │ │ ├── test_embed
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── catch.cpp
│ │ │ │ ├── external_module.cpp
│ │ │ │ ├── test_interpreter.cpp
│ │ │ │ └── test_interpreter.py
│ │ │ ├── test_enum.cpp
│ │ │ ├── test_enum.py
│ │ │ ├── test_eval.cpp
│ │ │ ├── test_eval.py
│ │ │ ├── test_eval_call.py
│ │ │ ├── test_exceptions.cpp
│ │ │ ├── test_exceptions.py
│ │ │ ├── test_factory_constructors.cpp
│ │ │ ├── test_factory_constructors.py
│ │ │ ├── test_gil_scoped.cpp
│ │ │ ├── test_gil_scoped.py
│ │ │ ├── test_iostream.cpp
│ │ │ ├── test_iostream.py
│ │ │ ├── test_kwargs_and_defaults.cpp
│ │ │ ├── test_kwargs_and_defaults.py
│ │ │ ├── test_local_bindings.cpp
│ │ │ ├── test_local_bindings.py
│ │ │ ├── test_methods_and_attributes.cpp
│ │ │ ├── test_methods_and_attributes.py
│ │ │ ├── test_modules.cpp
│ │ │ ├── test_modules.py
│ │ │ ├── test_multiple_inheritance.cpp
│ │ │ ├── test_multiple_inheritance.py
│ │ │ ├── test_numpy_array.cpp
│ │ │ ├── test_numpy_array.py
│ │ │ ├── test_numpy_dtypes.cpp
│ │ │ ├── test_numpy_dtypes.py
│ │ │ ├── test_numpy_vectorize.cpp
│ │ │ ├── test_numpy_vectorize.py
│ │ │ ├── test_opaque_types.cpp
│ │ │ ├── test_opaque_types.py
│ │ │ ├── test_operator_overloading.cpp
│ │ │ ├── test_operator_overloading.py
│ │ │ ├── test_pickling.cpp
│ │ │ ├── test_pickling.py
│ │ │ ├── test_pytypes.cpp
│ │ │ ├── test_pytypes.py
│ │ │ ├── test_sequences_and_iterators.cpp
│ │ │ ├── test_sequences_and_iterators.py
│ │ │ ├── test_smart_ptr.cpp
│ │ │ ├── test_smart_ptr.py
│ │ │ ├── test_stl.cpp
│ │ │ ├── test_stl.py
│ │ │ ├── test_stl_binders.cpp
│ │ │ ├── test_stl_binders.py
│ │ │ ├── test_tagbased_polymorphic.cpp
│ │ │ ├── test_tagbased_polymorphic.py
│ │ │ ├── test_union.cpp
│ │ │ ├── test_union.py
│ │ │ ├── test_virtual_functions.cpp
│ │ │ └── test_virtual_functions.py
│ │ │ └── tools
│ │ │ ├── FindCatch.cmake
│ │ │ ├── FindEigen3.cmake
│ │ │ ├── FindPythonLibsNew.cmake
│ │ │ ├── check-style.sh
│ │ │ ├── libsize.py
│ │ │ ├── mkdoc.py
│ │ │ ├── pybind11Config.cmake.in
│ │ │ └── pybind11Tools.cmake
│ └── windows
│ │ ├── libh264decoder
│ │ ├── libh264decoder-0.0.1-cp36-cp36m-win_amd64.whl
│ │ ├── libh264decoder-0.0.1-cp37-cp37m-win_amd64.whl
│ │ ├── libh264decoder-0.0.1-cp38-cp38-win_amd64.whl
│ │ └── libh264decoder-0.0.1.tar.gz
│ │ └── opus_decoder
│ │ ├── opus_decoder-0.0.1-cp36-cp36m-win_amd64.whl
│ │ ├── opus_decoder-0.0.1-cp37-cp37m-win_amd64.whl
│ │ ├── opus_decoder-0.0.1-cp38-cp38-win_amd64.whl
│ │ └── opus_decoder-0.0.1.tar.gz
│ └── python_stream_liveview
│ ├── README.md
│ └── liveview.py
├── lib
└── libmedia_codec
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── LICENSE
│ ├── MANIFEST.in
│ ├── README.md
│ ├── cmake
│ └── FindOpus.cmake
│ ├── pybind11
│ ├── CMakeLists.txt
│ ├── CONTRIBUTING.md
│ ├── ISSUE_TEMPLATE.md
│ ├── LICENSE
│ ├── MANIFEST.in
│ ├── README.md
│ ├── docs
│ │ ├── Doxyfile
│ │ ├── Makefile
│ │ ├── _static
│ │ │ └── theme_overrides.css
│ │ ├── advanced
│ │ │ ├── cast
│ │ │ │ ├── chrono.rst
│ │ │ │ ├── custom.rst
│ │ │ │ ├── eigen.rst
│ │ │ │ ├── functional.rst
│ │ │ │ ├── index.rst
│ │ │ │ ├── overview.rst
│ │ │ │ ├── stl.rst
│ │ │ │ └── strings.rst
│ │ │ ├── classes.rst
│ │ │ ├── embedding.rst
│ │ │ ├── exceptions.rst
│ │ │ ├── functions.rst
│ │ │ ├── misc.rst
│ │ │ ├── pycpp
│ │ │ │ ├── index.rst
│ │ │ │ ├── numpy.rst
│ │ │ │ ├── object.rst
│ │ │ │ └── utilities.rst
│ │ │ └── smart_ptrs.rst
│ │ ├── basics.rst
│ │ ├── benchmark.py
│ │ ├── benchmark.rst
│ │ ├── changelog.rst
│ │ ├── classes.rst
│ │ ├── compiling.rst
│ │ ├── conf.py
│ │ ├── faq.rst
│ │ ├── index.rst
│ │ ├── intro.rst
│ │ ├── limitations.rst
│ │ ├── pybind11-logo.png
│ │ ├── pybind11_vs_boost_python1.png
│ │ ├── pybind11_vs_boost_python1.svg
│ │ ├── pybind11_vs_boost_python2.png
│ │ ├── pybind11_vs_boost_python2.svg
│ │ ├── reference.rst
│ │ ├── release.rst
│ │ ├── requirements.txt
│ │ └── upgrade.rst
│ ├── include
│ │ └── pybind11
│ │ │ ├── attr.h
│ │ │ ├── buffer_info.h
│ │ │ ├── cast.h
│ │ │ ├── chrono.h
│ │ │ ├── common.h
│ │ │ ├── complex.h
│ │ │ ├── detail
│ │ │ ├── class.h
│ │ │ ├── common.h
│ │ │ ├── descr.h
│ │ │ ├── init.h
│ │ │ ├── internals.h
│ │ │ └── typeid.h
│ │ │ ├── eigen.h
│ │ │ ├── embed.h
│ │ │ ├── eval.h
│ │ │ ├── functional.h
│ │ │ ├── iostream.h
│ │ │ ├── numpy.h
│ │ │ ├── operators.h
│ │ │ ├── options.h
│ │ │ ├── pybind11.h
│ │ │ ├── pytypes.h
│ │ │ ├── stl.h
│ │ │ └── stl_bind.h
│ ├── pybind11
│ │ ├── __init__.py
│ │ ├── __main__.py
│ │ └── _version.py
│ ├── setup.cfg
│ ├── setup.py
│ ├── tests
│ │ ├── CMakeLists.txt
│ │ ├── conftest.py
│ │ ├── constructor_stats.h
│ │ ├── cross_module_gil_utils.cpp
│ │ ├── local_bindings.h
│ │ ├── object.h
│ │ ├── pybind11_cross_module_tests.cpp
│ │ ├── pybind11_tests.cpp
│ │ ├── pybind11_tests.h
│ │ ├── pytest.ini
│ │ ├── test_async.cpp
│ │ ├── test_async.py
│ │ ├── test_buffers.cpp
│ │ ├── test_buffers.py
│ │ ├── test_builtin_casters.cpp
│ │ ├── test_builtin_casters.py
│ │ ├── test_call_policies.cpp
│ │ ├── test_call_policies.py
│ │ ├── test_callbacks.cpp
│ │ ├── test_callbacks.py
│ │ ├── test_chrono.cpp
│ │ ├── test_chrono.py
│ │ ├── test_class.cpp
│ │ ├── test_class.py
│ │ ├── test_cmake_build
│ │ │ ├── CMakeLists.txt
│ │ │ ├── embed.cpp
│ │ │ ├── installed_embed
│ │ │ │ └── CMakeLists.txt
│ │ │ ├── installed_function
│ │ │ │ └── CMakeLists.txt
│ │ │ ├── installed_target
│ │ │ │ └── CMakeLists.txt
│ │ │ ├── main.cpp
│ │ │ ├── subdirectory_embed
│ │ │ │ └── CMakeLists.txt
│ │ │ ├── subdirectory_function
│ │ │ │ └── CMakeLists.txt
│ │ │ ├── subdirectory_target
│ │ │ │ └── CMakeLists.txt
│ │ │ └── test.py
│ │ ├── test_constants_and_functions.cpp
│ │ ├── test_constants_and_functions.py
│ │ ├── test_copy_move.cpp
│ │ ├── test_copy_move.py
│ │ ├── test_docstring_options.cpp
│ │ ├── test_docstring_options.py
│ │ ├── test_eigen.cpp
│ │ ├── test_eigen.py
│ │ ├── test_embed
│ │ │ ├── CMakeLists.txt
│ │ │ ├── catch.cpp
│ │ │ ├── external_module.cpp
│ │ │ ├── test_interpreter.cpp
│ │ │ └── test_interpreter.py
│ │ ├── test_enum.cpp
│ │ ├── test_enum.py
│ │ ├── test_eval.cpp
│ │ ├── test_eval.py
│ │ ├── test_eval_call.py
│ │ ├── test_exceptions.cpp
│ │ ├── test_exceptions.py
│ │ ├── test_factory_constructors.cpp
│ │ ├── test_factory_constructors.py
│ │ ├── test_gil_scoped.cpp
│ │ ├── test_gil_scoped.py
│ │ ├── test_iostream.cpp
│ │ ├── test_iostream.py
│ │ ├── test_kwargs_and_defaults.cpp
│ │ ├── test_kwargs_and_defaults.py
│ │ ├── test_local_bindings.cpp
│ │ ├── test_local_bindings.py
│ │ ├── test_methods_and_attributes.cpp
│ │ ├── test_methods_and_attributes.py
│ │ ├── test_modules.cpp
│ │ ├── test_modules.py
│ │ ├── test_multiple_inheritance.cpp
│ │ ├── test_multiple_inheritance.py
│ │ ├── test_numpy_array.cpp
│ │ ├── test_numpy_array.py
│ │ ├── test_numpy_dtypes.cpp
│ │ ├── test_numpy_dtypes.py
│ │ ├── test_numpy_vectorize.cpp
│ │ ├── test_numpy_vectorize.py
│ │ ├── test_opaque_types.cpp
│ │ ├── test_opaque_types.py
│ │ ├── test_operator_overloading.cpp
│ │ ├── test_operator_overloading.py
│ │ ├── test_pickling.cpp
│ │ ├── test_pickling.py
│ │ ├── test_pytypes.cpp
│ │ ├── test_pytypes.py
│ │ ├── test_sequences_and_iterators.cpp
│ │ ├── test_sequences_and_iterators.py
│ │ ├── test_smart_ptr.cpp
│ │ ├── test_smart_ptr.py
│ │ ├── test_stl.cpp
│ │ ├── test_stl.py
│ │ ├── test_stl_binders.cpp
│ │ ├── test_stl_binders.py
│ │ ├── test_tagbased_polymorphic.cpp
│ │ ├── test_tagbased_polymorphic.py
│ │ ├── test_union.cpp
│ │ ├── test_union.py
│ │ ├── test_virtual_functions.cpp
│ │ └── test_virtual_functions.py
│ └── tools
│ │ ├── FindCatch.cmake
│ │ ├── FindEigen3.cmake
│ │ ├── FindPythonLibsNew.cmake
│ │ ├── check-style.sh
│ │ ├── libsize.py
│ │ ├── mkdoc.py
│ │ ├── pybind11Config.cmake.in
│ │ └── pybind11Tools.cmake
│ ├── pyproject.toml
│ ├── script
│ ├── build.bat
│ └── build.sh
│ ├── setup.py
│ └── src
│ ├── ffmpeg-4.2.2-win64-dev
│ ├── LICENSE.txt
│ ├── README.txt
│ ├── examples
│ │ ├── Makefile
│ │ ├── README
│ │ ├── avio_dir_cmd.c
│ │ ├── avio_reading.c
│ │ ├── decode_audio.c
│ │ ├── decode_video.c
│ │ ├── demuxing_decoding.c
│ │ ├── encode_audio.c
│ │ ├── encode_video.c
│ │ ├── extract_mvs.c
│ │ ├── filter_audio.c
│ │ ├── filtering_audio.c
│ │ ├── filtering_video.c
│ │ ├── http_multiclient.c
│ │ ├── hw_decode.c
│ │ ├── metadata.c
│ │ ├── muxing.c
│ │ ├── qsvdec.c
│ │ ├── remuxing.c
│ │ ├── resampling_audio.c
│ │ ├── scaling_video.c
│ │ ├── transcode_aac.c
│ │ ├── transcoding.c
│ │ ├── vaapi_encode.c
│ │ └── vaapi_transcode.c
│ ├── include
│ │ ├── libavcodec
│ │ │ ├── ac3_parser.h
│ │ │ ├── adts_parser.h
│ │ │ ├── avcodec.h
│ │ │ ├── avdct.h
│ │ │ ├── avfft.h
│ │ │ ├── d3d11va.h
│ │ │ ├── dirac.h
│ │ │ ├── dv_profile.h
│ │ │ ├── dxva2.h
│ │ │ ├── jni.h
│ │ │ ├── mediacodec.h
│ │ │ ├── qsv.h
│ │ │ ├── vaapi.h
│ │ │ ├── vdpau.h
│ │ │ ├── version.h
│ │ │ ├── videotoolbox.h
│ │ │ ├── vorbis_parser.h
│ │ │ └── xvmc.h
│ │ ├── libavdevice
│ │ │ ├── avdevice.h
│ │ │ └── version.h
│ │ ├── libavfilter
│ │ │ ├── avfilter.h
│ │ │ ├── buffersink.h
│ │ │ ├── buffersrc.h
│ │ │ └── version.h
│ │ ├── libavformat
│ │ │ ├── avformat.h
│ │ │ ├── avio.h
│ │ │ └── version.h
│ │ ├── libavutil
│ │ │ ├── adler32.h
│ │ │ ├── aes.h
│ │ │ ├── aes_ctr.h
│ │ │ ├── attributes.h
│ │ │ ├── audio_fifo.h
│ │ │ ├── avassert.h
│ │ │ ├── avconfig.h
│ │ │ ├── avstring.h
│ │ │ ├── avutil.h
│ │ │ ├── base64.h
│ │ │ ├── blowfish.h
│ │ │ ├── bprint.h
│ │ │ ├── bswap.h
│ │ │ ├── buffer.h
│ │ │ ├── camellia.h
│ │ │ ├── cast5.h
│ │ │ ├── channel_layout.h
│ │ │ ├── common.h
│ │ │ ├── cpu.h
│ │ │ ├── crc.h
│ │ │ ├── des.h
│ │ │ ├── dict.h
│ │ │ ├── display.h
│ │ │ ├── downmix_info.h
│ │ │ ├── encryption_info.h
│ │ │ ├── error.h
│ │ │ ├── eval.h
│ │ │ ├── ffversion.h
│ │ │ ├── fifo.h
│ │ │ ├── file.h
│ │ │ ├── frame.h
│ │ │ ├── hash.h
│ │ │ ├── hdr_dynamic_metadata.h
│ │ │ ├── hmac.h
│ │ │ ├── hwcontext.h
│ │ │ ├── hwcontext_cuda.h
│ │ │ ├── hwcontext_d3d11va.h
│ │ │ ├── hwcontext_drm.h
│ │ │ ├── hwcontext_dxva2.h
│ │ │ ├── hwcontext_mediacodec.h
│ │ │ ├── hwcontext_qsv.h
│ │ │ ├── hwcontext_vaapi.h
│ │ │ ├── hwcontext_vdpau.h
│ │ │ ├── hwcontext_videotoolbox.h
│ │ │ ├── imgutils.h
│ │ │ ├── intfloat.h
│ │ │ ├── intreadwrite.h
│ │ │ ├── lfg.h
│ │ │ ├── log.h
│ │ │ ├── lzo.h
│ │ │ ├── macros.h
│ │ │ ├── mastering_display_metadata.h
│ │ │ ├── mathematics.h
│ │ │ ├── md5.h
│ │ │ ├── mem.h
│ │ │ ├── motion_vector.h
│ │ │ ├── murmur3.h
│ │ │ ├── opt.h
│ │ │ ├── parseutils.h
│ │ │ ├── pixdesc.h
│ │ │ ├── pixelutils.h
│ │ │ ├── pixfmt.h
│ │ │ ├── random_seed.h
│ │ │ ├── rational.h
│ │ │ ├── rc4.h
│ │ │ ├── replaygain.h
│ │ │ ├── ripemd.h
│ │ │ ├── samplefmt.h
│ │ │ ├── sha.h
│ │ │ ├── sha512.h
│ │ │ ├── spherical.h
│ │ │ ├── stereo3d.h
│ │ │ ├── tea.h
│ │ │ ├── threadmessage.h
│ │ │ ├── time.h
│ │ │ ├── timecode.h
│ │ │ ├── timestamp.h
│ │ │ ├── tree.h
│ │ │ ├── twofish.h
│ │ │ ├── tx.h
│ │ │ ├── version.h
│ │ │ └── xtea.h
│ │ ├── libswresample
│ │ │ ├── swresample.h
│ │ │ └── version.h
│ │ └── libswscale
│ │ │ ├── swscale.h
│ │ │ └── version.h
│ └── lib
│ │ ├── avcodec-58.def
│ │ ├── avdevice-58.def
│ │ ├── avfilter-7.def
│ │ ├── avformat-58.def
│ │ ├── avutil-56.def
│ │ ├── libavcodec.dll.a
│ │ ├── libavdevice.dll.a
│ │ ├── libavfilter.dll.a
│ │ ├── libavformat.dll.a
│ │ ├── libavutil.dll.a
│ │ ├── libswresample.dll.a
│ │ ├── libswscale.dll.a
│ │ ├── swresample-3.def
│ │ └── swscale-5.def
│ ├── media_codec.cpp
│ ├── media_codec.h
│ └── opus-share
│ ├── include
│ └── opus
│ │ ├── opus.h
│ │ ├── opus_defines.h
│ │ └── opus_types.h
│ └── lib
│ ├── opus.dll.manifest
│ └── opus.exp
├── lib_install.bat
├── requirements.txt
├── sdk install on Raspberry Pi.7z
├── setup.py
├── setup_with_lib.py
├── src
├── multi_robomaster
│ ├── __init__.py
│ ├── multi_group.py
│ ├── multi_module.py
│ ├── multi_robot.py
│ └── tool.py
└── robomaster
│ ├── __init__.py
│ ├── __pycache__
│ ├── __init__.cpython-37.pyc
│ ├── action.cpython-37.pyc
│ ├── ai.cpython-37.pyc
│ ├── ai_module.cpython-37.pyc
│ ├── algo.cpython-37.pyc
│ ├── armor.cpython-37.pyc
│ ├── battery.cpython-37.pyc
│ ├── blaster.cpython-37.pyc
│ ├── camera.cpython-37.pyc
│ ├── chassis.cpython-37.pyc
│ ├── client.cpython-37.pyc
│ ├── config.cpython-37.pyc
│ ├── conn.cpython-37.pyc
│ ├── dds.cpython-37.pyc
│ ├── event.cpython-37.pyc
│ ├── exceptions.cpython-37.pyc
│ ├── flight.cpython-37.pyc
│ ├── gimbal.cpython-37.pyc
│ ├── gripper.cpython-37.pyc
│ ├── led.cpython-37.pyc
│ ├── media.cpython-37.pyc
│ ├── module.cpython-37.pyc
│ ├── protocol.cpython-37.pyc
│ ├── robot.cpython-37.pyc
│ ├── robotic_arm.cpython-37.pyc
│ ├── sensor.cpython-37.pyc
│ ├── servo.cpython-37.pyc
│ ├── uart.cpython-37.pyc
│ ├── util.cpython-37.pyc
│ ├── version.cpython-37.pyc
│ └── vision.cpython-37.pyc
│ ├── action.py
│ ├── ai_module.py
│ ├── algo.py
│ ├── armor.py
│ ├── battery.py
│ ├── blaster.py
│ ├── camera.py
│ ├── chassis.py
│ ├── client.py
│ ├── config.py
│ ├── conn.py
│ ├── dds.py
│ ├── event.py
│ ├── exceptions.py
│ ├── flight.py
│ ├── gimbal.py
│ ├── gripper.py
│ ├── led.py
│ ├── media.py
│ ├── module.py
│ ├── protocol.py
│ ├── robot.py
│ ├── robotic_arm.py
│ ├── sensor.py
│ ├── servo.py
│ ├── uart.py
│ ├── util.py
│ ├── version.py
│ └── vision.py
└── visualcppbuildtools_full.exe
/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | dist
3 |
4 | src/robomaster.egg-info
5 | __pycache__
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RoboMaster-SDK
2 |
3 | [](https://gitter.im/RoboMaster-SDK/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
4 |
5 |
6 |
7 | Learn more about the RoboMaster Education Robot: https://www.dji.com/robomaster-ep
8 |
9 | RoboMaster Developer Guide: https://robomaster-dev.rtfd.io/
10 |
11 | Gitee link for RoboMaster SDK download: https://gitee.com/xitinglin/RoboMaster-SDK
12 |
--------------------------------------------------------------------------------
/VisualCppRedist_AIO_20200707.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/VisualCppRedist_AIO_20200707.exe
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line.
5 | SPHINXOPTS =
6 | SPHINXBUILD = sphinx-build
7 | SOURCEDIR = source
8 | BUILDDIR = build
9 |
10 | # Put it first so that "make" without argument is like "make help".
11 | help:
12 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
13 |
14 | .PHONY: help Makefile
15 |
16 | # Catch-all target: route all unknown targets to Sphinx using the new
17 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
18 | %: Makefile
19 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
--------------------------------------------------------------------------------
/docs/make.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | pushd %~dp0
4 |
5 | REM Command file for Sphinx documentation
6 |
7 | if "%SPHINXBUILD%" == "" (
8 | set SPHINXBUILD=sphinx-build
9 | )
10 | set SOURCEDIR=source
11 | set BUILDDIR=build
12 |
13 | if "%1" == "" goto help
14 |
15 | %SPHINXBUILD% >NUL 2>NUL
16 | if errorlevel 9009 (
17 | echo.
18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19 | echo.installed, then set the SPHINXBUILD environment variable to point
20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you
21 | echo.may add the Sphinx directory to PATH.
22 | echo.
23 | echo.If you don't have Sphinx installed, grab it from
24 | echo.http://sphinx-doc.org/
25 | exit /b 1
26 | )
27 |
28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
29 | goto end
30 |
31 | :help
32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
33 |
34 | :end
35 | popd
36 |
--------------------------------------------------------------------------------
/docs/source/extension_module/robotic_arm_and_gripper.rst:
--------------------------------------------------------------------------------
1 | ================
2 | 机械臂与机械爪
3 | ================
4 |
5 | 介绍
6 | ----
7 |
8 | 机械臂支持 FPV 精准遥控,机械爪配合机械臂使用,支持夹力控制,用户可在 App 中通过第一人称视角操控机械臂和机械爪完成任务。
9 |
10 | .. image:: ../images/arm&gripper.png
11 | :scale: 30%
12 |
13 | 使用说明
14 | --------
15 |
16 | 用户可以控制机械臂的移动范围、机械爪的开合距离。其中,机械臂的水平移动范围为 0-0.22 米,垂直移动范围为 0-0.15 米;机械爪的开合距离约为 10 厘米。
17 |
18 | .. warning::
19 | 1.当机械臂或机械爪处于工作状态时,请尽量避免对其施加外力。
20 |
21 | 2.请勿碰撞或损伤机械臂或机械爪,避免导致性能下降或舵机运行异常。
22 |
23 | 3.避免因用身体部位接触机械臂或机械爪旋转或尖锐部分而导致受伤。
24 |
25 | 4.及时清理水滴、水晶弹残渣等异物,避免腐蚀结构表面。
26 |
27 | 机械爪PWM 接口说明:
28 | ^^^^^^^^^^^^^^^^^^^
29 |
30 | 机械爪支持力矩控制模式
31 |
32 | .. image:: ../images/arm_pwm.png
33 | :scale: 20%
34 |
35 | +----------+------------+
36 | | 序号 | 引脚 |
37 | +==========+============+
38 | | 1 | 485A/PWM |
39 | +----------+------------+
40 | | 2 | 485B |
41 | +----------+------------+
42 | | 3 | VCC-12V |
43 | +----------+------------+
44 | | 4 | GND |
45 | +----------+------------+
46 |
47 | PWM 信号为50Hz,占空比为2.5%~12.5%。
48 |
49 | 1. 2.5%~7.5% 占空比对应闭合力度[ 最大,0];
50 |
51 | 2. 7.5%~12.5% 占空比对应开合力度[0,最大]。
52 |
53 | Python API
54 | --------------------------
55 |
56 | 请参考 :doc:`机械臂<../python/robotic_arm>` 和 :doc:`机械爪<../python/gripper>`
57 |
--------------------------------------------------------------------------------
/docs/source/extension_module/sensor_adapter.rst:
--------------------------------------------------------------------------------
1 | ================
2 | 传感器转接模块
3 | ================
4 |
5 | 介绍
6 | ----------
7 |
8 | 传感器转接模块是为了方便用户将温度、压力、测距等传感器接入 RoboMaster EP而设计的,可在Scratch 编程环境中获取传感器数据信息,每个模块均有两个传感器接口,两个接口功能相同。
9 |
10 | .. image:: ../images/pinboard.png
11 | :scale: 30%
12 |
13 | 引脚说明
14 | ----------
15 |
16 | +----------+------------+------------------------------+
17 | | 端口 | 引脚 | 功能 |
18 | +==========+============+==============================+
19 | | port1 | VCC | 电源正极,输出电压3.3V |
20 | + +------------+------------------------------+
21 | | | GND | 电源地 |
22 | + +------------+------------------------------+
23 | | | I/O | 电平输入,输入范围0~3.3V |
24 | + +------------+------------------------------+
25 | | | AD | 模拟电压输入,输入范围0~3.3V |
26 | +----------+------------+------------------------------+
27 | | port2 | 同Port1 | 同port1 |
28 | +----------+------------+------------------------------+
29 |
30 | Python API
31 | --------------------------
32 |
33 | 请参考 :doc:`传感器转接模块<../python/sensor_adapter>`
34 |
--------------------------------------------------------------------------------
/docs/source/images/6EPlocate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/6EPlocate.png
--------------------------------------------------------------------------------
/docs/source/images/arduino.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/arduino.jpg
--------------------------------------------------------------------------------
/docs/source/images/arm&gripper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/arm&gripper.png
--------------------------------------------------------------------------------
/docs/source/images/arm_pwm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/arm_pwm.png
--------------------------------------------------------------------------------
/docs/source/images/cmd1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/cmd1.png
--------------------------------------------------------------------------------
/docs/source/images/connect.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/connect.png
--------------------------------------------------------------------------------
/docs/source/images/direct_connection_change.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/direct_connection_change.png
--------------------------------------------------------------------------------
/docs/source/images/download_sdk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/download_sdk.png
--------------------------------------------------------------------------------
/docs/source/images/engineer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/engineer.png
--------------------------------------------------------------------------------
/docs/source/images/form_control.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/form_control.gif
--------------------------------------------------------------------------------
/docs/source/images/infantry.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/infantry.png
--------------------------------------------------------------------------------
/docs/source/images/ip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/ip.png
--------------------------------------------------------------------------------
/docs/source/images/ip_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/ip_add.png
--------------------------------------------------------------------------------
/docs/source/images/libmedia_err.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/libmedia_err.png
--------------------------------------------------------------------------------
/docs/source/images/log_file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/log_file.png
--------------------------------------------------------------------------------
/docs/source/images/microbit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/microbit.png
--------------------------------------------------------------------------------
/docs/source/images/nano.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/nano.png
--------------------------------------------------------------------------------
/docs/source/images/neti_err.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/neti_err.jpg
--------------------------------------------------------------------------------
/docs/source/images/networking_connection_change.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/networking_connection_change.png
--------------------------------------------------------------------------------
/docs/source/images/networking_connection_key.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/networking_connection_key.png
--------------------------------------------------------------------------------
/docs/source/images/pinboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/pinboard.png
--------------------------------------------------------------------------------
/docs/source/images/pip_install_error.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/pip_install_error.jpg
--------------------------------------------------------------------------------
/docs/source/images/python_env.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/python_env.png
--------------------------------------------------------------------------------
/docs/source/images/python_version.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/python_version.png
--------------------------------------------------------------------------------
/docs/source/images/qrcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/qrcode.png
--------------------------------------------------------------------------------
/docs/source/images/raspberry.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/raspberry.png
--------------------------------------------------------------------------------
/docs/source/images/robomaster.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/robomaster.jpg
--------------------------------------------------------------------------------
/docs/source/images/servo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/servo.png
--------------------------------------------------------------------------------
/docs/source/images/sn_num.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/sn_num.jpg
--------------------------------------------------------------------------------
/docs/source/images/tello_power.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/tello_power.png
--------------------------------------------------------------------------------
/docs/source/images/third_part.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/third_part.jpg
--------------------------------------------------------------------------------
/docs/source/images/third_part.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/third_part.png
--------------------------------------------------------------------------------
/docs/source/images/tof.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/tof.png
--------------------------------------------------------------------------------
/docs/source/images/tof_module.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/tof_module.png
--------------------------------------------------------------------------------
/docs/source/images/uart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/uart.png
--------------------------------------------------------------------------------
/docs/source/images/uart_pc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/uart_pc.png
--------------------------------------------------------------------------------
/docs/source/images/uart_serial.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/uart_serial.png
--------------------------------------------------------------------------------
/docs/source/images/uart_serial_sdk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/uart_serial_sdk.png
--------------------------------------------------------------------------------
/docs/source/images/ubuntu_python_setup1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/ubuntu_python_setup1.png
--------------------------------------------------------------------------------
/docs/source/images/ubuntu_python_setup2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/ubuntu_python_setup2.png
--------------------------------------------------------------------------------
/docs/source/images/ubuntu_python_setup3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/ubuntu_python_setup3.png
--------------------------------------------------------------------------------
/docs/source/images/vc2014.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/vc2014.PNG
--------------------------------------------------------------------------------
/docs/source/images/vc_exe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/vc_exe.png
--------------------------------------------------------------------------------
/docs/source/images/vs_build_tool.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/vs_build_tool.png
--------------------------------------------------------------------------------
/docs/source/images/wifi_direct.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/wifi_direct.png
--------------------------------------------------------------------------------
/docs/source/images/wifi_sta.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/wifi_sta.png
--------------------------------------------------------------------------------
/docs/source/images/win_python_setup1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/win_python_setup1.png
--------------------------------------------------------------------------------
/docs/source/images/win_python_setup2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/win_python_setup2.png
--------------------------------------------------------------------------------
/docs/source/images/zip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/docs/source/images/zip.png
--------------------------------------------------------------------------------
/docs/source/python/apis.rst:
--------------------------------------------------------------------------------
1 | ===================
2 | Python API
3 | ===================
4 |
5 | .. toctree::
6 | :maxdepth: 1
7 | :caption: 机器人
8 |
9 | robot.rst
10 |
11 | .. toctree::
12 | :maxdepth: 1
13 | :caption: 多机通信
14 |
15 | multi_comm.rst
16 |
17 | .. toctree::
18 | :maxdepth: 1
19 | :caption: 自定义 UI 系统
20 |
21 | custom_ui.rst
22 |
23 | .. toctree::
24 | :maxdepth: 1
25 | :caption: 发射器
26 |
27 | ir_blaster.rst
28 |
29 | .. toctree::
30 | :maxdepth: 1
31 | :caption: 机械爪
32 |
33 | gripper.rst
34 |
35 | .. toctree::
36 | :maxdepth: 1
37 | :caption: 机械臂
38 |
39 | robotic_arm.rst
40 |
41 | .. toctree::
42 | :maxdepth: 1
43 | :caption: 舵机
44 |
45 | servo.rst
46 |
47 | .. toctree::
48 | :maxdepth: 1
49 | :caption: 智能
50 |
51 | vision.rst
52 |
53 | .. toctree::
54 | :maxdepth: 1
55 | :caption: 装甲板
56 |
57 | armor.rst
58 |
59 | .. toctree::
60 | :maxdepth: 1
61 | :caption: 红外深度传感器
62 |
63 | ir_distance_sensor.rst
64 |
65 | .. toctree::
66 | :maxdepth: 1
67 | :caption: 传感器转接模块
68 |
69 | sensor_adapter.rst
70 |
71 | .. toctree::
72 | :maxdepth: 1
73 | :caption: UART
74 |
75 | uart.rst
76 |
--------------------------------------------------------------------------------
/docs/source/python/armor.rst:
--------------------------------------------------------------------------------
1 | ===================
2 | 装甲板
3 | ===================
4 |
5 | .. py:function:: def ir_hit_detection_event(msg):
6 |
7 | :描述: 当检测到机器人受到红外光束攻击时,运行函数内程序
8 |
9 | :param msg: 函数内部的消息参数
10 |
11 | :return: 无
12 |
13 | :示例:
14 | .. code-block:: python
15 | :linenos:
16 |
17 | #当检测到机器人受到红外光束攻击时,运行函数内程序
18 |
19 | def ir_hit_detection_event(msg):
20 | pass
21 |
22 | .. function:: armor_ctrl.cond_wait(condition_enum)
23 |
24 | :描述: 等待机器人受到红外光束攻击时,执行下一条指令
25 |
26 | :param condition_enum: 事件类型,``rm_define.cond_ir_hit_detection`` 表示机器人受到红外光束攻击
27 |
28 | :return: 无
29 |
30 | :示例: ``armor_ctrl.cond_wait(rm_define.cond_ir_hit_detection)``
31 |
32 | :示例说明: 等待机器人受到红外光束攻击时,执行下一条指令
33 |
34 | .. function:: armor_ctrl.check_condition(condition_enum)
35 |
36 | :描述: 判断机器人是否受到红外光束攻击
37 |
38 | :param condition_enum: 事件类型,``rm_define.cond_ir_hit_detection`` 表示机器人受到红外光束攻击
39 |
40 | :return: 机器人是否受到红外光束攻击,受到攻击时返回真,否则返回假。
41 | :rtype: bool
42 |
43 | :示例: ``if armor_ctrl.check_condition(rm_define.cond_ir_hit_detection):``
44 |
45 | :示例说明: 如果机器人受到红外光束攻击时,执行下一条指令
--------------------------------------------------------------------------------
/docs/source/python/code/multi_comm.py:
--------------------------------------------------------------------------------
1 | def recv_callback(msg):
2 | pass
3 |
4 | multi_comm_ctrl.register_recv_callback(recv_callback)
--------------------------------------------------------------------------------
/docs/source/python/code/stage.py:
--------------------------------------------------------------------------------
1 | button = Button()
2 | stage.add_widget(my_button)
3 | stage.add_widget(my_button)
--------------------------------------------------------------------------------
/docs/source/python/custom_ui.rst:
--------------------------------------------------------------------------------
1 | ===================
2 | 自定义 UI 系统
3 | ===================
4 |
5 | .. toctree::
6 | :maxdepth: 1
7 | :caption: Common
8 |
9 | custom_ui_doc/Common.rst
10 |
11 | .. toctree::
12 | :maxdepth: 1
13 | :caption: Stage
14 |
15 | custom_ui_doc/Stage.rst
16 |
17 | .. toctree::
18 | :maxdepth: 1
19 | :caption: Button
20 |
21 | custom_ui_doc/Button.rst
22 |
23 | .. toctree::
24 | :maxdepth: 1
25 | :caption: Toggle
26 |
27 | custom_ui_doc/Toggle.rst
28 |
29 | .. toctree::
30 | :maxdepth: 1
31 | :caption: Text
32 |
33 | custom_ui_doc/Text.rst
34 |
35 | .. toctree::
36 | :maxdepth: 1
37 | :caption: InputField
38 |
39 | custom_ui_doc/Input_field.rst
40 |
41 | .. toctree::
42 | :maxdepth: 1
43 | :caption: Dropdown
44 |
45 | custom_ui_doc/Dropdown.rst
46 |
47 | .. hint:: 功能说明请参考 :doc:`用户自定义 UI 系统 <./custom_ui_info>`
--------------------------------------------------------------------------------
/docs/source/python/custom_ui_doc/Stage.rst:
--------------------------------------------------------------------------------
1 | =================
2 | Stage
3 | =================
4 |
5 | 系统初始化时会自动创建一个 Stage 类的对象 stage ,直接使用即可,不需要用户自己创建。
6 |
7 | .. function:: stage.add_widget(widget_obj)
8 |
9 | :描述: 将参数中的控件添加到 UI 界面中
10 |
11 | :param object widget_obj: 需要添加进 UI 界面的控件对象
12 |
13 | :return: 无
14 |
15 | :示例:
16 | .. code-block:: python
17 | :linenos:
18 |
19 | #创建一个 Button 对象,并将其添加进 UI 界面
20 |
21 | my_button = Button()
22 | stage.add_widget(my_button)
23 |
24 | .. function:: stage.remove_widget(widget_obj)
25 |
26 | :描述: 从 UI 界面移除参数传入的控件
27 |
28 | :param object widget_obj: 需要从 UI 界面移除的控件
29 |
30 | :return: 无
31 |
32 | :示例: ``stage.remove_widget(my_button)``
33 |
34 | :示例说明: 从 UI 界面中移除控件 my_button
--------------------------------------------------------------------------------
/docs/source/python/custom_ui_info.rst:
--------------------------------------------------------------------------------
1 | ====================
2 | 用户自定义 UI 系统
3 | ====================
4 |
5 | 自定义 UI 系统是用户通过自己编写的程序生成自定义的 UI 控件来拓展程序的输入和输出的一种方式。
6 |
7 | 我们编程时很重要的一部分工作是处理输入和输出,对我们的机器人来说,程序输出可以是底盘、云台、发射器等模块的动作,也可以是灯光、音效等的表现,输入的途径则有初始的变量,机器人的视觉识别、掌声识别、装甲板打击检测、手机陀螺仪等。现在我们可以通过自定义 UI 系统与生成的 UI 控件进行交互达到输入的目的,也可以将程序的处理结果通过 UI 控件来进行信息的输出。
8 |
9 | 我们可以在 RoboMaster App 中编写 Python 程序,调用自定义 UI 系统的相关接口,来生成 UI 控件,绑定控件的事件回调。在实验室中完成程序的编写和调试后,可以将程序装配成自定义技能,在单机驾驶或者多人竞技中释放出来。
10 |
11 | Python API 请参考 :doc:`自定义UI系统<./custom_ui>`
--------------------------------------------------------------------------------
/docs/source/python/feature.rst:
--------------------------------------------------------------------------------
1 | ===================
2 | Python 功能介绍
3 | ===================
4 |
5 | .. toctree::
6 | :maxdepth: 1
7 | :caption: 多机通信功能
8 |
9 | multi_comm_info.rst
10 |
11 | .. toctree::
12 | :maxdepth: 1
13 | :caption: 自定义UI功能
14 |
15 | custom_ui_info.rst
16 |
--------------------------------------------------------------------------------
/docs/source/python/ir_blaster.rst:
--------------------------------------------------------------------------------
1 | ===================
2 | 发射器
3 | ===================
4 |
5 | .. function:: ir_blaster_ctrl.set_fire_count(count)
6 |
7 | :描述: 设置红外光束的发射频率,即每秒射出的红外光束次数
8 |
9 | :param int color_enum: 发射频率,即每秒射出的红外光束次数,范围为[1:8]
10 |
11 | :return: 无
12 |
13 | :示例: ``ir_blaster_ctrl.set_fire_count(4)``
14 |
15 | :示例说明: 设置红外光束的发射频率为 4
16 |
17 | .. function:: ir_blaster_ctrl.fire_once()
18 |
19 | :描述: 控制发射器只发射一次红外光束
20 |
21 | :param void: 无
22 |
23 | :return: 无
24 |
25 | :示例: ``ir_blaster_ctrl.fire_once()``
26 |
27 | :示例说明: 控制发射器只发射一次红外光束
28 |
29 | .. function:: ir_blaster_ctrl.fire_continuous()
30 |
31 | :描述: 控制发射器持续发射红外光束
32 |
33 | :param void: 无
34 |
35 | :return: 无
36 |
37 | :示例: ``ir_blaster_ctrl.fire_continuous()``
38 |
39 | :示例说明: 控制发射器持续发射红外光束
40 |
41 | .. function:: ir_blaster_ctrl.stop()
42 |
43 | :描述: 停止发射红外光束
44 |
45 | :param void: 无
46 |
47 | :return: 无
48 |
49 | :示例: ``ir_blaster_ctrl.stop()``
50 |
51 | :示例说明: 停止发射红外光束
--------------------------------------------------------------------------------
/docs/source/python/multi_comm_info.rst:
--------------------------------------------------------------------------------
1 | ================
2 | 多机通信系统
3 | ================
4 |
5 | 多机通信系统是一种基于局域网实现多台机器人之间相互通信的功能,让用户可以进行多台机器人协同工作,实现多台机器人编队表演等功能。
6 |
7 | 使用时需要将所有目标机器人加入到同一个局域网内,并使用官方提供的Python API进行编程,来沟通机器人之间的通信机制,进一步实现具体的功能。
8 |
9 | Python API 请参考 :doc:`自定义UI系统<./multi_comm>`
--------------------------------------------------------------------------------
/docs/source/python/python_api.rst:
--------------------------------------------------------------------------------
1 | ===================
2 | Python 编程介绍
3 | ===================
4 |
5 | 介绍
6 | ------------
7 |
8 | 本章介绍的 Python 编程指的是使用设备连接 EP 机器人后,进入 App 实验室进行 Python 编程。
9 |
10 | 在 Python 编程界面,允许玩家基于 Python 3.6.6 版本的基础语法完成 Python 编程,并可以参考官方提供的《`RoboMaster EP 编程模块手册 `_》和本网站 :doc:`Python API<../python/apis>`,调用 RoboMaster EP 提供的编程接口去编写自己的 Python 程序,同时生成的 Python 程序可被装配成自主程序或者自定义技能。
11 |
12 | RoboMaster EP 的多机通信接口让多台机器人通过 Python 编程相互通信,实现多机实时互动。 EP 支持编程自定义 UI 系统,通过 Python 编写虚拟控件,自由设计交互界面,拓展无限应用可能。
13 |
14 | 界面
15 | ------------
16 | 为了方便代码编辑,一般会使用 PC 端的 App 进行 Python 编程。
17 |
18 | .. image:: ../images/python_env.png
19 | :align: center
20 |
21 | .. centered:: PC 端 Python 编程界面
22 |
23 | 参考文档
24 | ------------
25 | 1. `RoboMaster EP 编程模块手册 `_
26 | 2. :doc:`Python API<../python/apis>`
27 |
--------------------------------------------------------------------------------
/docs/source/python/robot.rst:
--------------------------------------------------------------------------------
1 | ================
2 | 机器人
3 | ================
4 |
5 | .. function:: robot_ctrl.get_battery_percentage()
6 |
7 | :描述: 机器人电池电量获取
8 |
9 | :param void: 无
10 |
11 | :return: 电池电量百分比 (0, 100]
12 |
13 | :示例: >> ``robot_ctrl.get_battery_percentage()``
14 |
15 | << ``10``
16 |
17 | :示例说明: 当前机器人电量为10%
--------------------------------------------------------------------------------
/docs/source/python/vision.rst:
--------------------------------------------------------------------------------
1 | ===================
2 | 智能
3 | ===================
4 |
5 | .. function:: vision_ctrl.marker_detection_color_set(color_enum)
6 |
7 | :描述: 设置视觉标签识别颜色
8 |
9 | :param color_enum: 标签颜色类型,详细见表格 :data:`color_enum`
10 |
11 | :return: 无
12 |
13 | :示例: ``vision_ctrl.marker_detection_color_set(rm_define.marker_detection_color_red)``
14 |
15 | :示例说明: 设置视觉标签识别颜色为红色
16 |
17 | .. data:: color_enum
18 |
19 | +--------------------------------------+----+
20 | |rm_define.marker_detection_color_red |红色|
21 | +--------------------------------------+----+
22 | |rm_define.marker_detection_color_green|绿色|
23 | +--------------------------------------+----+
24 | |rm_define.marker_detection_color_blue |蓝色|
25 | +--------------------------------------+----+
--------------------------------------------------------------------------------
/docs/source/python_sdk/apis.rst:
--------------------------------------------------------------------------------
1 | .. _apis:
2 |
3 |
4 | ############################
5 | RoboMaster SDK APIs
6 | ############################
7 |
8 | API接口列表。
9 |
--------------------------------------------------------------------------------
/docs/source/python_sdk/beginner.rst:
--------------------------------------------------------------------------------
1 | .. _beginnger:
2 |
3 | ####################################
4 | RoboMaster SDK 新手入门 - 基础篇
5 | ####################################
6 |
7 | SDK 能做什么?
8 | _____________
9 |
10 | RoboMaster SDK (以下简称 SDK)是一套面向大疆 RoboMaster 系列产品的开发工具包,
11 | 目前支持的产品包括 RoboMaster EP, RoboMaster EP Core, Tello EDU, Tello Talent 等。
12 | 通过 SDK, 用户可以实现在PC上控制机器人运动以及获取机器人传感器的相关信息 (待补充???)
13 |
14 | 第一个SDK程序
15 | _____________
16 |
17 | 接下来本文档将从如何获取 RoboMaster SDK(以下简称 SDK)的版本号来编写第一个 SDK 程序
18 |
19 | - 首先从安装的的 `robomaster` 包中导入自己需要的模块,这里我们导入包含获取SDK版本信息的 `version` 模块::
20 |
21 | from robomaster import version
22 |
23 | - 接下来通过 `version` 模块中的 `__version__` 属性可以获得 SDK 的版本号,并将其打印::
24 |
25 | sdk_version = version.__version__
26 | print("sdk version:", sdk_version)
27 |
28 | - 运行程序,可以看到打印的结果::
29 |
30 | sdk version: 0.1.1.29
31 |
32 | 示例文档中提供了获取 SDK 版本号的例程 :file:`/examples/00_general/01_sdk_version.py`
33 |
34 | .. literalinclude:: ./../../../examples/00_general/01_sdk_version.py
35 | :language: python
36 | :linenos:
37 | :lines: 17-
38 |
--------------------------------------------------------------------------------
/docs/source/python_sdk/downloads.rst:
--------------------------------------------------------------------------------
1 | .. _downloads:
2 |
3 | ############################
4 | RoboMaster SDK 下载源码
5 | ############################
6 |
7 | 可以在官方GitHub上下载SDK的示例代码。
8 |
9 | Clone, fork, or report issues on the `GitHub RoboMaster SDK repository `_.
10 |
11 | 也可以从的Gitee(国内源,下载更快)上下载SDK的示例代码。
12 |
13 | Clone, fork, or report issues on the `Gitee RoboMaster SDK repository `_.
14 |
--------------------------------------------------------------------------------
/docs/source/python_sdk/log.rst:
--------------------------------------------------------------------------------
1 | .. _log:
2 |
3 |
4 | ##################################
5 | RoboMaster SDK 如何记录日志
6 | ##################################
7 |
8 | 配置日志等级
9 | ____________
10 |
11 | RoboMaster SDK 的日志等级默认为ERROR,用户可根据自己的需要进行修改。
12 |
13 | - 设置日志等级的语句为 :file:`/examples/01_robot/00_logger.py` 中该行代码::
14 |
15 | logger.setLevel(logging.ERROR)
16 |
17 | - 用户可根据自己的需要将其修改为::
18 |
19 | logger.setLevel(logging.WARNING)
20 |
21 | 或者::
22 |
23 | logger.setLevel(logging.INFO)
24 |
25 |
26 | 日志文件的使用
27 | ____________________
28 |
29 | 如果用户是使用过程中遇到问题,需要将日志写入文件中,并将日志文件提供给技术支持人员。
30 |
31 | **生成日志文件方法**
32 |
33 | - 用户需要在程序最开始添加语句::
34 |
35 | robomaster.enable_logging_to_file()
36 |
37 | - 运行程序
38 |
39 | - SDK会自动生成对应的系统日志文件,存放路径为该程序同级目录中,日志文件命名格式为::
40 |
41 | RoboMasterSDK_YYYYMMDDHHMMSS_log.txt
42 |
43 | - 将生成的系统日志文件发送到邮箱 `developer@dji.com`,邮件模板如下::
44 |
45 | xxxxxxxx
46 | xxxxxxxx
47 | xxxxxxxx
48 |
49 | **示例代码**
50 |
51 | - 参考sdk代码 :file:`/examples/01_robot/00_logger.py` 目录下的例程
52 |
53 | .. literalinclude:: ./../../../examples/01_robot/00_logger.py
54 | :language: python
55 | :linenos:
56 | :lines: 16-
57 |
58 | - 运行程序后SDK会在在程序的同级目录下会自动生成系统日志文件,如下图所示
59 |
60 | .. image:: ./../images/log_file.png
61 | :scale: 100%
62 | :align: center
63 |
--------------------------------------------------------------------------------
/docs/source/python_sdk/modules.rst:
--------------------------------------------------------------------------------
1 | RoboMaster SDK API 详细介绍
2 | =============================
3 |
4 | .. toctree::
5 | :maxdepth: 4
6 |
7 | robomaster
8 |
--------------------------------------------------------------------------------
/docs/source/text_sdk/apis.rst:
--------------------------------------------------------------------------------
1 | ====================
2 | 明文协议
3 | ====================
4 |
5 | .. toctree::
6 | :maxdepth: 1
7 |
8 | protocol_struct.rst
9 |
10 | .. toctree::
11 | :maxdepth: 1
12 |
13 | protocol_api.rst
14 |
15 | .. toctree::
16 | :maxdepth: 1
17 |
18 | data_define.rst
--------------------------------------------------------------------------------
/examples/00_general/01_sdk_version.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | from robomaster import version
18 |
19 | if __name__ == "__main__":
20 | sdk_version = version.__version__
21 | print("sdk version:", sdk_version)
22 |
--------------------------------------------------------------------------------
/examples/01_robot/00_logger.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | robomaster.enable_logging_to_file()
23 |
24 | # 如果本地IP 自动获取不正确,手动指定本地IP地址
25 | # robomaster.config.LOCAL_IP_STR = "192.168.2.20"
26 |
27 | ep_robot = robot.Robot()
28 |
29 | # 指定连接方式为AP 直连模式
30 | ep_robot.initialize(conn_type='rndis')
31 |
32 | version = ep_robot.get_version()
33 | print("Robot version: {0}".format(version))
34 | ep_robot.close()
35 |
36 |
--------------------------------------------------------------------------------
/examples/01_robot/01_get_version.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | from robomaster import robot
18 |
19 |
20 | if __name__ == '__main__':
21 | ep_robot = robot.Robot()
22 | ep_robot.initialize(conn_type="ap")
23 |
24 | ep_version = ep_robot.get_version()
25 | print("Robot Version: {0}".format(ep_version))
26 |
27 | ep_robot.close()
28 |
--------------------------------------------------------------------------------
/examples/01_robot/02_get_sn.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | from robomaster import robot
18 |
19 |
20 | if __name__ == '__main__':
21 | ep_robot = robot.Robot()
22 | ep_robot.initialize(conn_type="sta")
23 |
24 | SN = ep_robot.get_sn()
25 | print("Robot SN:", SN)
26 |
27 | ep_robot.close()
28 |
--------------------------------------------------------------------------------
/examples/01_robot/03_play_audio.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | ep_robot = robot.Robot()
23 | ep_robot.initialize(conn_type="sta")
24 |
25 | # 依次播放两个本地文件
26 |
27 | ep_robot.play_audio(filename="demo1.wav").wait_for_completed()
28 | ep_robot.play_audio(filename="demo2.wav").wait_for_completed()
29 |
30 | ep_robot.close()
31 |
32 |
--------------------------------------------------------------------------------
/examples/01_robot/04_ap_conn.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | # 如果本地IP 自动获取不正确,手动指定本地IP地址
23 | # robomaster.config.LOCAL_IP_STR = "192.168.2.20"
24 | ep_robot = robot.Robot()
25 |
26 | # 指定连接方式为AP 直连模式
27 | ep_robot.initialize(conn_type='ap')
28 |
29 | version = ep_robot.get_version()
30 | print("Robot version: {0}".format(version))
31 | ep_robot.close()
32 |
33 |
--------------------------------------------------------------------------------
/examples/01_robot/05_sta_conn.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | # 如果本地IP 自动获取不正确,手动指定本地IP地址
23 | # robomaster.config.LOCAL_IP_STR = "192.168.1.100"
24 | ep_robot = robot.Robot()
25 |
26 | # 指定连接方式为STA组网模式
27 | ep_robot.initialize(conn_type='sta')
28 |
29 | version = ep_robot.get_version()
30 | print("Robot Version: {0}".format(version))
31 | ep_robot.close()
32 |
--------------------------------------------------------------------------------
/examples/01_robot/05_sta_conn_helper.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import time
18 | import robomaster
19 | from robomaster import conn
20 | from MyQR import myqr
21 | from PIL import Image
22 |
23 |
24 | QRCODE_NAME = "qrcode.png"
25 |
26 | if __name__ == '__main__':
27 |
28 | helper = conn.ConnectionHelper()
29 | info = helper.build_qrcode_string(ssid="RoboMaster_SDK_WIFI", password="12341234")
30 | myqr.run(words=info)
31 | time.sleep(1)
32 | img = Image.open(QRCODE_NAME)
33 | img.show()
34 | if helper.wait_for_connection():
35 | print("Connected!")
36 | else:
37 | print("Connect failed!")
38 |
--------------------------------------------------------------------------------
/examples/01_robot/05_sta_conn_sn.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | from robomaster import robot
18 | from robomaster import config
19 |
20 |
21 | if __name__ == '__main__':
22 | ep_robot = robot.Robot()
23 | # 指定机器人的 SN 号
24 | ep_robot.initialize(conn_type="sta", sn="3JKDH2T001ULTD")
25 |
26 | ep_version = ep_robot.get_version()
27 | print("Robot Version: {0}".format(ep_version))
28 |
29 | ep_robot.close()
30 |
--------------------------------------------------------------------------------
/examples/01_robot/06_rndis_conn.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | ep_robot = robot.Robot()
23 |
24 | # 指定连接方式为USB RNDIS模式
25 | ep_robot.initialize(conn_type='rndis')
26 |
27 | version = ep_robot.get_version()
28 | print("Robot version: {0}".format(version))
29 | ep_robot.close()
30 |
--------------------------------------------------------------------------------
/examples/01_robot/07_tcp_protocol.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | ep_robot = robot.Robot()
23 |
24 | # 指定连接方式为STA 组网模式, 网络通讯方式 tcp
25 | ep_robot.initialize(conn_type='sta', proto_type='tcp')
26 |
27 | version = ep_robot.get_version()
28 | print("Robot Version: {0}".format(version))
29 | ep_robot.close()
30 |
31 |
--------------------------------------------------------------------------------
/examples/01_robot/08_udp_protocol.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | ep_robot = robot.Robot()
23 | # 指定连接方式为AP 直连模式, 网络通讯方式 udp
24 | ep_robot.initialize(conn_type='ap', proto_type='udp')
25 |
26 | version = ep_robot.get_version()
27 | print("Robot Version: {0}".format(version))
28 | ep_robot.close()
29 |
--------------------------------------------------------------------------------
/examples/01_robot/09_set_mode.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | from robomaster import robot
18 |
19 |
20 | if __name__ == '__main__':
21 | ep_robot = robot.Robot()
22 | ep_robot.initialize(conn_type="ap")
23 |
24 | ep_robot.set_robot_mode(mode=robot.GIMBAL_LEAD)
25 |
26 | ep_robot.close()
27 |
--------------------------------------------------------------------------------
/examples/01_robot/demo1.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/01_robot/demo1.wav
--------------------------------------------------------------------------------
/examples/01_robot/demo2.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/01_robot/demo2.wav
--------------------------------------------------------------------------------
/examples/02_chassis/05_sub_position.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | def sub_position_handler(position_info):
22 | x, y, z = position_info
23 | print("chassis position: x:{0}, y:{1}, z:{2}".format(x, y, z))
24 |
25 |
26 | if __name__ == '__main__':
27 | ep_robot = robot.Robot()
28 | ep_robot.initialize(conn_type="sta")
29 |
30 | ep_chassis = ep_robot.chassis
31 |
32 | # 订阅底盘位置信息
33 | ep_chassis.sub_position(freq=10, callback=sub_position_handler)
34 | ep_chassis.move(x=1.0, y=1.0, z=90).wait_for_completed()
35 | ep_chassis.unsub_position()
36 |
37 | ep_robot.close()
38 |
--------------------------------------------------------------------------------
/examples/02_chassis/11_pwm.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | from robomaster import robot
18 |
19 |
20 | if __name__ == '__main__':
21 | ep_robot = robot.Robot()
22 | ep_robot.initialize(conn_type="sta")
23 |
24 | ep_chassis = ep_robot.chassis
25 |
26 | #设置PWM输出频率为50Hz
27 | ep_chassis.set_pwm_freq(pwm1=50,pwm2=50,pwm3=50,pwm4=50,pwm5=50,pwm6=50)
28 | #设置PWM输出占空比为20%
29 | ep_chassis.set_pwm_value(pwm1=20,pwm2=20,pwm3=20,pwm4=20,pwm5=20,pwm6=20)
30 |
31 | ep_robot.close()
32 |
--------------------------------------------------------------------------------
/examples/03_gimbal/03_control.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import time
18 | import robomaster
19 | from robomaster import robot
20 |
21 |
22 | if __name__ == '__main__':
23 | ep_robot = robot.Robot()
24 | ep_robot.initialize(conn_type="sta")
25 |
26 | ep_gimbal = ep_robot.gimbal
27 |
28 | # 控制云台休眠
29 | ep_gimbal.suspend()
30 | time.sleep(3)
31 |
32 | # 控制云台恢复
33 | ep_gimbal.resume()
34 | time.sleep(3)
35 |
36 | ep_robot.close()
37 |
--------------------------------------------------------------------------------
/examples/04_camera/01_video_with_display.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import time
18 | from robomaster import robot
19 | from robomaster import camera
20 |
21 |
22 | if __name__ == '__main__':
23 | ep_robot = robot.Robot()
24 | ep_robot.initialize(conn_type="sta")
25 |
26 | ep_camera = ep_robot.camera
27 |
28 | # 显示十秒图传
29 | ep_camera.start_video_stream(display=True, resolution=camera.STREAM_360P)
30 | time.sleep(10)
31 | ep_camera.stop_video_stream()
32 |
33 | ep_robot.close()
34 |
--------------------------------------------------------------------------------
/examples/04_camera/02_video_strategy.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import time
18 | import robomaster
19 | from robomaster import robot
20 | import cv2
21 |
22 |
23 | if __name__ == '__main__':
24 | ep_robot = robot.Robot()
25 | ep_robot.initialize(conn_type="sta")
26 |
27 | ep_camera = ep_robot.camera
28 |
29 | # 每次获取最新的1帧图像显示,并停留1秒
30 | ep_camera.start_video_stream(display=False)
31 | for i in range(0, 10):
32 | img = ep_camera.read_cv2_image(strategy="newest")
33 | cv2.imshow("Robot", img)
34 | cv2.waitKey(1)
35 | time.sleep(1)
36 | cv2.destroyAllWindows()
37 | ep_camera.stop_video_stream()
38 |
39 | ep_robot.close()
40 |
--------------------------------------------------------------------------------
/examples/04_camera/03_video_without_display.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import cv2
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | ep_robot = robot.Robot()
23 | ep_robot.initialize(conn_type="sta")
24 |
25 | ep_camera = ep_robot.camera
26 |
27 | # 显示200帧图传
28 | ep_camera.start_video_stream(display=False)
29 | for i in range(0, 200):
30 | img = ep_camera.read_cv2_image()
31 | cv2.imshow("Robot", img)
32 | cv2.waitKey(1)
33 | cv2.destroyAllWindows()
34 | ep_camera.stop_video_stream()
35 |
36 | ep_robot.close()
37 |
--------------------------------------------------------------------------------
/examples/04_camera/05_record_audio.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | from robomaster import robot
18 |
19 |
20 | if __name__ == '__main__':
21 | ep_robot = robot.Robot()
22 | ep_robot.initialize(conn_type="rndis")
23 |
24 | ep_camera = ep_robot.camera
25 |
26 | ep_camera.record_audio(save_file="output.wav", seconds=5, sample_rate=16000)
27 | ep_robot.close()
28 |
--------------------------------------------------------------------------------
/examples/07_led/01_set_led.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import time
18 | from robomaster import robot
19 | from robomaster import led
20 |
21 |
22 | if __name__ == '__main__':
23 | ep_robot = robot.Robot()
24 | ep_robot.initialize(conn_type="sta")
25 |
26 | ep_led = ep_robot.led
27 |
28 | # 设置灯效为常亮,亮度递增
29 | bright = 1
30 | for i in range(0, 8):
31 | ep_led.set_led(comp=led.COMP_ALL, r=bright << i, g=bright << i, b=bright << i, effect=led.EFFECT_ON)
32 | time.sleep(1)
33 | print("brightness: {0}".format(bright << i))
34 |
35 | ep_robot.close()
36 |
37 |
--------------------------------------------------------------------------------
/examples/10_robotic_arm/01_move.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | ep_robot = robot.Robot()
23 | ep_robot.initialize(conn_type="sta")
24 |
25 | ep_arm = ep_robot.robotic_arm
26 |
27 | # 向前移动20毫米
28 | ep_arm.move(x=20, y=0).wait_for_completed()
29 | # 向后移动20毫米
30 | ep_arm.move(x=-20, y=0).wait_for_completed()
31 | # 向上移动20毫米
32 | ep_arm.move(x=0, y=20).wait_for_completed()
33 | # 向下移动20毫米
34 | ep_arm.move(x=0, y=-20).wait_for_completed()
35 |
36 | ep_robot.close()
37 |
--------------------------------------------------------------------------------
/examples/11_gripper/01_open_close.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import time
18 | import robomaster
19 | from robomaster import robot
20 |
21 |
22 | if __name__ == '__main__':
23 | ep_robot = robot.Robot()
24 | ep_robot.initialize(conn_type="sta")
25 |
26 | ep_gripper = ep_robot.gripper
27 |
28 | # 张开机械爪
29 | ep_gripper.open(power=50)
30 | time.sleep(1)
31 | ep_gripper.pause()
32 |
33 | # 闭合机械爪
34 | ep_gripper.close(power=50)
35 | time.sleep(1)
36 | ep_gripper.pause()
37 |
38 | ep_robot.close()
--------------------------------------------------------------------------------
/examples/12_drone/00_logger.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 | import robomaster
17 | from robomaster import robot
18 |
19 |
20 | if __name__ == '__main__':
21 | # 如果本地IP 自动获取不正确,手动指定本地IP地址
22 | # robomaster.config.LOCAL_IP_STR = "192.168.10.22"
23 |
24 | tl_drone = robot.Drone()
25 | tl_drone.initialize()
26 |
27 | # 获取飞机版本信息
28 | version = tl_drone.get_sdk_version()
29 | print("Drone Version: {0}".format(version))
30 |
31 | tl_drone.close()
32 |
--------------------------------------------------------------------------------
/examples/12_drone/01_ap_conn.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 | import robomaster
17 | from robomaster import robot
18 |
19 |
20 | if __name__ == '__main__':
21 | # 如果本地IP 自动获取不正确,手动指定本地IP地址
22 | # robomaster.config.LOCAL_IP_STR = "192.168.10.22"
23 | tl_drone = robot.Drone()
24 | # 初始化
25 | tl_drone.initialize()
26 |
27 | # 获取飞机SDK版本信息
28 | version = tl_drone.get_sdk_version()
29 | print("Drone SDK Version: {0}".format(version))
30 |
31 | tl_drone.close()
32 |
--------------------------------------------------------------------------------
/examples/12_drone/02_get_version.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | tl_drone = robot.Drone()
23 | tl_drone.initialize()
24 |
25 | # 获取飞机版本信息
26 | drone_version = tl_drone.get_sdk_version()
27 | print("Drone sdk version: {0}".format(drone_version))
28 |
29 | tl_drone.close()
30 |
--------------------------------------------------------------------------------
/examples/12_drone/03_get_sn.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | tl_drone = robot.Drone()
23 | tl_drone.initialize()
24 |
25 | # 获取飞机SN信息
26 | SN = tl_drone.get_sn()
27 | print("drone sn: {0}".format(SN))
28 |
29 | tl_drone.close()
30 |
--------------------------------------------------------------------------------
/examples/12_drone/04_get_battery.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | tl_drone = robot.Drone()
23 | tl_drone.initialize()
24 |
25 | # 获取飞机电池电量信息
26 | tl_battery = tl_drone.battery
27 | battery_info = tl_battery.get_battery()
28 | print("Drone battery soc: {0}".format(battery_info))
29 |
30 | tl_drone.close()
31 |
--------------------------------------------------------------------------------
/examples/12_drone/05_takeoff_land.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | tl_drone = robot.Drone()
23 | tl_drone.initialize()
24 |
25 | tl_flight = tl_drone.flight
26 |
27 | # 起飞后降落
28 | tl_flight.takeoff().wait_for_completed()
29 | tl_flight.land().wait_for_completed()
30 |
31 | tl_drone.close()
32 |
--------------------------------------------------------------------------------
/examples/12_drone/06_rotate.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | tl_drone = robot.Drone()
23 | tl_drone.initialize()
24 |
25 | tl_flight = tl_drone.flight
26 |
27 | # 起飞
28 | tl_flight.takeoff().wait_for_completed()
29 |
30 | # 旋转180度 和 -180度
31 | tl_flight.rotate(angle=180).wait_for_completed()
32 | tl_flight.rotate(angle=-180).wait_for_completed()
33 |
34 | # 降落
35 | tl_flight.land().wait_for_completed()
36 |
37 | tl_drone.close()
38 |
--------------------------------------------------------------------------------
/examples/12_drone/07_forward_backward.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | tl_drone = robot.Drone()
23 | tl_drone.initialize()
24 |
25 | tl_flight = tl_drone.flight
26 |
27 | # 起飞
28 | tl_flight.takeoff().wait_for_completed()
29 |
30 | # 向前飞50厘米,向后飞50厘米
31 | tl_flight.forward(distance=50).wait_for_completed()
32 | tl_flight.backward(distance=50).wait_for_completed()
33 |
34 | # 降落
35 | tl_flight.land().wait_for_completed()
36 |
37 | tl_drone.close()
38 |
--------------------------------------------------------------------------------
/examples/12_drone/08_up_down.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | tl_drone = robot.Drone()
23 | tl_drone.initialize()
24 |
25 | tl_flight = tl_drone.flight
26 |
27 | # 起飞
28 | tl_flight.takeoff().wait_for_completed()
29 |
30 | # 上升20厘米,下降20厘米
31 | tl_flight.up(distance=20).wait_for_completed()
32 | tl_flight.down(distance=20).wait_for_completed()
33 |
34 | # 降落
35 | tl_flight.land().wait_for_completed()
36 |
37 | tl_drone.close()
38 |
39 |
--------------------------------------------------------------------------------
/examples/12_drone/09_left_right.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | tl_drone = robot.Drone()
23 | tl_drone.initialize()
24 |
25 | tl_flight = tl_drone.flight
26 |
27 | # 起飞
28 | tl_flight.takeoff().wait_for_completed()
29 |
30 | # 向左飞50厘米,向右飞50厘米
31 | tl_flight.left(distance=50).wait_for_completed()
32 | tl_flight.right(distance=50).wait_for_completed()
33 |
34 | # 降落
35 | tl_flight.land().wait_for_completed()
36 |
37 | tl_drone.close()
38 |
--------------------------------------------------------------------------------
/examples/12_drone/10_go.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | tl_drone = robot.Drone()
23 | tl_drone.initialize()
24 |
25 | tl_flight = tl_drone.flight
26 |
27 | # 起飞
28 | tl_flight.takeoff().wait_for_completed()
29 |
30 | # 飞向指定地点
31 | tl_flight.go(x=100, y=100, z=30, speed=30).wait_for_completed()
32 | tl_flight.go(x=-100, y=-100, z=-30, speed=30).wait_for_completed()
33 |
34 | # 降落
35 | tl_flight.land().wait_for_completed()
36 |
37 | tl_drone.close()
38 |
39 |
--------------------------------------------------------------------------------
/examples/12_drone/11_curve.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 | from robomaster import flight
20 |
21 |
22 | if __name__ == '__main__':
23 | tl_drone = robot.Drone()
24 | tl_drone.initialize()
25 |
26 | tl_flight = tl_drone.flight
27 |
28 | # 起飞
29 | tl_flight.takeoff().wait_for_completed()
30 |
31 | # 曲线飞行
32 | tl_flight.curve(x1=60, y1=60, z1=0, x2=120, y2=0, z2=30, speed=30).wait_for_completed()
33 | tl_flight.curve(x1=-60, y1=60, z1=0, x2=-120, y2=0, z2=-30, speed=30).wait_for_completed()
34 |
35 | # 降落
36 | tl_flight.land().wait_for_completed()
37 |
38 | tl_drone.close()
39 |
--------------------------------------------------------------------------------
/examples/12_drone/12_flip.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | tl_drone = robot.Drone()
23 | tl_drone.initialize()
24 |
25 | tl_flight = tl_drone.flight
26 |
27 | # 起飞
28 | tl_flight.takeoff().wait_for_completed()
29 |
30 | # 不同方向翻转
31 | tl_flight.flip_forward().wait_for_completed()
32 | tl_flight.flip_backward().wait_for_completed()
33 | tl_flight.flip_left().wait_for_completed()
34 | tl_flight.flip_right().wait_for_completed()
35 |
36 | # 降落
37 | tl_flight.land().wait_for_completed()
38 |
39 | tl_drone.close()
40 |
--------------------------------------------------------------------------------
/examples/12_drone/13_rc.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import time
18 | import robomaster
19 | from robomaster import robot
20 |
21 | if __name__ == '__main__':
22 | tl_drone = robot.Drone()
23 | tl_drone.initialize()
24 |
25 | tl_flight = tl_drone.flight
26 |
27 | # 起飞
28 | tl_flight.takeoff().wait_for_completed()
29 |
30 | # 左移
31 | tl_flight.rc(a=20, b=0, c=0, d=0)
32 | time.sleep(4)
33 |
34 | # 右移
35 | tl_flight.rc(a=-20, b=0, c=0, d=0)
36 | time.sleep(3)
37 |
38 | # 停止
39 | tl_flight.rc(a=0, b=0, c=0, d=0)
40 |
41 | # 降落
42 | tl_flight.land().wait_for_completed()
43 |
44 | tl_drone.close()
45 |
--------------------------------------------------------------------------------
/examples/12_drone/16_video_stream.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 | import cv2
17 | from robomaster import robot
18 |
19 |
20 | if __name__ == '__main__':
21 | tl_drone = robot.Drone()
22 | tl_drone.initialize()
23 |
24 | tl_camera = tl_drone.camera
25 | # 显示302帧图传
26 | tl_camera.start_video_stream(display=False)
27 | tl_camera.set_fps("high")
28 | tl_camera.set_resolution("high")
29 | tl_camera.set_bitrate(6)
30 | for i in range(0, 302):
31 | img = tl_camera.read_cv2_image()
32 | cv2.imshow("Drone", img)
33 | cv2.waitKey(1)
34 | cv2.destroyAllWindows()
35 | tl_camera.stop_video_stream()
36 |
37 | tl_drone.close()
38 |
--------------------------------------------------------------------------------
/examples/12_drone/18_sub_battery.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import time
18 | import robomaster
19 | from robomaster import robot
20 |
21 |
22 | def sub_battery_info_handler(battery_info):
23 | battery_soc = battery_info
24 | print("Drone battery: soc {0}".format(battery_soc))
25 |
26 |
27 | if __name__ == '__main__':
28 | tl_drone = robot.Drone()
29 | tl_drone.initialize()
30 |
31 | # 订阅电池信息
32 | tl_drone.battery.sub_battery_info(freq=1, callback=sub_battery_info_handler)
33 | time.sleep(5)
34 |
35 | # 取消订阅
36 | tl_drone.battery.unsub_battery_info()
37 |
38 | tl_drone.close()
39 |
40 |
--------------------------------------------------------------------------------
/examples/12_drone/20_led.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import time
18 | import robomaster
19 | from robomaster import robot
20 |
21 |
22 | if __name__ == '__main__':
23 | tl_drone = robot.Drone()
24 | tl_drone.initialize()
25 |
26 | tl_led = tl_drone.led
27 |
28 | tl_led.set_led(r=0, g=0, b=0)
29 |
30 | rgb_list = [(100, 100, 100), (255, 255, 255), (255, 0, 0), (0, 0, 255),
31 | (0, 255, 0), (255, 255, 0), (255, 0, 255), (0, 255, 255)]
32 |
33 | for rgb_info in rgb_list:
34 | tl_led.set_led(r=rgb_info[0], g=rgb_info[1], b=rgb_info[2])
35 | time.sleep(0.5)
36 |
37 | tl_drone.close()
38 |
--------------------------------------------------------------------------------
/examples/12_drone/22_tof.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import time
18 | import robomaster
19 | from robomaster import robot
20 |
21 |
22 | if __name__ == '__main__':
23 | tl_drone = robot.Drone()
24 | tl_drone.initialize()
25 |
26 | for i in range(0, 10):
27 | tof_info = tl_drone.sensor.get_ext_tof()
28 | print("ext tof: {0}".format(tof_info))
29 | time.sleep(0.5)
30 |
31 | tl_drone.close()
32 |
33 |
--------------------------------------------------------------------------------
/examples/12_drone/23_set_sta.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | tl_drone = robot.Drone()
23 | tl_drone.initialize()
24 |
25 | # 切换飞行器WiFi模式为组网模式,指定路由器SSID和密码
26 | tl_drone.config_sta(ssid="RoboMaster_SDK_WiFi", password="12341234")
27 |
28 | tl_drone.close()
29 |
30 |
--------------------------------------------------------------------------------
/examples/12_drone/24_get_ssid.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 |
20 |
21 | if __name__ == '__main__':
22 | tl_drone = robot.Drone()
23 | tl_drone.initialize()
24 |
25 | # 获取飞机SSID信息
26 | ssid = tl_drone.get_ssid()
27 | print("drone ssid: {0}".format(ssid))
28 |
29 | tl_drone.close()
30 |
--------------------------------------------------------------------------------
/examples/13_servo/01_set_angle.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | from robomaster import robot
18 |
19 |
20 | if __name__ == '__main__':
21 | ep_robot = robot.Robot()
22 | ep_robot.initialize(conn_type="sta")
23 |
24 | ep_servo = ep_robot.servo
25 |
26 | # 舵机3 转到0度
27 | ep_servo.moveto(index=3, angle=90).wait_for_completed()
28 |
29 | ep_robot.close()
30 |
31 |
32 |
--------------------------------------------------------------------------------
/examples/14_sensor/02_tof_data.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 | import time
20 |
21 |
22 | def sub_data_handler(sub_info):
23 | distance = sub_info
24 | print("tof1:{0} tof2:{1} tof3:{2} tof4:{3}".format(distance[0], distance[1], distance[2], distance[3]))
25 |
26 |
27 | if __name__ == '__main__':
28 | ep_robot = robot.Robot()
29 | ep_robot.initialize(conn_type="sta")
30 |
31 | ep_sensor = ep_robot.sensor
32 | ep_sensor.sub_distance(freq=5, callback=sub_data_handler)
33 | time.sleep(60)
34 | ep_sensor.unsub_distance()
35 | ep_robot.close()
36 |
--------------------------------------------------------------------------------
/examples/14_sensor/03_io_data.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import robomaster
18 | from robomaster import robot
19 | import time
20 |
21 |
22 | def sub_data_handler(sub_info):
23 | io_data, ad_data = sub_info
24 | print("io value: {0}, ad value: {1}".format(io_data, ad_data))
25 |
26 |
27 | if __name__ == '__main__':
28 | ep_robot = robot.Robot()
29 | ep_robot.initialize(conn_type="sta")
30 |
31 | ep_sensor = ep_robot.sensor_adaptor
32 | ep_sensor.sub_adapter(freq=5, callback=sub_data_handler)
33 | time.sleep(60)
34 | ep_sensor.unsub_adapter()
35 | ep_robot.close()
36 |
--------------------------------------------------------------------------------
/examples/15_multi_robot/multi_drone/01_scan_ip.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI, Inc.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 | from multi_robomaster import multi_robot
17 |
18 |
19 | if __name__ == '__main__':
20 |
21 | multi_drone = multi_robot.MultiDrone()
22 | # change the robot_num that you want to scan
23 | multi_drone.initialize(robot_num=2)
24 | drone_ip_list = multi_drone._get_sn(timeout=10)
25 | for sn in drone_ip_list:
26 | print("scan result: sn:{0}, ip:{1}".format(sn, drone_ip_list[sn]))
27 |
28 |
29 |
--------------------------------------------------------------------------------
/examples/15_multi_robot/multi_ep/01_scan_robot_sn.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 | from robomaster import conn
17 |
18 |
19 | if __name__ == '__main__':
20 | # set the time for scanning ep robot
21 | conn.scan_robot_ip_list(timeout=10)
22 |
23 |
24 |
--------------------------------------------------------------------------------
/examples/17_ai_module/01_ai_module_tt.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | import time
18 | from robomaster import robot
19 |
20 |
21 | def sub_ia_info_handler(ai_info):
22 | id, x, y, w, h, C = ai_info
23 | print("ai target id:{0}, x:{1:.3f}, y:{2:.3f}, w:{3:.3f}, h:{4:.3f}, C:{5}".format(id, x, y, w, h, C))
24 |
25 |
26 | if __name__ == '__main__':
27 | tl_drone = robot.Drone()
28 | tl_drone.initialize()
29 |
30 | # 订阅AI模块信息
31 | tl_drone.ai_module.sub_ai_info(freq=5, callback=sub_ia_info_handler)
32 | time.sleep(60)
33 |
34 | # 取消订阅
35 | tl_drone.ai_module.unsub_ai_info()
36 |
37 | tl_drone.close()
38 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/README.md:
--------------------------------------------------------------------------------
1 | # RoboMaster-SDK
2 |
3 |
4 |
5 | Learn more about the RoboMaster Education Robot: https://www.dji.com/robomaster-ep
6 |
7 | RoboMaster Developer Guide: https://robomaster-dev.rtfd.io/
8 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/connection/README.md:
--------------------------------------------------------------------------------
1 | # Sample code
2 |
3 | Some sample code about robot connection.
4 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/connection/network/README.md:
--------------------------------------------------------------------------------
1 | # Connection
2 |
3 | robot_connection.py is a python module that supports a basic networking connection methods for connecting robots.
4 |
5 | For more information, please refer help(robot_connection) in python interpreter.
6 |
7 | About usage exapmle plase refer:
8 | - ./direct_connection.py
9 | - ./networking_conneciton.py
10 | - ./usb_connection.py
11 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/connection/network/direct_connection.py:
--------------------------------------------------------------------------------
1 | #! python3
2 |
3 | import robot_connection
4 |
5 | WIFI_DIRECT_CONNECTION_IP = '192.168.2.1'
6 |
7 | robot = robot_connection.RobotConnection(WIFI_DIRECT_CONNECTION_IP)
8 |
9 | if not robot.open():
10 | print('open fail')
11 | exit(1)
12 |
13 | robot.send_data('command')
14 | print('send data to robot : command')
15 | recv = robot.recv_ctrl_data(5)
16 | print('recv data from robot : %s'%recv)
17 |
18 |
19 | robot.send_data('version')
20 | print('send data to robot : version ?')
21 | recv = robot.recv_ctrl_data(5)
22 | print('recv data from robot : %s'%recv)
23 |
24 | robot.send_data('quit')
25 | print('send data to robot : quit')
26 | recv = robot.recv_ctrl_data(5)
27 | print('recv data from robot : %s'%recv)
28 |
29 | robot.close()
30 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/connection/network/networking_connection.py:
--------------------------------------------------------------------------------
1 | #! python3
2 |
3 | import robot_connection
4 |
5 | robot = robot_connection.RobotConnection()
6 |
7 | robot_ip = robot.get_robot_ip(10)
8 |
9 | if robot_ip:
10 | print('robot ip: %s'%robot_ip)
11 | robot.update_robot_ip(robot_ip)
12 |
13 | if not robot.open():
14 | print('open fail')
15 | exit(1)
16 |
17 | robot.send_data('command')
18 | print('send data to robot : command')
19 | recv = robot.recv_ctrl_data(5)
20 | print('recv data from robot : %s'%recv)
21 |
22 |
23 | robot.send_data('version ?')
24 | print('send data to robot : version ?')
25 | recv = robot.recv_ctrl_data(5)
26 | print('recv data from robot : %s'%recv)
27 |
28 | robot.send_data('quit')
29 | print('send data to robot : quit')
30 | recv = robot.recv_ctrl_data(5)
31 | print('recv data from robot : %s'%recv)
32 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/connection/network/usb_connection.py:
--------------------------------------------------------------------------------
1 | #! python3
2 |
3 | import robot_connection
4 |
5 | USB_DIRECT_CONNECTION_IP = '192.168.42.2'
6 |
7 | robot = robot_connection.RobotConnection(USB_DIRECT_CONNECTION_IP)
8 |
9 | if not robot.open():
10 | print('open fail')
11 | exit(1)
12 |
13 | robot.send_data('command')
14 | print('send data to robot : command')
15 | recv = robot.recv_ctrl_data(5)
16 | print('recv data from robot : %s'%recv)
17 |
18 |
19 | robot.send_data('version')
20 | print('send data to robot : version ?')
21 | recv = robot.recv_ctrl_data(5)
22 | print('recv data from robot : %s'%recv)
23 |
24 | robot.send_data('quit')
25 | print('send data to robot : quit')
26 | recv = robot.recv_ctrl_data(5)
27 | print('recv data from robot : %s'%recv)
28 |
29 | robot.close()
30 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/connection/uart/README.md:
--------------------------------------------------------------------------------
1 | # UART
2 |
3 | uart_connection.py is a usage exapmle about uart connection.
4 |
5 | The script has been tested by python3.x on windows OS.
6 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/connection/uart/uart_connection.py:
--------------------------------------------------------------------------------
1 | import serial
2 |
3 | ser = serial.Serial()
4 |
5 | # uart config baudrate 115200, bytesize 8, stopbit 1, prity None, timeout 0.2s
6 | ser.port = 'COM3'
7 | ser.baudrate = 115200
8 | ser.bytesize = serial.EIGHTBITS
9 | ser.stopbits = serial.STOPBITS_ONE
10 | ser.parity = serial.PARITY_NONE
11 | ser.timeout = 0.2
12 |
13 | # open uart
14 | ser.open()
15 |
16 | ser.write('command'.encode('utf-8'))
17 | print('send data to ser. : command')
18 | recv = ser.read()
19 | print('recv data from ser.: %s'%recv)
20 |
21 |
22 | ser.write('version'.encode('utf-8'))
23 | print('send data to ser. : version ?')
24 | recv = ser.read()
25 | print('recv data from ser.: %s'%recv)
26 |
27 | ser.write('quit'.encode('utf-8'))
28 | print('send data to ser. : quit')
29 | recv = ser.read()
30 | print('recv data from ser.: %s'%recv)
31 |
32 | ser.close()
33 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/build.sh:
--------------------------------------------------------------------------------
1 | mkdir _build_tmp
2 | cd _build_tmp
3 | cmake ../src
4 | make -j4
5 | cd ..
6 | rm -rf _build_tmp
7 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.4.1)
2 | project (robomaster_video_and_audio_decoder)
3 | set(CMAKE_CXX_STANDARD 11)
4 | set(CMAKE_BUILD_TYPE Release)
5 | SET(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/../output)
6 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
7 | find_package(Opus REQUIRED)
8 |
9 | set(PYBIND11_PYTHON_VERSION 3)
10 | set(PYBIND11_CPP_STANDARD -std=c++11)
11 | add_subdirectory(pybind11)
12 | #find_package(pybind11)
13 |
14 | pybind11_add_module(opus_decoder opus_decoder/opus_decoder.cpp)
15 | target_link_libraries(opus_decoder PRIVATE ${OPUS_LIBRARIES})
16 | target_include_directories(opus_decoder PRIVATE ${OPUS_INCLUDE_DIRS})
17 |
18 | pybind11_add_module(libh264decoder h264_decoder/h264decoder.cpp)
19 | target_link_libraries(libh264decoder PRIVATE avcodec swscale avutil)
20 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/cmake/FindOpus.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # - Find the opus include file and library
3 | #
4 | # OPUS_FOUND - system has opus
5 | # OPUS_INCLUDE_DIRS - the opus include directory
6 | # OPUS_LIBRARIES - The libraries needed to use opus
7 |
8 | find_path(OPUS_INCLUDE_DIRS
9 | NAMES opus/opus.h
10 | PATH_SUFFIXES include
11 | )
12 | if(OPUS_INCLUDE_DIRS)
13 | set(HAVE_OPUS_OPUS_H 1)
14 | endif()
15 |
16 | find_library(OPUS_LIBRARIES NAMES opus)
17 |
18 | if(OPUS_LIBRARIES)
19 | find_library(LIBM NAMES m)
20 | if(LIBM)
21 | list(APPEND OPUS_LIBRARIES ${LIBM})
22 | endif()
23 | endif()
24 |
25 | include(FindPackageHandleStandardArgs)
26 | find_package_handle_standard_args(Opus
27 | DEFAULT_MSG
28 | OPUS_INCLUDE_DIRS OPUS_LIBRARIES HAVE_OPUS_OPUS_H
29 | )
30 |
31 | mark_as_advanced(OPUS_INCLUDE_DIRS OPUS_LIBRARIES HAVE_OPUS_OPUS_H)
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/opus_decoder/opus_decoder.cpp:
--------------------------------------------------------------------------------
1 | #include "opus_decoder.h"
2 | #include
3 | namespace py = pybind11;
4 | PYBIND11_MODULE(opus_decoder, m) {
5 | m.doc()="opus_decoder for pybind11 plugin";
6 | py::class_ ad(m, "opus_decoder");
7 | ad.def(py::init(),py::arg("frame_size") = 960,
8 | py::arg("sample_rate") = 48000, py::arg("channels") = 1);
9 | ad.def("decode", &PyOpusDecoder::Decode, "Decode Function",py::arg("in"));
10 |
11 | }
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/MANIFEST.in:
--------------------------------------------------------------------------------
1 | recursive-include include/pybind11 *.h
2 | include LICENSE README.md CONTRIBUTING.md
3 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/docs/Doxyfile:
--------------------------------------------------------------------------------
1 | PROJECT_NAME = pybind11
2 | INPUT = ../include/pybind11/
3 | RECURSIVE = YES
4 |
5 | GENERATE_HTML = NO
6 | GENERATE_LATEX = NO
7 | GENERATE_XML = YES
8 | XML_OUTPUT = .build/doxygenxml
9 | XML_PROGRAMLISTING = YES
10 |
11 | MACRO_EXPANSION = YES
12 | EXPAND_ONLY_PREDEF = YES
13 | EXPAND_AS_DEFINED = PYBIND11_RUNTIME_EXCEPTION
14 |
15 | ALIASES = "rst=\verbatim embed:rst"
16 | ALIASES += "endrst=\endverbatim"
17 |
18 | QUIET = YES
19 | WARNINGS = YES
20 | WARN_IF_UNDOCUMENTED = NO
21 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/docs/_static/theme_overrides.css:
--------------------------------------------------------------------------------
1 | .wy-table-responsive table td,
2 | .wy-table-responsive table th {
3 | white-space: initial !important;
4 | }
5 | .rst-content table.docutils td {
6 | vertical-align: top !important;
7 | }
8 | div[class^='highlight'] pre {
9 | white-space: pre;
10 | white-space: pre-wrap;
11 | }
12 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/docs/advanced/pycpp/index.rst:
--------------------------------------------------------------------------------
1 | Python C++ interface
2 | ####################
3 |
4 | pybind11 exposes Python types and functions using thin C++ wrappers, which
5 | makes it possible to conveniently call Python code from C++ without resorting
6 | to Python's C API.
7 |
8 | .. toctree::
9 | :maxdepth: 2
10 |
11 | object
12 | numpy
13 | utilities
14 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/docs/index.rst:
--------------------------------------------------------------------------------
1 | .. only: not latex
2 |
3 | .. image:: pybind11-logo.png
4 |
5 | pybind11 --- Seamless operability between C++11 and Python
6 | ==========================================================
7 |
8 | .. only: not latex
9 |
10 | Contents:
11 |
12 | .. toctree::
13 | :maxdepth: 1
14 |
15 | intro
16 | changelog
17 | upgrade
18 |
19 | .. toctree::
20 | :caption: The Basics
21 | :maxdepth: 2
22 |
23 | basics
24 | classes
25 | compiling
26 |
27 | .. toctree::
28 | :caption: Advanced Topics
29 | :maxdepth: 2
30 |
31 | advanced/functions
32 | advanced/classes
33 | advanced/exceptions
34 | advanced/smart_ptrs
35 | advanced/cast/index
36 | advanced/pycpp/index
37 | advanced/embedding
38 | advanced/misc
39 |
40 | .. toctree::
41 | :caption: Extra Information
42 | :maxdepth: 1
43 |
44 | faq
45 | benchmark
46 | limitations
47 | reference
48 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/docs/limitations.rst:
--------------------------------------------------------------------------------
1 | Limitations
2 | ###########
3 |
4 | pybind11 strives to be a general solution to binding generation, but it also has
5 | certain limitations:
6 |
7 | - pybind11 casts away ``const``-ness in function arguments and return values.
8 | This is in line with the Python language, which has no concept of ``const``
9 | values. This means that some additional care is needed to avoid bugs that
10 | would be caught by the type checker in a traditional C++ program.
11 |
12 | - The NumPy interface ``pybind11::array`` greatly simplifies accessing
13 | numerical data from C++ (and vice versa), but it's not a full-blown array
14 | class like ``Eigen::Array`` or ``boost.multi_array``.
15 |
16 | These features could be implemented but would lead to a significant increase in
17 | complexity. I've decided to draw the line here to keep this project simple and
18 | compact. Users who absolutely require these features are encouraged to fork
19 | pybind11.
20 |
21 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/docs/pybind11-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/docs/pybind11-logo.png
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/docs/pybind11_vs_boost_python1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/docs/pybind11_vs_boost_python1.png
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/docs/pybind11_vs_boost_python2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/docs/pybind11_vs_boost_python2.png
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/docs/release.rst:
--------------------------------------------------------------------------------
1 | To release a new version of pybind11:
2 |
3 | - Update the version number and push to pypi
4 | - Update ``pybind11/_version.py`` (set release version, remove 'dev').
5 | - Update ``PYBIND11_VERSION_MAJOR`` etc. in ``include/pybind11/detail/common.h``.
6 | - Ensure that all the information in ``setup.py`` is up-to-date.
7 | - Update version in ``docs/conf.py``.
8 | - Tag release date in ``docs/changelog.rst``.
9 | - ``git add`` and ``git commit``.
10 | - if new minor version: ``git checkout -b vX.Y``, ``git push -u origin vX.Y``
11 | - ``git tag -a vX.Y.Z -m 'vX.Y.Z release'``.
12 | - ``git push``
13 | - ``git push --tags``.
14 | - ``python setup.py sdist upload``.
15 | - ``python setup.py bdist_wheel upload``.
16 | - Get back to work
17 | - Update ``_version.py`` (add 'dev' and increment minor).
18 | - Update version in ``docs/conf.py``
19 | - Update version macros in ``include/pybind11/common.h``
20 | - ``git add`` and ``git commit``.
21 | ``git push``
22 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/docs/requirements.txt:
--------------------------------------------------------------------------------
1 | breathe == 4.5.0
2 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/include/pybind11/common.h:
--------------------------------------------------------------------------------
1 | #include "detail/common.h"
2 | #warning "Including 'common.h' is deprecated. It will be removed in v3.0. Use 'pybind11.h'."
3 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/pybind11/__init__.py:
--------------------------------------------------------------------------------
1 | from ._version import version_info, __version__ # noqa: F401 imported but unused
2 |
3 |
4 | def get_include(user=False):
5 | import os
6 | d = os.path.dirname(__file__)
7 | if os.path.exists(os.path.join(d, "include")):
8 | # Package is installed
9 | return os.path.join(d, "include")
10 | else:
11 | # Package is from a source directory
12 | return os.path.join(os.path.dirname(d), "include")
13 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/pybind11/__main__.py:
--------------------------------------------------------------------------------
1 | from __future__ import print_function
2 |
3 | import argparse
4 | import sys
5 | import sysconfig
6 |
7 | from . import get_include
8 |
9 |
10 | def print_includes():
11 | dirs = [sysconfig.get_path('include'),
12 | sysconfig.get_path('platinclude'),
13 | get_include()]
14 |
15 | # Make unique but preserve order
16 | unique_dirs = []
17 | for d in dirs:
18 | if d not in unique_dirs:
19 | unique_dirs.append(d)
20 |
21 | print(' '.join('-I' + d for d in unique_dirs))
22 |
23 |
24 | def main():
25 | parser = argparse.ArgumentParser(prog='python -m pybind11')
26 | parser.add_argument('--includes', action='store_true',
27 | help='Include flags for both pybind11 and Python headers.')
28 | args = parser.parse_args()
29 | if not sys.argv[1:]:
30 | parser.print_help()
31 | if args.includes:
32 | print_includes()
33 |
34 |
35 | if __name__ == '__main__':
36 | main()
37 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/pybind11/_version.py:
--------------------------------------------------------------------------------
1 | version_info = (2, 4, 'dev4')
2 | __version__ = '.'.join(map(str, version_info))
3 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/setup.cfg:
--------------------------------------------------------------------------------
1 | [bdist_wheel]
2 | universal=1
3 |
4 | [flake8]
5 | max-line-length = 99
6 | show_source = True
7 | exclude = .git, __pycache__, build, dist, docs, tools, venv
8 | ignore =
9 | # required for pretty matrix formatting: multiple spaces after `,` and `[`
10 | E201, E241, W504,
11 | # camelcase 'cPickle' imported as lowercase 'pickle'
12 | N813
13 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/cross_module_gil_utils.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/cross_module_gil_utils.so
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/pybind11_cross_module_tests.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/pybind11_cross_module_tests.so
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/pybind11_tests.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/pybind11_tests.so
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/pytest.ini:
--------------------------------------------------------------------------------
1 | [pytest]
2 | minversion = 3.0
3 | norecursedirs = test_cmake_build test_embed
4 | addopts =
5 | # show summary of skipped tests
6 | -rs
7 | # capture only Python print and C++ py::print, but not C output (low-level Python errors)
8 | --capture=sys
9 | filterwarnings =
10 | # make warnings into errors but ignore certain third-party extension issues
11 | error
12 | # importing scipy submodules on some version of Python
13 | ignore::ImportWarning
14 | # bogus numpy ABI warning (see numpy/#432)
15 | ignore:.*numpy.dtype size changed.*:RuntimeWarning
16 | ignore:.*numpy.ufunc size changed.*:RuntimeWarning
17 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_async.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | tests/test_async.cpp -- __await__ support
3 |
4 | Copyright (c) 2019 Google Inc.
5 |
6 | All rights reserved. Use of this source code is governed by a
7 | BSD-style license that can be found in the LICENSE file.
8 | */
9 |
10 | #include "pybind11_tests.h"
11 |
12 | TEST_SUBMODULE(async_module, m) {
13 | struct DoesNotSupportAsync {};
14 | py::class_(m, "DoesNotSupportAsync")
15 | .def(py::init<>());
16 | struct SupportsAsync {};
17 | py::class_(m, "SupportsAsync")
18 | .def(py::init<>())
19 | .def("__await__", [](const SupportsAsync& self) -> py::object {
20 | static_cast(self);
21 | py::object loop = py::module::import("asyncio.events").attr("get_event_loop")();
22 | py::object f = loop.attr("create_future")();
23 | f.attr("set_result")(5);
24 | return f.attr("__await__")();
25 | });
26 | }
27 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_async.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 | import pytest
3 | from pybind11_tests import async_module as m
4 |
5 |
6 | @pytest.fixture
7 | def event_loop():
8 | loop = asyncio.new_event_loop()
9 | yield loop
10 | loop.close()
11 |
12 |
13 | async def get_await_result(x):
14 | return await x
15 |
16 |
17 | def test_await(event_loop):
18 | assert 5 == event_loop.run_until_complete(get_await_result(m.SupportsAsync()))
19 |
20 |
21 | def test_await_missing(event_loop):
22 | with pytest.raises(TypeError):
23 | event_loop.run_until_complete(get_await_result(m.DoesNotSupportAsync()))
24 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_cmake_build/embed.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | namespace py = pybind11;
3 |
4 | PYBIND11_EMBEDDED_MODULE(test_cmake_build, m) {
5 | m.def("add", [](int i, int j) { return i + j; });
6 | }
7 |
8 | int main(int argc, char *argv[]) {
9 | if (argc != 2)
10 | throw std::runtime_error("Expected test.py file as the first argument");
11 | auto test_py_file = argv[1];
12 |
13 | py::scoped_interpreter guard{};
14 |
15 | auto m = py::module::import("test_cmake_build");
16 | if (m.attr("add")(1, 2).cast() != 3)
17 | throw std::runtime_error("embed.cpp failed");
18 |
19 | py::module::import("sys").attr("argv") = py::make_tuple("test.py", "embed.cpp");
20 | py::eval_file(test_py_file, py::globals());
21 | }
22 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0)
2 | project(test_installed_embed CXX)
3 |
4 | set(CMAKE_MODULE_PATH "")
5 | find_package(pybind11 CONFIG REQUIRED)
6 | message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}")
7 |
8 | add_executable(test_cmake_build ../embed.cpp)
9 | target_link_libraries(test_cmake_build PRIVATE pybind11::embed)
10 |
11 | # Do not treat includes from IMPORTED target as SYSTEM (Python headers in pybind11::embed).
12 | # This may be needed to resolve header conflicts, e.g. between Python release and debug headers.
13 | set_target_properties(test_cmake_build PROPERTIES NO_SYSTEM_FROM_IMPORTED ON)
14 |
15 | add_custom_target(check $ ${PROJECT_SOURCE_DIR}/../test.py)
16 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.12)
2 | project(test_installed_module CXX)
3 |
4 | set(CMAKE_MODULE_PATH "")
5 |
6 | find_package(pybind11 CONFIG REQUIRED)
7 | message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}")
8 |
9 | pybind11_add_module(test_cmake_build SHARED NO_EXTRAS ../main.cpp)
10 |
11 | add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$
12 | ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME})
13 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0)
2 | project(test_installed_target CXX)
3 |
4 | set(CMAKE_MODULE_PATH "")
5 |
6 | find_package(pybind11 CONFIG REQUIRED)
7 | message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}")
8 |
9 | add_library(test_cmake_build MODULE ../main.cpp)
10 |
11 | target_link_libraries(test_cmake_build PRIVATE pybind11::module)
12 |
13 | # make sure result is, for example, test_installed_target.so, not libtest_installed_target.dylib
14 | set_target_properties(test_cmake_build PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
15 | SUFFIX "${PYTHON_MODULE_EXTENSION}")
16 |
17 | # Do not treat includes from IMPORTED target as SYSTEM (Python headers in pybind11::module).
18 | # This may be needed to resolve header conflicts, e.g. between Python release and debug headers.
19 | set_target_properties(test_cmake_build PROPERTIES NO_SYSTEM_FROM_IMPORTED ON)
20 |
21 | add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$
22 | ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME})
23 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_cmake_build/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | namespace py = pybind11;
3 |
4 | PYBIND11_MODULE(test_cmake_build, m) {
5 | m.def("add", [](int i, int j) { return i + j; });
6 | }
7 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0)
2 | project(test_subdirectory_embed CXX)
3 |
4 | set(PYBIND11_INSTALL ON CACHE BOOL "")
5 | set(PYBIND11_EXPORT_NAME test_export)
6 |
7 | add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11)
8 |
9 | # Test basic target functionality
10 | add_executable(test_cmake_build ../embed.cpp)
11 | target_link_libraries(test_cmake_build PRIVATE pybind11::embed)
12 |
13 | add_custom_target(check $ ${PROJECT_SOURCE_DIR}/../test.py)
14 |
15 | # Test custom export group -- PYBIND11_EXPORT_NAME
16 | add_library(test_embed_lib ../embed.cpp)
17 | target_link_libraries(test_embed_lib PRIVATE pybind11::embed)
18 |
19 | install(TARGETS test_embed_lib
20 | EXPORT test_export
21 | ARCHIVE DESTINATION bin
22 | LIBRARY DESTINATION lib
23 | RUNTIME DESTINATION lib)
24 | install(EXPORT test_export
25 | DESTINATION lib/cmake/test_export/test_export-Targets.cmake)
26 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.12)
2 | project(test_subdirectory_module CXX)
3 |
4 | add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11)
5 | pybind11_add_module(test_cmake_build THIN_LTO ../main.cpp)
6 |
7 | add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$
8 | ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME})
9 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0)
2 | project(test_subdirectory_target CXX)
3 |
4 | add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11)
5 |
6 | add_library(test_cmake_build MODULE ../main.cpp)
7 |
8 | target_link_libraries(test_cmake_build PRIVATE pybind11::module)
9 |
10 | # make sure result is, for example, test_installed_target.so, not libtest_installed_target.dylib
11 | set_target_properties(test_cmake_build PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
12 | SUFFIX "${PYTHON_MODULE_EXTENSION}")
13 |
14 | add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$
15 | ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME})
16 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_cmake_build/test.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import test_cmake_build
3 |
4 | assert test_cmake_build.add(1, 2) == 3
5 | print("{} imports, runs, and adds: 1 + 2 = 3".format(sys.argv[1]))
6 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_embed/catch.cpp:
--------------------------------------------------------------------------------
1 | // The Catch implementation is compiled here. This is a standalone
2 | // translation unit to avoid recompiling it for every test change.
3 |
4 | #include
5 |
6 | #ifdef _MSC_VER
7 | // Silence MSVC C++17 deprecation warning from Catch regarding std::uncaught_exceptions (up to catch
8 | // 2.0.1; this should be fixed in the next catch release after 2.0.1).
9 | # pragma warning(disable: 4996)
10 | #endif
11 |
12 | #define CATCH_CONFIG_RUNNER
13 | #include
14 |
15 | namespace py = pybind11;
16 |
17 | int main(int argc, char *argv[]) {
18 | py::scoped_interpreter guard{};
19 | auto result = Catch::Session().run(argc, argv);
20 |
21 | return result < 0xff ? result : 0xff;
22 | }
23 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_embed/external_module.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | namespace py = pybind11;
4 |
5 | /* Simple test module/test class to check that the referenced internals data of external pybind11
6 | * modules aren't preserved over a finalize/initialize.
7 | */
8 |
9 | PYBIND11_MODULE(external_module, m) {
10 | class A {
11 | public:
12 | A(int value) : v{value} {};
13 | int v;
14 | };
15 |
16 | py::class_(m, "A")
17 | .def(py::init())
18 | .def_readwrite("value", &A::v);
19 |
20 | m.def("internals_at", []() {
21 | return reinterpret_cast(&py::detail::get_internals());
22 | });
23 | }
24 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_embed/test_interpreter.py:
--------------------------------------------------------------------------------
1 | from widget_module import Widget
2 |
3 |
4 | class DerivedWidget(Widget):
5 | def __init__(self, message):
6 | super(DerivedWidget, self).__init__(message)
7 |
8 | def the_answer(self):
9 | return 42
10 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_eval.py:
--------------------------------------------------------------------------------
1 | import os
2 | from pybind11_tests import eval_ as m
3 |
4 |
5 | def test_evals(capture):
6 | with capture:
7 | assert m.test_eval_statements()
8 | assert capture == "Hello World!"
9 |
10 | assert m.test_eval()
11 | assert m.test_eval_single_statement()
12 |
13 | filename = os.path.join(os.path.dirname(__file__), "test_eval_call.py")
14 | assert m.test_eval_file(filename)
15 |
16 | assert m.test_eval_failure()
17 | assert m.test_eval_file_failure()
18 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_eval_call.py:
--------------------------------------------------------------------------------
1 | # This file is called from 'test_eval.py'
2 |
3 | if 'call_test2' in locals():
4 | call_test2(y) # noqa: F821 undefined name
5 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_tagbased_polymorphic.py:
--------------------------------------------------------------------------------
1 | from pybind11_tests import tagbased_polymorphic as m
2 |
3 |
4 | def test_downcast():
5 | zoo = m.create_zoo()
6 | assert [type(animal) for animal in zoo] == [
7 | m.Labrador, m.Dog, m.Chihuahua, m.Cat, m.Panther
8 | ]
9 | assert [animal.name for animal in zoo] == [
10 | "Fido", "Ginger", "Hertzl", "Tiger", "Leo"
11 | ]
12 | zoo[1].sound = "woooooo"
13 | assert [dog.bark() for dog in zoo[:3]] == [
14 | "Labrador Fido goes WOOF!",
15 | "Dog Ginger goes woooooo",
16 | "Chihuahua Hertzl goes iyiyiyiyiyi and runs in circles"
17 | ]
18 | assert [cat.purr() for cat in zoo[3:]] == ["mrowr", "mrrrRRRRRR"]
19 | zoo[0].excitement -= 1000
20 | assert zoo[0].excitement == 14000
21 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_union.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | tests/test_class.cpp -- test py::class_ definitions and basic functionality
3 |
4 | Copyright (c) 2019 Roland Dreier
5 |
6 | All rights reserved. Use of this source code is governed by a
7 | BSD-style license that can be found in the LICENSE file.
8 | */
9 |
10 | #include "pybind11_tests.h"
11 |
12 | TEST_SUBMODULE(union_, m) {
13 | union TestUnion {
14 | int value_int;
15 | unsigned value_uint;
16 | };
17 |
18 | py::class_(m, "TestUnion")
19 | .def(py::init<>())
20 | .def_readonly("as_int", &TestUnion::value_int)
21 | .def_readwrite("as_uint", &TestUnion::value_uint);
22 | }
23 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tests/test_union.py:
--------------------------------------------------------------------------------
1 | from pybind11_tests import union_ as m
2 |
3 |
4 | def test_union():
5 | instance = m.TestUnion()
6 |
7 | instance.as_uint = 10
8 | assert instance.as_int == 10
9 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/src/pybind11/tools/libsize.py:
--------------------------------------------------------------------------------
1 | from __future__ import print_function, division
2 | import os
3 | import sys
4 |
5 | # Internal build script for generating debugging test .so size.
6 | # Usage:
7 | # python libsize.py file.so save.txt -- displays the size of file.so and, if save.txt exists, compares it to the
8 | # size in it, then overwrites save.txt with the new size for future runs.
9 |
10 | if len(sys.argv) != 3:
11 | sys.exit("Invalid arguments: usage: python libsize.py file.so save.txt")
12 |
13 | lib = sys.argv[1]
14 | save = sys.argv[2]
15 |
16 | if not os.path.exists(lib):
17 | sys.exit("Error: requested file ({}) does not exist".format(lib))
18 |
19 | libsize = os.path.getsize(lib)
20 |
21 | print("------", os.path.basename(lib), "file size:", libsize, end='')
22 |
23 | if os.path.exists(save):
24 | with open(save) as sf:
25 | oldsize = int(sf.readline())
26 |
27 | if oldsize > 0:
28 | change = libsize - oldsize
29 | if change == 0:
30 | print(" (no change)")
31 | else:
32 | print(" (change of {:+} bytes = {:+.2%})".format(change, change / oldsize))
33 | else:
34 | print()
35 |
36 | with open(save, 'w') as sf:
37 | sf.write(str(libsize))
38 |
39 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/build.sh:
--------------------------------------------------------------------------------
1 | mkdir _build_tmp
2 | cd _build_tmp
3 | cmake ../src
4 | make -j4
5 | cd ..
6 | rm -rf _build_tmp
7 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.4.1)
2 | project (robomaster_video_and_audio_decoder)
3 | set(CMAKE_CXX_STANDARD 11)
4 | set(CMAKE_BUILD_TYPE Release)
5 | SET(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/../output)
6 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
7 | find_package(Opus REQUIRED)
8 |
9 | set(PYBIND11_PYTHON_VERSION 3)
10 | set(PYBIND11_CPP_STANDARD -std=c++11)
11 | add_subdirectory(pybind11)
12 | #find_package(pybind11)
13 |
14 | pybind11_add_module(opus_decoder opus_decoder/opus_decoder.cpp)
15 | target_link_libraries(opus_decoder PRIVATE ${OPUS_LIBRARIES})
16 | target_include_directories(opus_decoder PRIVATE ${OPUS_INCLUDE_DIRS})
17 |
18 | pybind11_add_module(libh264decoder h264_decoder/h264decoder.cpp)
19 | target_link_libraries(libh264decoder PRIVATE avcodec swscale avutil)
20 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/cmake/FindOpus.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # - Find the opus include file and library
3 | #
4 | # OPUS_FOUND - system has opus
5 | # OPUS_INCLUDE_DIRS - the opus include directory
6 | # OPUS_LIBRARIES - The libraries needed to use opus
7 |
8 | find_path(OPUS_INCLUDE_DIRS
9 | NAMES opus/opus.h
10 | PATH_SUFFIXES include
11 | )
12 | if(OPUS_INCLUDE_DIRS)
13 | set(HAVE_OPUS_OPUS_H 1)
14 | endif()
15 |
16 | find_library(OPUS_LIBRARIES NAMES opus)
17 |
18 | if(OPUS_LIBRARIES)
19 | find_library(LIBM NAMES m)
20 | if(LIBM)
21 | list(APPEND OPUS_LIBRARIES ${LIBM})
22 | endif()
23 | endif()
24 |
25 | include(FindPackageHandleStandardArgs)
26 | find_package_handle_standard_args(Opus
27 | DEFAULT_MSG
28 | OPUS_INCLUDE_DIRS OPUS_LIBRARIES HAVE_OPUS_OPUS_H
29 | )
30 |
31 | mark_as_advanced(OPUS_INCLUDE_DIRS OPUS_LIBRARIES HAVE_OPUS_OPUS_H)
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/opus_decoder/opus_decoder.cpp:
--------------------------------------------------------------------------------
1 | #include "opus_decoder.h"
2 | #include
3 | namespace py = pybind11;
4 | PYBIND11_MODULE(opus_decoder, m) {
5 | m.doc()="opus_decoder for pybind11 plugin";
6 | py::class_ ad(m, "opus_decoder");
7 | ad.def(py::init(),py::arg("frame_size") = 960,
8 | py::arg("sample_rate") = 48000, py::arg("channels") = 1);
9 | ad.def("decode", &PyOpusDecoder::Decode, "Decode Function",py::arg("in"));
10 |
11 | }
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/MANIFEST.in:
--------------------------------------------------------------------------------
1 | recursive-include include/pybind11 *.h
2 | include LICENSE README.md CONTRIBUTING.md
3 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/docs/Doxyfile:
--------------------------------------------------------------------------------
1 | PROJECT_NAME = pybind11
2 | INPUT = ../include/pybind11/
3 | RECURSIVE = YES
4 |
5 | GENERATE_HTML = NO
6 | GENERATE_LATEX = NO
7 | GENERATE_XML = YES
8 | XML_OUTPUT = .build/doxygenxml
9 | XML_PROGRAMLISTING = YES
10 |
11 | MACRO_EXPANSION = YES
12 | EXPAND_ONLY_PREDEF = YES
13 | EXPAND_AS_DEFINED = PYBIND11_RUNTIME_EXCEPTION
14 |
15 | ALIASES = "rst=\verbatim embed:rst"
16 | ALIASES += "endrst=\endverbatim"
17 |
18 | QUIET = YES
19 | WARNINGS = YES
20 | WARN_IF_UNDOCUMENTED = NO
21 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/docs/_static/theme_overrides.css:
--------------------------------------------------------------------------------
1 | .wy-table-responsive table td,
2 | .wy-table-responsive table th {
3 | white-space: initial !important;
4 | }
5 | .rst-content table.docutils td {
6 | vertical-align: top !important;
7 | }
8 | div[class^='highlight'] pre {
9 | white-space: pre;
10 | white-space: pre-wrap;
11 | }
12 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/docs/advanced/pycpp/index.rst:
--------------------------------------------------------------------------------
1 | Python C++ interface
2 | ####################
3 |
4 | pybind11 exposes Python types and functions using thin C++ wrappers, which
5 | makes it possible to conveniently call Python code from C++ without resorting
6 | to Python's C API.
7 |
8 | .. toctree::
9 | :maxdepth: 2
10 |
11 | object
12 | numpy
13 | utilities
14 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/docs/index.rst:
--------------------------------------------------------------------------------
1 | .. only: not latex
2 |
3 | .. image:: pybind11-logo.png
4 |
5 | pybind11 --- Seamless operability between C++11 and Python
6 | ==========================================================
7 |
8 | .. only: not latex
9 |
10 | Contents:
11 |
12 | .. toctree::
13 | :maxdepth: 1
14 |
15 | intro
16 | changelog
17 | upgrade
18 |
19 | .. toctree::
20 | :caption: The Basics
21 | :maxdepth: 2
22 |
23 | basics
24 | classes
25 | compiling
26 |
27 | .. toctree::
28 | :caption: Advanced Topics
29 | :maxdepth: 2
30 |
31 | advanced/functions
32 | advanced/classes
33 | advanced/exceptions
34 | advanced/smart_ptrs
35 | advanced/cast/index
36 | advanced/pycpp/index
37 | advanced/embedding
38 | advanced/misc
39 |
40 | .. toctree::
41 | :caption: Extra Information
42 | :maxdepth: 1
43 |
44 | faq
45 | benchmark
46 | limitations
47 | reference
48 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/docs/limitations.rst:
--------------------------------------------------------------------------------
1 | Limitations
2 | ###########
3 |
4 | pybind11 strives to be a general solution to binding generation, but it also has
5 | certain limitations:
6 |
7 | - pybind11 casts away ``const``-ness in function arguments and return values.
8 | This is in line with the Python language, which has no concept of ``const``
9 | values. This means that some additional care is needed to avoid bugs that
10 | would be caught by the type checker in a traditional C++ program.
11 |
12 | - The NumPy interface ``pybind11::array`` greatly simplifies accessing
13 | numerical data from C++ (and vice versa), but it's not a full-blown array
14 | class like ``Eigen::Array`` or ``boost.multi_array``.
15 |
16 | These features could be implemented but would lead to a significant increase in
17 | complexity. I've decided to draw the line here to keep this project simple and
18 | compact. Users who absolutely require these features are encouraged to fork
19 | pybind11.
20 |
21 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/docs/pybind11-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/docs/pybind11-logo.png
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/docs/pybind11_vs_boost_python1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/docs/pybind11_vs_boost_python1.png
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/docs/pybind11_vs_boost_python2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/docs/pybind11_vs_boost_python2.png
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/docs/release.rst:
--------------------------------------------------------------------------------
1 | To release a new version of pybind11:
2 |
3 | - Update the version number and push to pypi
4 | - Update ``pybind11/_version.py`` (set release version, remove 'dev').
5 | - Update ``PYBIND11_VERSION_MAJOR`` etc. in ``include/pybind11/detail/common.h``.
6 | - Ensure that all the information in ``setup.py`` is up-to-date.
7 | - Update version in ``docs/conf.py``.
8 | - Tag release date in ``docs/changelog.rst``.
9 | - ``git add`` and ``git commit``.
10 | - if new minor version: ``git checkout -b vX.Y``, ``git push -u origin vX.Y``
11 | - ``git tag -a vX.Y.Z -m 'vX.Y.Z release'``.
12 | - ``git push``
13 | - ``git push --tags``.
14 | - ``python setup.py sdist upload``.
15 | - ``python setup.py bdist_wheel upload``.
16 | - Get back to work
17 | - Update ``_version.py`` (add 'dev' and increment minor).
18 | - Update version in ``docs/conf.py``
19 | - Update version macros in ``include/pybind11/common.h``
20 | - ``git add`` and ``git commit``.
21 | ``git push``
22 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/docs/requirements.txt:
--------------------------------------------------------------------------------
1 | breathe == 4.5.0
2 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/include/pybind11/common.h:
--------------------------------------------------------------------------------
1 | #include "detail/common.h"
2 | #warning "Including 'common.h' is deprecated. It will be removed in v3.0. Use 'pybind11.h'."
3 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/pybind11/__init__.py:
--------------------------------------------------------------------------------
1 | from ._version import version_info, __version__ # noqa: F401 imported but unused
2 |
3 |
4 | def get_include(user=False):
5 | import os
6 | d = os.path.dirname(__file__)
7 | if os.path.exists(os.path.join(d, "include")):
8 | # Package is installed
9 | return os.path.join(d, "include")
10 | else:
11 | # Package is from a source directory
12 | return os.path.join(os.path.dirname(d), "include")
13 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/pybind11/__main__.py:
--------------------------------------------------------------------------------
1 | from __future__ import print_function
2 |
3 | import argparse
4 | import sys
5 | import sysconfig
6 |
7 | from . import get_include
8 |
9 |
10 | def print_includes():
11 | dirs = [sysconfig.get_path('include'),
12 | sysconfig.get_path('platinclude'),
13 | get_include()]
14 |
15 | # Make unique but preserve order
16 | unique_dirs = []
17 | for d in dirs:
18 | if d not in unique_dirs:
19 | unique_dirs.append(d)
20 |
21 | print(' '.join('-I' + d for d in unique_dirs))
22 |
23 |
24 | def main():
25 | parser = argparse.ArgumentParser(prog='python -m pybind11')
26 | parser.add_argument('--includes', action='store_true',
27 | help='Include flags for both pybind11 and Python headers.')
28 | args = parser.parse_args()
29 | if not sys.argv[1:]:
30 | parser.print_help()
31 | if args.includes:
32 | print_includes()
33 |
34 |
35 | if __name__ == '__main__':
36 | main()
37 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/pybind11/_version.py:
--------------------------------------------------------------------------------
1 | version_info = (2, 4, 'dev4')
2 | __version__ = '.'.join(map(str, version_info))
3 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/setup.cfg:
--------------------------------------------------------------------------------
1 | [bdist_wheel]
2 | universal=1
3 |
4 | [flake8]
5 | max-line-length = 99
6 | show_source = True
7 | exclude = .git, __pycache__, build, dist, docs, tools, venv
8 | ignore =
9 | # required for pretty matrix formatting: multiple spaces after `,` and `[`
10 | E201, E241, W504,
11 | # camelcase 'cPickle' imported as lowercase 'pickle'
12 | N813
13 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/cross_module_gil_utils.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/cross_module_gil_utils.so
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/pybind11_cross_module_tests.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/pybind11_cross_module_tests.so
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/pybind11_tests.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/pybind11_tests.so
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/pytest.ini:
--------------------------------------------------------------------------------
1 | [pytest]
2 | minversion = 3.0
3 | norecursedirs = test_cmake_build test_embed
4 | addopts =
5 | # show summary of skipped tests
6 | -rs
7 | # capture only Python print and C++ py::print, but not C output (low-level Python errors)
8 | --capture=sys
9 | filterwarnings =
10 | # make warnings into errors but ignore certain third-party extension issues
11 | error
12 | # importing scipy submodules on some version of Python
13 | ignore::ImportWarning
14 | # bogus numpy ABI warning (see numpy/#432)
15 | ignore:.*numpy.dtype size changed.*:RuntimeWarning
16 | ignore:.*numpy.ufunc size changed.*:RuntimeWarning
17 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_async.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | tests/test_async.cpp -- __await__ support
3 |
4 | Copyright (c) 2019 Google Inc.
5 |
6 | All rights reserved. Use of this source code is governed by a
7 | BSD-style license that can be found in the LICENSE file.
8 | */
9 |
10 | #include "pybind11_tests.h"
11 |
12 | TEST_SUBMODULE(async_module, m) {
13 | struct DoesNotSupportAsync {};
14 | py::class_(m, "DoesNotSupportAsync")
15 | .def(py::init<>());
16 | struct SupportsAsync {};
17 | py::class_(m, "SupportsAsync")
18 | .def(py::init<>())
19 | .def("__await__", [](const SupportsAsync& self) -> py::object {
20 | static_cast(self);
21 | py::object loop = py::module::import("asyncio.events").attr("get_event_loop")();
22 | py::object f = loop.attr("create_future")();
23 | f.attr("set_result")(5);
24 | return f.attr("__await__")();
25 | });
26 | }
27 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_async.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 | import pytest
3 | from pybind11_tests import async_module as m
4 |
5 |
6 | @pytest.fixture
7 | def event_loop():
8 | loop = asyncio.new_event_loop()
9 | yield loop
10 | loop.close()
11 |
12 |
13 | async def get_await_result(x):
14 | return await x
15 |
16 |
17 | def test_await(event_loop):
18 | assert 5 == event_loop.run_until_complete(get_await_result(m.SupportsAsync()))
19 |
20 |
21 | def test_await_missing(event_loop):
22 | with pytest.raises(TypeError):
23 | event_loop.run_until_complete(get_await_result(m.DoesNotSupportAsync()))
24 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_cmake_build/embed.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | namespace py = pybind11;
3 |
4 | PYBIND11_EMBEDDED_MODULE(test_cmake_build, m) {
5 | m.def("add", [](int i, int j) { return i + j; });
6 | }
7 |
8 | int main(int argc, char *argv[]) {
9 | if (argc != 2)
10 | throw std::runtime_error("Expected test.py file as the first argument");
11 | auto test_py_file = argv[1];
12 |
13 | py::scoped_interpreter guard{};
14 |
15 | auto m = py::module::import("test_cmake_build");
16 | if (m.attr("add")(1, 2).cast() != 3)
17 | throw std::runtime_error("embed.cpp failed");
18 |
19 | py::module::import("sys").attr("argv") = py::make_tuple("test.py", "embed.cpp");
20 | py::eval_file(test_py_file, py::globals());
21 | }
22 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0)
2 | project(test_installed_embed CXX)
3 |
4 | set(CMAKE_MODULE_PATH "")
5 | find_package(pybind11 CONFIG REQUIRED)
6 | message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}")
7 |
8 | add_executable(test_cmake_build ../embed.cpp)
9 | target_link_libraries(test_cmake_build PRIVATE pybind11::embed)
10 |
11 | # Do not treat includes from IMPORTED target as SYSTEM (Python headers in pybind11::embed).
12 | # This may be needed to resolve header conflicts, e.g. between Python release and debug headers.
13 | set_target_properties(test_cmake_build PROPERTIES NO_SYSTEM_FROM_IMPORTED ON)
14 |
15 | add_custom_target(check $ ${PROJECT_SOURCE_DIR}/../test.py)
16 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.12)
2 | project(test_installed_module CXX)
3 |
4 | set(CMAKE_MODULE_PATH "")
5 |
6 | find_package(pybind11 CONFIG REQUIRED)
7 | message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}")
8 |
9 | pybind11_add_module(test_cmake_build SHARED NO_EXTRAS ../main.cpp)
10 |
11 | add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$
12 | ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME})
13 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0)
2 | project(test_installed_target CXX)
3 |
4 | set(CMAKE_MODULE_PATH "")
5 |
6 | find_package(pybind11 CONFIG REQUIRED)
7 | message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}")
8 |
9 | add_library(test_cmake_build MODULE ../main.cpp)
10 |
11 | target_link_libraries(test_cmake_build PRIVATE pybind11::module)
12 |
13 | # make sure result is, for example, test_installed_target.so, not libtest_installed_target.dylib
14 | set_target_properties(test_cmake_build PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
15 | SUFFIX "${PYTHON_MODULE_EXTENSION}")
16 |
17 | # Do not treat includes from IMPORTED target as SYSTEM (Python headers in pybind11::module).
18 | # This may be needed to resolve header conflicts, e.g. between Python release and debug headers.
19 | set_target_properties(test_cmake_build PROPERTIES NO_SYSTEM_FROM_IMPORTED ON)
20 |
21 | add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$
22 | ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME})
23 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_cmake_build/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | namespace py = pybind11;
3 |
4 | PYBIND11_MODULE(test_cmake_build, m) {
5 | m.def("add", [](int i, int j) { return i + j; });
6 | }
7 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0)
2 | project(test_subdirectory_embed CXX)
3 |
4 | set(PYBIND11_INSTALL ON CACHE BOOL "")
5 | set(PYBIND11_EXPORT_NAME test_export)
6 |
7 | add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11)
8 |
9 | # Test basic target functionality
10 | add_executable(test_cmake_build ../embed.cpp)
11 | target_link_libraries(test_cmake_build PRIVATE pybind11::embed)
12 |
13 | add_custom_target(check $ ${PROJECT_SOURCE_DIR}/../test.py)
14 |
15 | # Test custom export group -- PYBIND11_EXPORT_NAME
16 | add_library(test_embed_lib ../embed.cpp)
17 | target_link_libraries(test_embed_lib PRIVATE pybind11::embed)
18 |
19 | install(TARGETS test_embed_lib
20 | EXPORT test_export
21 | ARCHIVE DESTINATION bin
22 | LIBRARY DESTINATION lib
23 | RUNTIME DESTINATION lib)
24 | install(EXPORT test_export
25 | DESTINATION lib/cmake/test_export/test_export-Targets.cmake)
26 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.12)
2 | project(test_subdirectory_module CXX)
3 |
4 | add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11)
5 | pybind11_add_module(test_cmake_build THIN_LTO ../main.cpp)
6 |
7 | add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$
8 | ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME})
9 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0)
2 | project(test_subdirectory_target CXX)
3 |
4 | add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11)
5 |
6 | add_library(test_cmake_build MODULE ../main.cpp)
7 |
8 | target_link_libraries(test_cmake_build PRIVATE pybind11::module)
9 |
10 | # make sure result is, for example, test_installed_target.so, not libtest_installed_target.dylib
11 | set_target_properties(test_cmake_build PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
12 | SUFFIX "${PYTHON_MODULE_EXTENSION}")
13 |
14 | add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$
15 | ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME})
16 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_cmake_build/test.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import test_cmake_build
3 |
4 | assert test_cmake_build.add(1, 2) == 3
5 | print("{} imports, runs, and adds: 1 + 2 = 3".format(sys.argv[1]))
6 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_embed/catch.cpp:
--------------------------------------------------------------------------------
1 | // The Catch implementation is compiled here. This is a standalone
2 | // translation unit to avoid recompiling it for every test change.
3 |
4 | #include
5 |
6 | #ifdef _MSC_VER
7 | // Silence MSVC C++17 deprecation warning from Catch regarding std::uncaught_exceptions (up to catch
8 | // 2.0.1; this should be fixed in the next catch release after 2.0.1).
9 | # pragma warning(disable: 4996)
10 | #endif
11 |
12 | #define CATCH_CONFIG_RUNNER
13 | #include
14 |
15 | namespace py = pybind11;
16 |
17 | int main(int argc, char *argv[]) {
18 | py::scoped_interpreter guard{};
19 | auto result = Catch::Session().run(argc, argv);
20 |
21 | return result < 0xff ? result : 0xff;
22 | }
23 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_embed/external_module.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | namespace py = pybind11;
4 |
5 | /* Simple test module/test class to check that the referenced internals data of external pybind11
6 | * modules aren't preserved over a finalize/initialize.
7 | */
8 |
9 | PYBIND11_MODULE(external_module, m) {
10 | class A {
11 | public:
12 | A(int value) : v{value} {};
13 | int v;
14 | };
15 |
16 | py::class_(m, "A")
17 | .def(py::init())
18 | .def_readwrite("value", &A::v);
19 |
20 | m.def("internals_at", []() {
21 | return reinterpret_cast(&py::detail::get_internals());
22 | });
23 | }
24 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_embed/test_interpreter.py:
--------------------------------------------------------------------------------
1 | from widget_module import Widget
2 |
3 |
4 | class DerivedWidget(Widget):
5 | def __init__(self, message):
6 | super(DerivedWidget, self).__init__(message)
7 |
8 | def the_answer(self):
9 | return 42
10 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_eval.py:
--------------------------------------------------------------------------------
1 | import os
2 | from pybind11_tests import eval_ as m
3 |
4 |
5 | def test_evals(capture):
6 | with capture:
7 | assert m.test_eval_statements()
8 | assert capture == "Hello World!"
9 |
10 | assert m.test_eval()
11 | assert m.test_eval_single_statement()
12 |
13 | filename = os.path.join(os.path.dirname(__file__), "test_eval_call.py")
14 | assert m.test_eval_file(filename)
15 |
16 | assert m.test_eval_failure()
17 | assert m.test_eval_file_failure()
18 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_eval_call.py:
--------------------------------------------------------------------------------
1 | # This file is called from 'test_eval.py'
2 |
3 | if 'call_test2' in locals():
4 | call_test2(y) # noqa: F821 undefined name
5 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_tagbased_polymorphic.py:
--------------------------------------------------------------------------------
1 | from pybind11_tests import tagbased_polymorphic as m
2 |
3 |
4 | def test_downcast():
5 | zoo = m.create_zoo()
6 | assert [type(animal) for animal in zoo] == [
7 | m.Labrador, m.Dog, m.Chihuahua, m.Cat, m.Panther
8 | ]
9 | assert [animal.name for animal in zoo] == [
10 | "Fido", "Ginger", "Hertzl", "Tiger", "Leo"
11 | ]
12 | zoo[1].sound = "woooooo"
13 | assert [dog.bark() for dog in zoo[:3]] == [
14 | "Labrador Fido goes WOOF!",
15 | "Dog Ginger goes woooooo",
16 | "Chihuahua Hertzl goes iyiyiyiyiyi and runs in circles"
17 | ]
18 | assert [cat.purr() for cat in zoo[3:]] == ["mrowr", "mrrrRRRRRR"]
19 | zoo[0].excitement -= 1000
20 | assert zoo[0].excitement == 14000
21 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_union.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | tests/test_class.cpp -- test py::class_ definitions and basic functionality
3 |
4 | Copyright (c) 2019 Roland Dreier
5 |
6 | All rights reserved. Use of this source code is governed by a
7 | BSD-style license that can be found in the LICENSE file.
8 | */
9 |
10 | #include "pybind11_tests.h"
11 |
12 | TEST_SUBMODULE(union_, m) {
13 | union TestUnion {
14 | int value_int;
15 | unsigned value_uint;
16 | };
17 |
18 | py::class_(m, "TestUnion")
19 | .def(py::init<>())
20 | .def_readonly("as_int", &TestUnion::value_int)
21 | .def_readwrite("as_uint", &TestUnion::value_uint);
22 | }
23 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tests/test_union.py:
--------------------------------------------------------------------------------
1 | from pybind11_tests import union_ as m
2 |
3 |
4 | def test_union():
5 | instance = m.TestUnion()
6 |
7 | instance.as_uint = 10
8 | assert instance.as_int == 10
9 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/ubuntu/src/pybind11/tools/libsize.py:
--------------------------------------------------------------------------------
1 | from __future__ import print_function, division
2 | import os
3 | import sys
4 |
5 | # Internal build script for generating debugging test .so size.
6 | # Usage:
7 | # python libsize.py file.so save.txt -- displays the size of file.so and, if save.txt exists, compares it to the
8 | # size in it, then overwrites save.txt with the new size for future runs.
9 |
10 | if len(sys.argv) != 3:
11 | sys.exit("Invalid arguments: usage: python libsize.py file.so save.txt")
12 |
13 | lib = sys.argv[1]
14 | save = sys.argv[2]
15 |
16 | if not os.path.exists(lib):
17 | sys.exit("Error: requested file ({}) does not exist".format(lib))
18 |
19 | libsize = os.path.getsize(lib)
20 |
21 | print("------", os.path.basename(lib), "file size:", libsize, end='')
22 |
23 | if os.path.exists(save):
24 | with open(save) as sf:
25 | oldsize = int(sf.readline())
26 |
27 | if oldsize > 0:
28 | change = libsize - oldsize
29 | if change == 0:
30 | print(" (no change)")
31 | else:
32 | print(" (change of {:+} bytes = {:+.2%})".format(change, change / oldsize))
33 | else:
34 | print()
35 |
36 | with open(save, 'w') as sf:
37 | sf.write(str(libsize))
38 |
39 |
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/windows/libh264decoder/libh264decoder-0.0.1-cp36-cp36m-win_amd64.whl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/windows/libh264decoder/libh264decoder-0.0.1-cp36-cp36m-win_amd64.whl
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/windows/libh264decoder/libh264decoder-0.0.1-cp37-cp37m-win_amd64.whl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/windows/libh264decoder/libh264decoder-0.0.1-cp37-cp37m-win_amd64.whl
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/windows/libh264decoder/libh264decoder-0.0.1-cp38-cp38-win_amd64.whl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/windows/libh264decoder/libh264decoder-0.0.1-cp38-cp38-win_amd64.whl
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/windows/libh264decoder/libh264decoder-0.0.1.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/windows/libh264decoder/libh264decoder-0.0.1.tar.gz
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/windows/opus_decoder/opus_decoder-0.0.1-cp36-cp36m-win_amd64.whl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/windows/opus_decoder/opus_decoder-0.0.1-cp36-cp36m-win_amd64.whl
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/windows/opus_decoder/opus_decoder-0.0.1-cp37-cp37m-win_amd64.whl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/windows/opus_decoder/opus_decoder-0.0.1-cp37-cp37m-win_amd64.whl
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/windows/opus_decoder/opus_decoder-0.0.1-cp38-cp38-win_amd64.whl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/windows/opus_decoder/opus_decoder-0.0.1-cp38-cp38-win_amd64.whl
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/windows/opus_decoder/opus_decoder-0.0.1.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/examples/plaintext_sample_code/RoboMasterEP/stream/decoder/windows/opus_decoder/opus_decoder-0.0.1.tar.gz
--------------------------------------------------------------------------------
/examples/plaintext_sample_code/RoboMasterEP/stream/python_stream_liveview/README.md:
--------------------------------------------------------------------------------
1 | # Description:
2 |
3 | A python script that implements video and audio display, based on python3
4 |
5 | # Denpendent toolchian and library:
6 |
7 | - h264decoder
8 | - opusdecoder
9 | - python3-pyaudio, python3-numpy, opencv-python
10 |
11 | # Installation(ubuntu):
12 |
13 | 1. build in ../decoder
14 | 2. $ sudo apt-get install python3-pyaudio python3-numpy
15 | 3. $ sudo pip3 install opencv-python
16 |
17 | # Running:
18 |
19 | 1. python3 liveview.py
20 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/.gitignore:
--------------------------------------------------------------------------------
1 | output
2 | dist
3 | build
4 | libmedia_codec.egg-info
--------------------------------------------------------------------------------
/lib/libmedia_codec/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.4.1)
2 | project (robomaster_media_codec)
3 | set(CMAKE_CXX_STANDARD 11)
4 | set(CMAKE_BUILD_TYPE Release)
5 | SET(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/output)
6 |
7 | set(PYBIND11_PYTHON_VERSION 3)
8 | add_subdirectory(pybind11)
9 |
10 | pybind11_add_module(libmedia_codec src/media_codec.cpp)
11 |
12 | IF (CMAKE_SYSTEM_NAME MATCHES "Windows")
13 | SET(OPUS_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/src/opus-share/include")
14 | SET(OPUS_LIBRARIES "${CMAKE_SOURCE_DIR}/src/opus-share/lib/opus.lib")
15 | SET(FFMEPG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/src/ffmpeg-4.2.2-win64-dev/include")
16 | SET(FFMEPG_LIBRARIES_PATH "${CMAKE_SOURCE_DIR}/src/ffmpeg-4.2.2-win64-dev/lib")
17 | target_link_libraries(libmedia_codec PRIVATE
18 | ${FFMEPG_LIBRARIES_PATH}/avcodec.lib
19 | ${FFMEPG_LIBRARIES_PATH}/swscale.lib
20 | ${FFMEPG_LIBRARIES_PATH}/avutil.lib
21 | ${OPUS_LIBRARIES})
22 | target_include_directories(libmedia_codec PRIVATE
23 | ${FFMEPG_INCLUDE_DIRS}
24 | ${OPUS_INCLUDE_DIRS})
25 | ELSE ()
26 | target_link_libraries(libmedia_codec PRIVATE opus avcodec swscale avutil)
27 | ENDIF (CMAKE_SYSTEM_NAME MATCHES "Windows")
28 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include README.md LICENSE
2 | global-include CMakeLists.txt *.cmake
3 | recursive-include src *
4 | recursive-include pybind11/include *.h
5 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/cmake/FindOpus.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # - Find the opus include file and library
3 | #
4 | # OPUS_FOUND - system has opus
5 | # OPUS_INCLUDE_DIRS - the opus include directory
6 | # OPUS_LIBRARIES - The libraries needed to use opus
7 |
8 | find_path(OPUS_INCLUDE_DIRS
9 | NAMES opus/opus.h
10 | PATH_SUFFIXES include
11 | )
12 | if(OPUS_INCLUDE_DIRS)
13 | set(HAVE_OPUS_OPUS_H 1)
14 | endif()
15 |
16 | find_library(OPUS_LIBRARIES NAMES opus)
17 |
18 | if(OPUS_LIBRARIES)
19 | find_library(LIBM NAMES m)
20 | if(LIBM)
21 | list(APPEND OPUS_LIBRARIES ${LIBM})
22 | endif()
23 | endif()
24 |
25 | include(FindPackageHandleStandardArgs)
26 | find_package_handle_standard_args(Opus
27 | DEFAULT_MSG
28 | OPUS_INCLUDE_DIRS OPUS_LIBRARIES HAVE_OPUS_OPUS_H
29 | )
30 |
31 | mark_as_advanced(OPUS_INCLUDE_DIRS OPUS_LIBRARIES HAVE_OPUS_OPUS_H)
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/MANIFEST.in:
--------------------------------------------------------------------------------
1 | recursive-include include/pybind11 *.h
2 | include LICENSE README.md CONTRIBUTING.md
3 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/docs/Doxyfile:
--------------------------------------------------------------------------------
1 | PROJECT_NAME = pybind11
2 | INPUT = ../include/pybind11/
3 | RECURSIVE = YES
4 |
5 | GENERATE_HTML = NO
6 | GENERATE_LATEX = NO
7 | GENERATE_XML = YES
8 | XML_OUTPUT = .build/doxygenxml
9 | XML_PROGRAMLISTING = YES
10 |
11 | MACRO_EXPANSION = YES
12 | EXPAND_ONLY_PREDEF = YES
13 | EXPAND_AS_DEFINED = PYBIND11_RUNTIME_EXCEPTION
14 |
15 | ALIASES = "rst=\verbatim embed:rst"
16 | ALIASES += "endrst=\endverbatim"
17 |
18 | QUIET = YES
19 | WARNINGS = YES
20 | WARN_IF_UNDOCUMENTED = NO
21 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/docs/_static/theme_overrides.css:
--------------------------------------------------------------------------------
1 | .wy-table-responsive table td,
2 | .wy-table-responsive table th {
3 | white-space: initial !important;
4 | }
5 | .rst-content table.docutils td {
6 | vertical-align: top !important;
7 | }
8 | div[class^='highlight'] pre {
9 | white-space: pre;
10 | white-space: pre-wrap;
11 | }
12 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/docs/advanced/pycpp/index.rst:
--------------------------------------------------------------------------------
1 | Python C++ interface
2 | ####################
3 |
4 | pybind11 exposes Python types and functions using thin C++ wrappers, which
5 | makes it possible to conveniently call Python code from C++ without resorting
6 | to Python's C API.
7 |
8 | .. toctree::
9 | :maxdepth: 2
10 |
11 | object
12 | numpy
13 | utilities
14 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/docs/index.rst:
--------------------------------------------------------------------------------
1 | .. only: not latex
2 |
3 | .. image:: pybind11-logo.png
4 |
5 | pybind11 --- Seamless operability between C++11 and Python
6 | ==========================================================
7 |
8 | .. only: not latex
9 |
10 | Contents:
11 |
12 | .. toctree::
13 | :maxdepth: 1
14 |
15 | intro
16 | changelog
17 | upgrade
18 |
19 | .. toctree::
20 | :caption: The Basics
21 | :maxdepth: 2
22 |
23 | basics
24 | classes
25 | compiling
26 |
27 | .. toctree::
28 | :caption: Advanced Topics
29 | :maxdepth: 2
30 |
31 | advanced/functions
32 | advanced/classes
33 | advanced/exceptions
34 | advanced/smart_ptrs
35 | advanced/cast/index
36 | advanced/pycpp/index
37 | advanced/embedding
38 | advanced/misc
39 |
40 | .. toctree::
41 | :caption: Extra Information
42 | :maxdepth: 1
43 |
44 | faq
45 | benchmark
46 | limitations
47 | reference
48 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/docs/limitations.rst:
--------------------------------------------------------------------------------
1 | Limitations
2 | ###########
3 |
4 | pybind11 strives to be a general solution to binding generation, but it also has
5 | certain limitations:
6 |
7 | - pybind11 casts away ``const``-ness in function arguments and return values.
8 | This is in line with the Python language, which has no concept of ``const``
9 | values. This means that some additional care is needed to avoid bugs that
10 | would be caught by the type checker in a traditional C++ program.
11 |
12 | - The NumPy interface ``pybind11::array`` greatly simplifies accessing
13 | numerical data from C++ (and vice versa), but it's not a full-blown array
14 | class like ``Eigen::Array`` or ``boost.multi_array``.
15 |
16 | These features could be implemented but would lead to a significant increase in
17 | complexity. I've decided to draw the line here to keep this project simple and
18 | compact. Users who absolutely require these features are encouraged to fork
19 | pybind11.
20 |
21 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/docs/pybind11-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/lib/libmedia_codec/pybind11/docs/pybind11-logo.png
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/docs/pybind11_vs_boost_python1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/lib/libmedia_codec/pybind11/docs/pybind11_vs_boost_python1.png
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/docs/pybind11_vs_boost_python2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/lib/libmedia_codec/pybind11/docs/pybind11_vs_boost_python2.png
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/docs/release.rst:
--------------------------------------------------------------------------------
1 | To release a new version of pybind11:
2 |
3 | - Update the version number and push to pypi
4 | - Update ``pybind11/_version.py`` (set release version, remove 'dev').
5 | - Update ``PYBIND11_VERSION_MAJOR`` etc. in ``include/pybind11/detail/common.h``.
6 | - Ensure that all the information in ``setup.py`` is up-to-date.
7 | - Update version in ``docs/conf.py``.
8 | - Tag release date in ``docs/changelog.rst``.
9 | - ``git add`` and ``git commit``.
10 | - if new minor version: ``git checkout -b vX.Y``, ``git push -u origin vX.Y``
11 | - ``git tag -a vX.Y.Z -m 'vX.Y.Z release'``.
12 | - ``git push``
13 | - ``git push --tags``.
14 | - ``python setup.py sdist upload``.
15 | - ``python setup.py bdist_wheel upload``.
16 | - Get back to work
17 | - Update ``_version.py`` (add 'dev' and increment minor).
18 | - Update version in ``docs/conf.py``
19 | - Update version macros in ``include/pybind11/common.h``
20 | - ``git add`` and ``git commit``.
21 | ``git push``
22 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/docs/requirements.txt:
--------------------------------------------------------------------------------
1 | breathe == 4.5.0
2 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/include/pybind11/common.h:
--------------------------------------------------------------------------------
1 | #include "detail/common.h"
2 | #warning "Including 'common.h' is deprecated. It will be removed in v3.0. Use 'pybind11.h'."
3 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/pybind11/__init__.py:
--------------------------------------------------------------------------------
1 | from ._version import version_info, __version__ # noqa: F401 imported but unused
2 |
3 |
4 | def get_include(user=False):
5 | import os
6 | d = os.path.dirname(__file__)
7 | if os.path.exists(os.path.join(d, "include")):
8 | # Package is installed
9 | return os.path.join(d, "include")
10 | else:
11 | # Package is from a source directory
12 | return os.path.join(os.path.dirname(d), "include")
13 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/pybind11/__main__.py:
--------------------------------------------------------------------------------
1 | from __future__ import print_function
2 |
3 | import argparse
4 | import sys
5 | import sysconfig
6 |
7 | from . import get_include
8 |
9 |
10 | def print_includes():
11 | dirs = [sysconfig.get_path('include'),
12 | sysconfig.get_path('platinclude'),
13 | get_include()]
14 |
15 | # Make unique but preserve order
16 | unique_dirs = []
17 | for d in dirs:
18 | if d not in unique_dirs:
19 | unique_dirs.append(d)
20 |
21 | print(' '.join('-I' + d for d in unique_dirs))
22 |
23 |
24 | def main():
25 | parser = argparse.ArgumentParser(prog='python -m pybind11')
26 | parser.add_argument('--includes', action='store_true',
27 | help='Include flags for both pybind11 and Python headers.')
28 | args = parser.parse_args()
29 | if not sys.argv[1:]:
30 | parser.print_help()
31 | if args.includes:
32 | print_includes()
33 |
34 |
35 | if __name__ == '__main__':
36 | main()
37 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/pybind11/_version.py:
--------------------------------------------------------------------------------
1 | version_info = (2, 4, 'dev4')
2 | __version__ = '.'.join(map(str, version_info))
3 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/setup.cfg:
--------------------------------------------------------------------------------
1 | [bdist_wheel]
2 | universal=1
3 |
4 | [flake8]
5 | max-line-length = 99
6 | show_source = True
7 | exclude = .git, __pycache__, build, dist, docs, tools, venv
8 | ignore =
9 | # required for pretty matrix formatting: multiple spaces after `,` and `[`
10 | E201, E241, W504,
11 | # camelcase 'cPickle' imported as lowercase 'pickle'
12 | N813
13 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/pytest.ini:
--------------------------------------------------------------------------------
1 | [pytest]
2 | minversion = 3.0
3 | norecursedirs = test_cmake_build test_embed
4 | addopts =
5 | # show summary of skipped tests
6 | -rs
7 | # capture only Python print and C++ py::print, but not C output (low-level Python errors)
8 | --capture=sys
9 | filterwarnings =
10 | # make warnings into errors but ignore certain third-party extension issues
11 | error
12 | # importing scipy submodules on some version of Python
13 | ignore::ImportWarning
14 | # bogus numpy ABI warning (see numpy/#432)
15 | ignore:.*numpy.dtype size changed.*:RuntimeWarning
16 | ignore:.*numpy.ufunc size changed.*:RuntimeWarning
17 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_async.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | tests/test_async.cpp -- __await__ support
3 |
4 | Copyright (c) 2019 Google Inc.
5 |
6 | All rights reserved. Use of this source code is governed by a
7 | BSD-style license that can be found in the LICENSE file.
8 | */
9 |
10 | #include "pybind11_tests.h"
11 |
12 | TEST_SUBMODULE(async_module, m) {
13 | struct DoesNotSupportAsync {};
14 | py::class_(m, "DoesNotSupportAsync")
15 | .def(py::init<>());
16 | struct SupportsAsync {};
17 | py::class_(m, "SupportsAsync")
18 | .def(py::init<>())
19 | .def("__await__", [](const SupportsAsync& self) -> py::object {
20 | static_cast(self);
21 | py::object loop = py::module::import("asyncio.events").attr("get_event_loop")();
22 | py::object f = loop.attr("create_future")();
23 | f.attr("set_result")(5);
24 | return f.attr("__await__")();
25 | });
26 | }
27 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_async.py:
--------------------------------------------------------------------------------
1 | import asyncio
2 | import pytest
3 | from pybind11_tests import async_module as m
4 |
5 |
6 | @pytest.fixture
7 | def event_loop():
8 | loop = asyncio.new_event_loop()
9 | yield loop
10 | loop.close()
11 |
12 |
13 | async def get_await_result(x):
14 | return await x
15 |
16 |
17 | def test_await(event_loop):
18 | assert 5 == event_loop.run_until_complete(get_await_result(m.SupportsAsync()))
19 |
20 |
21 | def test_await_missing(event_loop):
22 | with pytest.raises(TypeError):
23 | event_loop.run_until_complete(get_await_result(m.DoesNotSupportAsync()))
24 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_cmake_build/embed.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | namespace py = pybind11;
3 |
4 | PYBIND11_EMBEDDED_MODULE(test_cmake_build, m) {
5 | m.def("add", [](int i, int j) { return i + j; });
6 | }
7 |
8 | int main(int argc, char *argv[]) {
9 | if (argc != 2)
10 | throw std::runtime_error("Expected test.py file as the first argument");
11 | auto test_py_file = argv[1];
12 |
13 | py::scoped_interpreter guard{};
14 |
15 | auto m = py::module::import("test_cmake_build");
16 | if (m.attr("add")(1, 2).cast() != 3)
17 | throw std::runtime_error("embed.cpp failed");
18 |
19 | py::module::import("sys").attr("argv") = py::make_tuple("test.py", "embed.cpp");
20 | py::eval_file(test_py_file, py::globals());
21 | }
22 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0)
2 | project(test_installed_embed CXX)
3 |
4 | set(CMAKE_MODULE_PATH "")
5 | find_package(pybind11 CONFIG REQUIRED)
6 | message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}")
7 |
8 | add_executable(test_cmake_build ../embed.cpp)
9 | target_link_libraries(test_cmake_build PRIVATE pybind11::embed)
10 |
11 | # Do not treat includes from IMPORTED target as SYSTEM (Python headers in pybind11::embed).
12 | # This may be needed to resolve header conflicts, e.g. between Python release and debug headers.
13 | set_target_properties(test_cmake_build PROPERTIES NO_SYSTEM_FROM_IMPORTED ON)
14 |
15 | add_custom_target(check $ ${PROJECT_SOURCE_DIR}/../test.py)
16 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.12)
2 | project(test_installed_module CXX)
3 |
4 | set(CMAKE_MODULE_PATH "")
5 |
6 | find_package(pybind11 CONFIG REQUIRED)
7 | message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}")
8 |
9 | pybind11_add_module(test_cmake_build SHARED NO_EXTRAS ../main.cpp)
10 |
11 | add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$
12 | ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME})
13 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0)
2 | project(test_installed_target CXX)
3 |
4 | set(CMAKE_MODULE_PATH "")
5 |
6 | find_package(pybind11 CONFIG REQUIRED)
7 | message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}")
8 |
9 | add_library(test_cmake_build MODULE ../main.cpp)
10 |
11 | target_link_libraries(test_cmake_build PRIVATE pybind11::module)
12 |
13 | # make sure result is, for example, test_installed_target.so, not libtest_installed_target.dylib
14 | set_target_properties(test_cmake_build PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
15 | SUFFIX "${PYTHON_MODULE_EXTENSION}")
16 |
17 | # Do not treat includes from IMPORTED target as SYSTEM (Python headers in pybind11::module).
18 | # This may be needed to resolve header conflicts, e.g. between Python release and debug headers.
19 | set_target_properties(test_cmake_build PROPERTIES NO_SYSTEM_FROM_IMPORTED ON)
20 |
21 | add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$
22 | ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME})
23 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_cmake_build/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | namespace py = pybind11;
3 |
4 | PYBIND11_MODULE(test_cmake_build, m) {
5 | m.def("add", [](int i, int j) { return i + j; });
6 | }
7 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0)
2 | project(test_subdirectory_embed CXX)
3 |
4 | set(PYBIND11_INSTALL ON CACHE BOOL "")
5 | set(PYBIND11_EXPORT_NAME test_export)
6 |
7 | add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11)
8 |
9 | # Test basic target functionality
10 | add_executable(test_cmake_build ../embed.cpp)
11 | target_link_libraries(test_cmake_build PRIVATE pybind11::embed)
12 |
13 | add_custom_target(check $ ${PROJECT_SOURCE_DIR}/../test.py)
14 |
15 | # Test custom export group -- PYBIND11_EXPORT_NAME
16 | add_library(test_embed_lib ../embed.cpp)
17 | target_link_libraries(test_embed_lib PRIVATE pybind11::embed)
18 |
19 | install(TARGETS test_embed_lib
20 | EXPORT test_export
21 | ARCHIVE DESTINATION bin
22 | LIBRARY DESTINATION lib
23 | RUNTIME DESTINATION lib)
24 | install(EXPORT test_export
25 | DESTINATION lib/cmake/test_export/test_export-Targets.cmake)
26 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.12)
2 | project(test_subdirectory_module CXX)
3 |
4 | add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11)
5 | pybind11_add_module(test_cmake_build THIN_LTO ../main.cpp)
6 |
7 | add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$
8 | ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME})
9 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0)
2 | project(test_subdirectory_target CXX)
3 |
4 | add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11)
5 |
6 | add_library(test_cmake_build MODULE ../main.cpp)
7 |
8 | target_link_libraries(test_cmake_build PRIVATE pybind11::module)
9 |
10 | # make sure result is, for example, test_installed_target.so, not libtest_installed_target.dylib
11 | set_target_properties(test_cmake_build PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
12 | SUFFIX "${PYTHON_MODULE_EXTENSION}")
13 |
14 | add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$
15 | ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME})
16 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_cmake_build/test.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import test_cmake_build
3 |
4 | assert test_cmake_build.add(1, 2) == 3
5 | print("{} imports, runs, and adds: 1 + 2 = 3".format(sys.argv[1]))
6 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_embed/catch.cpp:
--------------------------------------------------------------------------------
1 | // The Catch implementation is compiled here. This is a standalone
2 | // translation unit to avoid recompiling it for every test change.
3 |
4 | #include
5 |
6 | #ifdef _MSC_VER
7 | // Silence MSVC C++17 deprecation warning from Catch regarding std::uncaught_exceptions (up to catch
8 | // 2.0.1; this should be fixed in the next catch release after 2.0.1).
9 | # pragma warning(disable: 4996)
10 | #endif
11 |
12 | #define CATCH_CONFIG_RUNNER
13 | #include
14 |
15 | namespace py = pybind11;
16 |
17 | int main(int argc, char *argv[]) {
18 | py::scoped_interpreter guard{};
19 | auto result = Catch::Session().run(argc, argv);
20 |
21 | return result < 0xff ? result : 0xff;
22 | }
23 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_embed/external_module.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | namespace py = pybind11;
4 |
5 | /* Simple test module/test class to check that the referenced internals data of external pybind11
6 | * modules aren't preserved over a finalize/initialize.
7 | */
8 |
9 | PYBIND11_MODULE(external_module, m) {
10 | class A {
11 | public:
12 | A(int value) : v{value} {};
13 | int v;
14 | };
15 |
16 | py::class_(m, "A")
17 | .def(py::init())
18 | .def_readwrite("value", &A::v);
19 |
20 | m.def("internals_at", []() {
21 | return reinterpret_cast(&py::detail::get_internals());
22 | });
23 | }
24 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_embed/test_interpreter.py:
--------------------------------------------------------------------------------
1 | from widget_module import Widget
2 |
3 |
4 | class DerivedWidget(Widget):
5 | def __init__(self, message):
6 | super(DerivedWidget, self).__init__(message)
7 |
8 | def the_answer(self):
9 | return 42
10 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_eval.py:
--------------------------------------------------------------------------------
1 | import os
2 | from pybind11_tests import eval_ as m
3 |
4 |
5 | def test_evals(capture):
6 | with capture:
7 | assert m.test_eval_statements()
8 | assert capture == "Hello World!"
9 |
10 | assert m.test_eval()
11 | assert m.test_eval_single_statement()
12 |
13 | filename = os.path.join(os.path.dirname(__file__), "test_eval_call.py")
14 | assert m.test_eval_file(filename)
15 |
16 | assert m.test_eval_failure()
17 | assert m.test_eval_file_failure()
18 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_eval_call.py:
--------------------------------------------------------------------------------
1 | # This file is called from 'test_eval.py'
2 |
3 | if 'call_test2' in locals():
4 | call_test2(y) # noqa: F821 undefined name
5 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_pickling.py:
--------------------------------------------------------------------------------
1 | import pytest
2 | from pybind11_tests import pickling as m
3 |
4 | try:
5 | import cPickle as pickle # Use cPickle on Python 2.7
6 | except ImportError:
7 | import pickle
8 |
9 |
10 | @pytest.mark.parametrize("cls_name", ["Pickleable", "PickleableNew"])
11 | def test_roundtrip(cls_name):
12 | cls = getattr(m, cls_name)
13 | p = cls("test_value")
14 | p.setExtra1(15)
15 | p.setExtra2(48)
16 |
17 | data = pickle.dumps(p, 2) # Must use pickle protocol >= 2
18 | p2 = pickle.loads(data)
19 | assert p2.value() == p.value()
20 | assert p2.extra1() == p.extra1()
21 | assert p2.extra2() == p.extra2()
22 |
23 |
24 | @pytest.unsupported_on_pypy
25 | @pytest.mark.parametrize("cls_name", ["PickleableWithDict", "PickleableWithDictNew"])
26 | def test_roundtrip_with_dict(cls_name):
27 | cls = getattr(m, cls_name)
28 | p = cls("test_value")
29 | p.extra = 15
30 | p.dynamic = "Attribute"
31 |
32 | data = pickle.dumps(p, pickle.HIGHEST_PROTOCOL)
33 | p2 = pickle.loads(data)
34 | assert p2.value == p.value
35 | assert p2.extra == p.extra
36 | assert p2.dynamic == p.dynamic
37 |
38 |
39 | def test_enum_pickle():
40 | from pybind11_tests import enums as e
41 | data = pickle.dumps(e.EOne, 2)
42 | assert e.EOne == pickle.loads(data)
43 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_tagbased_polymorphic.py:
--------------------------------------------------------------------------------
1 | from pybind11_tests import tagbased_polymorphic as m
2 |
3 |
4 | def test_downcast():
5 | zoo = m.create_zoo()
6 | assert [type(animal) for animal in zoo] == [
7 | m.Labrador, m.Dog, m.Chihuahua, m.Cat, m.Panther
8 | ]
9 | assert [animal.name for animal in zoo] == [
10 | "Fido", "Ginger", "Hertzl", "Tiger", "Leo"
11 | ]
12 | zoo[1].sound = "woooooo"
13 | assert [dog.bark() for dog in zoo[:3]] == [
14 | "Labrador Fido goes WOOF!",
15 | "Dog Ginger goes woooooo",
16 | "Chihuahua Hertzl goes iyiyiyiyiyi and runs in circles"
17 | ]
18 | assert [cat.purr() for cat in zoo[3:]] == ["mrowr", "mrrrRRRRRR"]
19 | zoo[0].excitement -= 1000
20 | assert zoo[0].excitement == 14000
21 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_union.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | tests/test_class.cpp -- test py::class_ definitions and basic functionality
3 |
4 | Copyright (c) 2019 Roland Dreier
5 |
6 | All rights reserved. Use of this source code is governed by a
7 | BSD-style license that can be found in the LICENSE file.
8 | */
9 |
10 | #include "pybind11_tests.h"
11 |
12 | TEST_SUBMODULE(union_, m) {
13 | union TestUnion {
14 | int value_int;
15 | unsigned value_uint;
16 | };
17 |
18 | py::class_(m, "TestUnion")
19 | .def(py::init<>())
20 | .def_readonly("as_int", &TestUnion::value_int)
21 | .def_readwrite("as_uint", &TestUnion::value_uint);
22 | }
23 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tests/test_union.py:
--------------------------------------------------------------------------------
1 | from pybind11_tests import union_ as m
2 |
3 |
4 | def test_union():
5 | instance = m.TestUnion()
6 |
7 | instance.as_uint = 10
8 | assert instance.as_int == 10
9 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pybind11/tools/libsize.py:
--------------------------------------------------------------------------------
1 | from __future__ import print_function, division
2 | import os
3 | import sys
4 |
5 | # Internal build script for generating debugging test .so size.
6 | # Usage:
7 | # python libsize.py file.so save.txt -- displays the size of file.so and, if save.txt exists, compares it to the
8 | # size in it, then overwrites save.txt with the new size for future runs.
9 |
10 | if len(sys.argv) != 3:
11 | sys.exit("Invalid arguments: usage: python libsize.py file.so save.txt")
12 |
13 | lib = sys.argv[1]
14 | save = sys.argv[2]
15 |
16 | if not os.path.exists(lib):
17 | sys.exit("Error: requested file ({}) does not exist".format(lib))
18 |
19 | libsize = os.path.getsize(lib)
20 |
21 | print("------", os.path.basename(lib), "file size:", libsize, end='')
22 |
23 | if os.path.exists(save):
24 | with open(save) as sf:
25 | oldsize = int(sf.readline())
26 |
27 | if oldsize > 0:
28 | change = libsize - oldsize
29 | if change == 0:
30 | print(" (no change)")
31 | else:
32 | print(" (change of {:+} bytes = {:+.2%})".format(change, change / oldsize))
33 | else:
34 | print()
35 |
36 | with open(save, 'w') as sf:
37 | sf.write(str(libsize))
38 |
39 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/pyproject.toml:
--------------------------------------------------------------------------------
1 | [build-system]
2 | requires = ["setuptools", "wheel", "cmake>=3.1.0", "pybind11"]
3 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/script/build.bat:
--------------------------------------------------------------------------------
1 | cd %~dp0/..
2 | del /s /q build
3 | del /s /q dist
4 | del /s /q output
5 | del /s /q robomaster_media_decoder.egg-info
6 | rmdir /s /q build
7 | rmdir /s /q dist
8 | rmdir /s /q output
9 | rmdir /s /q robomaster_media_decoder.egg-info
10 | python setup.py build
11 | python setup.py bdist_wheel
12 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/script/build.sh:
--------------------------------------------------------------------------------
1 | basepath=$(cd `dirname $0`; pwd)
2 | cd $basepath
3 | cd ..
4 | rm -rf build dist output robomaster_media_decoder.egg-info
5 |
6 | /opt/python/cp36-cp36m/bin/python setup.py build
7 | /opt/python/cp36-cp36m/bin/python setup.py bdist_wheel
8 | /opt/python/cp36-cp36m/bin/auditwheel repair ./dist/`ls ./dist |grep cp36-cp36m`
9 |
10 | rm -rf build dist output robomaster_media_decoder.egg-info
11 | /opt/python/cp37-cp37m/bin/python setup.py build
12 | /opt/python/cp37-cp37m/bin/python setup.py bdist_wheel
13 | /opt/python/cp37-cp37m/bin/auditwheel repair ./dist/`ls ./dist |grep cp37-cp37m`
14 |
15 | rm -rf build dist output robomaster_media_decoder.egg-info
16 | /opt/python/cp38-cp38/bin/python setup.py build
17 | /opt/python/cp38-cp38/bin/python setup.py bdist_wheel
18 | /opt/python/cp38-cp38/bin/auditwheel repair ./dist/`ls ./dist |grep cp38-cp38`
19 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/examples/README:
--------------------------------------------------------------------------------
1 | FFmpeg examples README
2 | ----------------------
3 |
4 | Both following use cases rely on pkg-config and make, thus make sure
5 | that you have them installed and working on your system.
6 |
7 |
8 | Method 1: build the installed examples in a generic read/write user directory
9 |
10 | Copy to a read/write user directory and just use "make", it will link
11 | to the libraries on your system, assuming the PKG_CONFIG_PATH is
12 | correctly configured.
13 |
14 | Method 2: build the examples in-tree
15 |
16 | Assuming you are in the source FFmpeg checkout directory, you need to build
17 | FFmpeg (no need to make install in any prefix). Then just run "make examples".
18 | This will build the examples using the FFmpeg build system. You can clean those
19 | examples using "make examplesclean"
20 |
21 | If you want to try the dedicated Makefile examples (to emulate the first
22 | method), go into doc/examples and run a command such as
23 | PKG_CONFIG_PATH=pc-uninstalled make.
24 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/include/libavutil/avconfig.h:
--------------------------------------------------------------------------------
1 | /* Generated by ffmpeg configure */
2 | #ifndef AVUTIL_AVCONFIG_H
3 | #define AVUTIL_AVCONFIG_H
4 | #define AV_HAVE_BIGENDIAN 0
5 | #define AV_HAVE_FAST_UNALIGNED 1
6 | #endif /* AVUTIL_AVCONFIG_H */
7 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/include/libavutil/ffversion.h:
--------------------------------------------------------------------------------
1 | /* Automatically generated by version.sh, do not manually edit! */
2 | #ifndef AVUTIL_FFVERSION_H
3 | #define AVUTIL_FFVERSION_H
4 | #define FFMPEG_VERSION "4.2.2"
5 | #endif /* AVUTIL_FFVERSION_H */
6 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/lib/avdevice-58.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | av_device_capabilities
3 | av_device_ffversion
4 | av_input_audio_device_next
5 | av_input_video_device_next
6 | av_output_audio_device_next
7 | av_output_video_device_next
8 | avdevice_app_to_dev_control_message
9 | avdevice_capabilities_create
10 | avdevice_capabilities_free
11 | avdevice_configuration
12 | avdevice_dev_to_app_control_message
13 | avdevice_free_list_devices
14 | avdevice_license
15 | avdevice_list_devices
16 | avdevice_list_input_sources
17 | avdevice_list_output_sinks
18 | avdevice_register_all
19 | avdevice_version
20 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/lib/libavcodec.dll.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/lib/libavcodec.dll.a
--------------------------------------------------------------------------------
/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/lib/libavdevice.dll.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/lib/libavdevice.dll.a
--------------------------------------------------------------------------------
/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/lib/libavfilter.dll.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/lib/libavfilter.dll.a
--------------------------------------------------------------------------------
/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/lib/libavformat.dll.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/lib/libavformat.dll.a
--------------------------------------------------------------------------------
/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/lib/libavutil.dll.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/lib/libavutil.dll.a
--------------------------------------------------------------------------------
/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/lib/libswresample.dll.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/lib/libswresample.dll.a
--------------------------------------------------------------------------------
/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/lib/libswscale.dll.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/lib/libswscale.dll.a
--------------------------------------------------------------------------------
/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/lib/swresample-3.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | swr_alloc
3 | swr_alloc_set_opts
4 | swr_build_matrix
5 | swr_close
6 | swr_config_frame
7 | swr_convert
8 | swr_convert_frame
9 | swr_drop_output
10 | swr_ffversion
11 | swr_free
12 | swr_get_class
13 | swr_get_delay
14 | swr_get_out_samples
15 | swr_init
16 | swr_inject_silence
17 | swr_is_initialized
18 | swr_next_pts
19 | swr_set_channel_mapping
20 | swr_set_compensation
21 | swr_set_matrix
22 | swresample_configuration
23 | swresample_license
24 | swresample_version
25 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/src/ffmpeg-4.2.2-win64-dev/lib/swscale-5.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | sws_addVec
3 | sws_allocVec
4 | sws_alloc_context
5 | sws_alloc_set_opts
6 | sws_cloneVec
7 | sws_convVec
8 | sws_convertPalette8ToPacked24
9 | sws_convertPalette8ToPacked32
10 | sws_freeContext
11 | sws_freeFilter
12 | sws_freeVec
13 | sws_getCachedContext
14 | sws_getCoefficients
15 | sws_getColorspaceDetails
16 | sws_getConstVec
17 | sws_getContext
18 | sws_getDefaultFilter
19 | sws_getGaussianVec
20 | sws_getIdentityVec
21 | sws_get_class
22 | sws_init_context
23 | sws_isSupportedEndiannessConversion
24 | sws_isSupportedInput
25 | sws_isSupportedOutput
26 | sws_normalizeVec
27 | sws_printVec2
28 | sws_scale
29 | sws_scaleVec
30 | sws_setColorspaceDetails
31 | sws_shiftVec
32 | sws_subVec
33 | swscale_configuration
34 | swscale_license
35 | swscale_version
36 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/src/media_codec.cpp:
--------------------------------------------------------------------------------
1 | #include "media_codec.h"
2 | #include
3 |
4 | namespace py = pybind11;
5 | PYBIND11_MODULE(libmedia_codec, m) {
6 | m.doc()="RoboMaster Media Codec library for H264 and Opus stream using pybind11";
7 | #ifdef VERSION_INFO
8 | m.attr("__version__") = VERSION_INFO;
9 | #else
10 | m.attr("__version__") = "dev";
11 | #endif
12 |
13 | py::class_ ad(m, "OpusDecoder");
14 | ad.doc() = "Class for Opus Decoder";
15 | ad.def(py::init(),py::arg("frame_size") = 960,
16 | py::arg("sample_rate") = 48000, py::arg("channels") = 1);
17 | ad.def("decode", &PyOpusDecoder::decode, "Opus decode function",py::arg("input"));
18 |
19 | py::class_ vd(m,"H264Decoder");
20 | vd.doc() = "Class for H264 Decoder";
21 | vd.def(py::init(), py::arg("output_format") = "BGR", py::arg("verbose") = true);
22 | vd.def("decode", &PyH264Decoder::decode, "H264 decode function",py::arg("input"));
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/src/opus-share/lib/opus.dll.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/lib/libmedia_codec/src/opus-share/lib/opus.exp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/lib/libmedia_codec/src/opus-share/lib/opus.exp
--------------------------------------------------------------------------------
/lib_install.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | echo install robomaster...
3 | pip install robomaster
4 | echo install netaddr...
5 | pip install netaddr
6 | echo install netifaces...
7 | pip install netifaces
8 | echo install myqr...
9 | pip install myqr
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | #
2 | ####### example-requirements.txt #######
3 | #
4 | ###### Requirements without Version Specifiers ######
5 | robomaster
6 | #
7 | ###### Requirements with Version Specifiers ######
8 | # See https://www.python.org/dev/peps/pep-0440/#version-specifiers
9 | numpy >= 1.18
10 | opencv-python >= 4.2
11 | netaddr >= 0.8
12 | netifaces >= 0.10
13 | #
14 | ###### Refer to other requirements files ######
15 | #-r other-requirements.txt
16 | #
17 | #
18 | ###### A particular file ######
19 | #./downloads/numpy-1.9.2-cp34-none-win32.whl
20 | #http://wxpython.org/Phoenix/snapshot-builds/wxPython_Phoenix-3.0.3.dev1820+49a8884-cp34-none-win_amd64.whl
21 | #
22 | ###### Additional Requirements without Version Specifiers ######
23 | # Same as 1st section, just here to show that you can put things in any order.
24 | #
25 |
--------------------------------------------------------------------------------
/sdk install on Raspberry Pi.7z:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/sdk install on Raspberry Pi.7z
--------------------------------------------------------------------------------
/src/multi_robomaster/__init__.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import time
3 |
4 | if sys.version_info < (3, 6, 5):
5 | sys.exit('RoboMaster Sdk requires Python 3.6.5 or later')
6 |
7 | import logging
8 |
9 | logger_name = "multi_robot"
10 | logger = logging.getLogger(logger_name)
11 | logger.setLevel(logging.ERROR)
12 | fmt = "%(asctime)-15s %(levelname)s %(filename)s:%(lineno)d %(message)s"
13 | formatter = logging.Formatter(fmt)
14 | sh = logging.StreamHandler()
15 | sh.setFormatter(formatter)
16 | logger.addHandler(sh)
17 |
18 |
19 | def enable_logging_to_file():
20 | logger.setLevel(logging.INFO)
21 | filename = "RoboMasterSDK_MultiRobot_{0}_log.txt".format(time.strftime("%Y%m%d%H%M%S", time.localtime()))
22 | fh = logging.FileHandler(filename)
23 | fh.setFormatter(formatter)
24 | logger.addHandler(fh)
25 |
26 |
27 | __all__ = ['multi_robot', 'multi_group', 'multi_module', 'tool']
28 |
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/__init__.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/__init__.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/action.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/action.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/ai.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/ai.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/ai_module.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/ai_module.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/algo.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/algo.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/armor.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/armor.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/battery.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/battery.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/blaster.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/blaster.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/camera.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/camera.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/chassis.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/chassis.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/client.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/client.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/config.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/config.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/conn.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/conn.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/dds.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/dds.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/event.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/event.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/exceptions.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/exceptions.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/flight.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/flight.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/gimbal.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/gimbal.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/gripper.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/gripper.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/led.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/led.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/media.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/media.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/module.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/module.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/protocol.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/protocol.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/robot.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/robot.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/robotic_arm.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/robotic_arm.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/sensor.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/sensor.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/servo.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/servo.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/uart.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/uart.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/util.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/util.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/version.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/version.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/__pycache__/vision.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/src/robomaster/__pycache__/vision.cpython-37.pyc
--------------------------------------------------------------------------------
/src/robomaster/exceptions.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | __all__ = ['TimeOutError']
18 |
19 |
20 | class SDKException(Exception):
21 | """Base class of all SDK exceptions."""
22 |
23 |
24 | class TimeOutError(SDKException):
25 | """Remote Call Timeout."""
26 |
27 |
28 | class OutOfRangeError(SDKException):
29 | """Params Values OutOfRange."""
30 |
31 |
32 | class ConnectionError(SDKException):
33 | """Connection TimeOut."""
34 |
--------------------------------------------------------------------------------
/src/robomaster/version.py:
--------------------------------------------------------------------------------
1 | # -*-coding:utf-8-*-
2 | # Copyright (c) 2020 DJI.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License in the file LICENSE.txt or at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 |
17 | SDK_VERSION_MAJOR = 0
18 | SDK_VERSION_MINOR = 1
19 | SDK_VERSION_REVISION = 1
20 | SDK_VERSION_BUILD = 68
21 |
22 | __version__ = "{0:d}.{1:d}.{2:d}.{3:d}".format(SDK_VERSION_MAJOR, SDK_VERSION_MINOR,
23 | SDK_VERSION_REVISION, SDK_VERSION_BUILD)
24 |
--------------------------------------------------------------------------------
/visualcppbuildtools_full.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dji-sdk/RoboMaster-SDK/ff6646e115ab125af3207a4ed3df42cc76c795b2/visualcppbuildtools_full.exe
--------------------------------------------------------------------------------