├── loop_closure_detection_simulation ├── build │ ├── CMakeFiles │ │ ├── progress.marks │ │ ├── cmake.check_cache │ │ ├── slam_test.dir │ │ │ ├── progress.make │ │ │ ├── slam_test.cpp.o │ │ │ ├── src │ │ │ │ └── laserSimulation.cpp.o │ │ │ ├── cmake_clean.cmake │ │ │ ├── flags.make │ │ │ ├── link.txt │ │ │ └── DependInfo.cmake │ │ ├── 3.19.6 │ │ │ ├── CompilerIdC │ │ │ │ └── a.out │ │ │ ├── CompilerIdCXX │ │ │ │ └── a.out │ │ │ ├── CMakeDetermineCompilerABI_C.bin │ │ │ ├── CMakeDetermineCompilerABI_CXX.bin │ │ │ └── CMakeSystem.cmake │ │ ├── TargetDirectories.txt │ │ └── CMakeDirectoryInformation.cmake │ ├── slam_test │ └── cmake_install.cmake ├── .slam_test.cpp.swn ├── .slam_test.cpp.swo ├── include │ ├── .slam_process.h.swp │ ├── .dataContainer.h.swp │ ├── .laserSimulation.h.swo │ ├── .laserSimulation.h.swp │ ├── .target_planner.h.swo │ ├── .target_planner.h.swp │ ├── .pose_graph_optimize.h.swo │ ├── .pose_graph_optimize.h.swp │ ├── laserSimulation.h │ ├── obstacles.h │ ├── kdtree_obstacles_eigen_adaptor.h │ ├── apf_process.h │ ├── pid.h │ ├── kdtree_vector_eigen_adaptor.h │ ├── pid_tracking.h │ └── data_container.h └── CMakeLists.txt ├── jpeg_stream ├── 0.jpg ├── include │ ├── .fuse_hidden0037985400000300 │ ├── IEvent.h │ ├── EpollEvent.h │ ├── image_utils.h │ └── image_stream.h ├── CMakeLists.txt ├── main.cpp_cpy ├── src │ ├── image_utils.cpp │ └── EpollEvent.cpp ├── main.cpp_cpy2 └── main.cpp_cpy3 ├── time_synchronize ├── test └── main.cpp ├── apf_planner ├── .main.cpp.swp ├── main.cpp ├── include │ ├── obstacles.h │ ├── utils.h │ └── data_container.h └── CMakeLists.txt ├── dnn_body_detect ├── lib │ └── libdnn_node.so ├── model │ └── multitask_body_head_face_hand_kps_960x544.hbm ├── src │ ├── main.cpp_cpy2 │ └── main.cpp ├── CMakeLists.txt └── include │ ├── dnn_node │ └── util │ │ └── output_parser │ │ ├── detection │ │ ├── ptq_ssd_output_parser.h │ │ ├── nms.h │ │ ├── fcos_output_parser.h │ │ ├── ptq_yolo3_darknet_output_parser.h │ │ ├── ptq_yolo2_output_parser.h │ │ ├── ptq_yolo5_output_parser.h │ │ └── ptq_efficientdet_output_parser.h │ │ ├── classification │ │ └── ptq_classification_output_parser.h │ │ └── segmentation │ │ └── ptq_unet_output_parser.h │ └── image_utils.h ├── global_planner ├── include │ ├── .apf.h.swp │ ├── utils.h │ └── data_container.h ├── main.cpp └── CMakeLists.txt ├── rtmp_stream ├── include │ ├── sps_decode.h │ ├── librtmp_send264.h │ └── image_utils.h ├── src │ ├── librtmp_send264.cpp │ └── image_utils.cpp ├── test_data │ └── cuc_ieschool.h264 ├── main.cpp_cpy └── CMakeLists.txt ├── robot_slam ├── lib │ └── libcspclidar_driver.a ├── include │ ├── lidar │ │ └── lidar_include │ │ │ ├── utils.h │ │ │ └── timer.h │ ├── common │ │ ├── IEvent.h │ │ ├── EpollEvent.h │ │ └── utils.h │ ├── odom │ │ └── visualize.h │ └── slam │ │ └── data_container.h ├── CMakeLists.txt └── src │ └── EpollEvent.cpp ├── slam_simu ├── include │ ├── .dataContainer.h.swp │ ├── laserSimulation.h │ └── dataContainer.h └── CMakeLists.txt ├── m1c1_lidar_test ├── lib │ └── libcspclidar_driver.a ├── include │ ├── lidar_include │ │ ├── utils.h │ │ └── timer.h │ └── data_container.h ├── REDME.md └── CMakeLists.txt ├── navigation_global_path_planning_simulation ├── .slam_test.cpp.swn ├── .slam_test.cpp.swo ├── include │ ├── .dataContainer.h.swp │ ├── .slam_process.h.swp │ ├── laserSimulation.h │ ├── obstacles.h │ ├── kdtree_obstacles_eigen_adaptor.h │ ├── apf_process.h │ ├── pid.h │ ├── pid_tracking.h │ └── data_container.h └── CMakeLists.txt ├── navigation_local_path_planning_simulation ├── .slam_test.cpp.swn ├── .slam_test.cpp.swo ├── include │ ├── .slam_process.h.swp │ ├── .dataContainer.h.swp │ ├── .target_planner.h.swo │ ├── .target_planner.h.swp │ ├── laserSimulation.h │ ├── obstacles.h │ ├── kdtree_obstacles_eigen_adaptor.h │ ├── apf_process.h │ ├── pid.h │ ├── pid_tracking.h │ └── data_container.h └── CMakeLists.txt ├── robot_navigation_global_path_planing ├── lib │ └── libcspclidar_driver.a ├── include │ ├── common │ │ ├── .time_synchronize.h.swp │ │ ├── IEvent.h │ │ ├── EpollEvent.h │ │ └── kdtree_obstacles_eigen_adaptor.h │ ├── lidar │ │ └── lidar_include │ │ │ ├── utils.h │ │ │ └── timer.h │ ├── path_planner │ │ ├── obstacles.h │ │ └── apf_process.h │ ├── odom │ │ └── visualize.h │ └── slam │ │ └── data_container.h ├── src │ └── EpollEvent.cpp └── CMakeLists.txt ├── robot_navigation_local_path_planning ├── lib │ └── libcspclidar_driver.a ├── include │ ├── lidar │ │ └── lidar_include │ │ │ ├── utils.h │ │ │ └── timer.h │ ├── common │ │ ├── IEvent.h │ │ ├── EpollEvent.h │ │ └── kdtree_obstacles_eigen_adaptor.h │ ├── path_planner │ │ ├── obstacles.h │ │ └── apf_process.h │ ├── odom │ │ └── visualize.h │ └── slam │ │ └── data_container.h ├── src │ └── EpollEvent.cpp └── CMakeLists.txt ├── M1C1_Lidar ├── README.md ├── src │ ├── impl │ │ ├── windows │ │ │ ├── win.h │ │ │ └── win_timer.cpp │ │ └── unix │ │ │ ├── unix.h │ │ │ └── unix_timer.cpp │ └── common.h ├── include │ ├── utils.h │ └── timer.h ├── samples │ └── CMakeLists.txt └── CMakeLists.txt ├── bottom_control_board └── motor_pid_velocity_control │ ├── uart.cpp │ ├── battery.h │ ├── dht11.h │ ├── ultrasonic.h │ ├── uart.h │ ├── battery.cpp │ ├── dht11.cpp │ ├── wifi.h │ ├── server.h │ ├── ultrasonic.cpp │ ├── imu.h │ ├── pid.h │ ├── wifi.cpp │ ├── imu.cpp │ ├── pid.cpp │ ├── server.cpp │ ├── motor_pid_velocity_control.ino │ └── motor.h ├── odometry ├── include │ ├── IEvent.h │ ├── EpollEvent.h │ └── visualize.h ├── CMakeLists.txt └── src │ └── EpollEvent.cpp ├── tele_control ├── include │ ├── IEvent.h │ ├── EpollEvent.h │ └── visualize.h ├── CMakeLists.txt └── src │ └── EpollEvent.cpp ├── uart_test └── main.cpp ├── icp_test ├── include │ ├── laserSimulation.h │ └── data_container.h └── CMakeLists.txt ├── 2d_cluster_test ├── CMakeLists.txt └── include │ ├── utils.h │ └── data_container.h └── README.md /loop_closure_detection_simulation/build/CMakeFiles/progress.marks: -------------------------------------------------------------------------------- 1 | 3 2 | -------------------------------------------------------------------------------- /jpeg_stream/0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/jpeg_stream/0.jpg -------------------------------------------------------------------------------- /time_synchronize/test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/time_synchronize/test -------------------------------------------------------------------------------- /apf_planner/.main.cpp.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/apf_planner/.main.cpp.swp -------------------------------------------------------------------------------- /dnn_body_detect/lib/libdnn_node.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/dnn_body_detect/lib/libdnn_node.so -------------------------------------------------------------------------------- /global_planner/include/.apf.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/global_planner/include/.apf.h.swp -------------------------------------------------------------------------------- /rtmp_stream/include/sps_decode.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/rtmp_stream/include/sps_decode.h -------------------------------------------------------------------------------- /robot_slam/lib/libcspclidar_driver.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/robot_slam/lib/libcspclidar_driver.a -------------------------------------------------------------------------------- /rtmp_stream/src/librtmp_send264.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/rtmp_stream/src/librtmp_send264.cpp -------------------------------------------------------------------------------- /rtmp_stream/include/librtmp_send264.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/rtmp_stream/include/librtmp_send264.h -------------------------------------------------------------------------------- /rtmp_stream/test_data/cuc_ieschool.h264: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/rtmp_stream/test_data/cuc_ieschool.h264 -------------------------------------------------------------------------------- /slam_simu/include/.dataContainer.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/slam_simu/include/.dataContainer.h.swp -------------------------------------------------------------------------------- /m1c1_lidar_test/lib/libcspclidar_driver.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/m1c1_lidar_test/lib/libcspclidar_driver.a -------------------------------------------------------------------------------- /jpeg_stream/include/.fuse_hidden0037985400000300: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/jpeg_stream/include/.fuse_hidden0037985400000300 -------------------------------------------------------------------------------- /loop_closure_detection_simulation/build/CMakeFiles/cmake.check_cache: -------------------------------------------------------------------------------- 1 | # This file is generated by cmake for dependency checking of the CMakeCache.txt file 2 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/build/CMakeFiles/slam_test.dir/progress.make: -------------------------------------------------------------------------------- 1 | CMAKE_PROGRESS_1 = 1 2 | CMAKE_PROGRESS_2 = 2 3 | CMAKE_PROGRESS_3 = 3 4 | 5 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/build/slam_test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/loop_closure_detection_simulation/build/slam_test -------------------------------------------------------------------------------- /loop_closure_detection_simulation/.slam_test.cpp.swn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/loop_closure_detection_simulation/.slam_test.cpp.swn -------------------------------------------------------------------------------- /loop_closure_detection_simulation/.slam_test.cpp.swo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/loop_closure_detection_simulation/.slam_test.cpp.swo -------------------------------------------------------------------------------- /loop_closure_detection_simulation/include/.slam_process.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/loop_closure_detection_simulation/include/.slam_process.h.swp -------------------------------------------------------------------------------- /navigation_global_path_planning_simulation/.slam_test.cpp.swn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/navigation_global_path_planning_simulation/.slam_test.cpp.swn -------------------------------------------------------------------------------- /navigation_global_path_planning_simulation/.slam_test.cpp.swo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/navigation_global_path_planning_simulation/.slam_test.cpp.swo -------------------------------------------------------------------------------- /navigation_local_path_planning_simulation/.slam_test.cpp.swn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/navigation_local_path_planning_simulation/.slam_test.cpp.swn -------------------------------------------------------------------------------- /navigation_local_path_planning_simulation/.slam_test.cpp.swo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/navigation_local_path_planning_simulation/.slam_test.cpp.swo -------------------------------------------------------------------------------- /loop_closure_detection_simulation/include/.dataContainer.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/loop_closure_detection_simulation/include/.dataContainer.h.swp -------------------------------------------------------------------------------- /loop_closure_detection_simulation/include/.laserSimulation.h.swo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/loop_closure_detection_simulation/include/.laserSimulation.h.swo -------------------------------------------------------------------------------- /loop_closure_detection_simulation/include/.laserSimulation.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/loop_closure_detection_simulation/include/.laserSimulation.h.swp -------------------------------------------------------------------------------- /loop_closure_detection_simulation/include/.target_planner.h.swo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/loop_closure_detection_simulation/include/.target_planner.h.swo -------------------------------------------------------------------------------- /loop_closure_detection_simulation/include/.target_planner.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/loop_closure_detection_simulation/include/.target_planner.h.swp -------------------------------------------------------------------------------- /robot_navigation_global_path_planing/lib/libcspclidar_driver.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/robot_navigation_global_path_planing/lib/libcspclidar_driver.a -------------------------------------------------------------------------------- /robot_navigation_local_path_planning/lib/libcspclidar_driver.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/robot_navigation_local_path_planning/lib/libcspclidar_driver.a -------------------------------------------------------------------------------- /M1C1_Lidar/README.md: -------------------------------------------------------------------------------- 1 | 2 | linux: 3 | 4 | $ cd M1C1_Mini SDK V2.0 5 | 6 | $ mkdir build 7 | 8 | $ cd build 9 | 10 | $ cmake .. 11 | 12 | $ make 13 | 14 | $ ./cspclidar_test 15 | 16 | -------------------------------------------------------------------------------- /dnn_body_detect/model/multitask_body_head_face_hand_kps_960x544.hbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/dnn_body_detect/model/multitask_body_head_face_hand_kps_960x544.hbm -------------------------------------------------------------------------------- /loop_closure_detection_simulation/include/.pose_graph_optimize.h.swo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/loop_closure_detection_simulation/include/.pose_graph_optimize.h.swo -------------------------------------------------------------------------------- /loop_closure_detection_simulation/include/.pose_graph_optimize.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/loop_closure_detection_simulation/include/.pose_graph_optimize.h.swp -------------------------------------------------------------------------------- /navigation_local_path_planning_simulation/include/.slam_process.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/navigation_local_path_planning_simulation/include/.slam_process.h.swp -------------------------------------------------------------------------------- /navigation_global_path_planning_simulation/include/.dataContainer.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/navigation_global_path_planning_simulation/include/.dataContainer.h.swp -------------------------------------------------------------------------------- /navigation_global_path_planning_simulation/include/.slam_process.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/navigation_global_path_planning_simulation/include/.slam_process.h.swp -------------------------------------------------------------------------------- /navigation_local_path_planning_simulation/include/.dataContainer.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/navigation_local_path_planning_simulation/include/.dataContainer.h.swp -------------------------------------------------------------------------------- /navigation_local_path_planning_simulation/include/.target_planner.h.swo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/navigation_local_path_planning_simulation/include/.target_planner.h.swo -------------------------------------------------------------------------------- /navigation_local_path_planning_simulation/include/.target_planner.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/navigation_local_path_planning_simulation/include/.target_planner.h.swp -------------------------------------------------------------------------------- /loop_closure_detection_simulation/build/CMakeFiles/3.19.6/CompilerIdC/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/loop_closure_detection_simulation/build/CMakeFiles/3.19.6/CompilerIdC/a.out -------------------------------------------------------------------------------- /robot_navigation_global_path_planing/include/common/.time_synchronize.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/robot_navigation_global_path_planing/include/common/.time_synchronize.h.swp -------------------------------------------------------------------------------- /loop_closure_detection_simulation/build/CMakeFiles/3.19.6/CompilerIdCXX/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/loop_closure_detection_simulation/build/CMakeFiles/3.19.6/CompilerIdCXX/a.out -------------------------------------------------------------------------------- /loop_closure_detection_simulation/build/CMakeFiles/slam_test.dir/slam_test.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/loop_closure_detection_simulation/build/CMakeFiles/slam_test.dir/slam_test.cpp.o -------------------------------------------------------------------------------- /bottom_control_board/motor_pid_velocity_control/uart.cpp: -------------------------------------------------------------------------------- 1 | #include "uart.h" 2 | 3 | HardwareSerial uart1(1); 4 | 5 | void uartInit( int port ) 6 | { 7 | uart1.begin( port, SERIAL_8N1, UART1_RX, UART1_TX ); 8 | } 9 | -------------------------------------------------------------------------------- /M1C1_Lidar/src/impl/windows/win.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/build/CMakeFiles/3.19.6/CMakeDetermineCompilerABI_C.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/loop_closure_detection_simulation/build/CMakeFiles/3.19.6/CMakeDetermineCompilerABI_C.bin -------------------------------------------------------------------------------- /bottom_control_board/motor_pid_velocity_control/battery.h: -------------------------------------------------------------------------------- 1 | #ifndef __BATTERY_H 2 | #define __BATTERY_H 3 | 4 | #include 5 | 6 | #define Battery_Pin 32 7 | 8 | float getBatteryVoltage(); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/build/CMakeFiles/3.19.6/CMakeDetermineCompilerABI_CXX.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/loop_closure_detection_simulation/build/CMakeFiles/3.19.6/CMakeDetermineCompilerABI_CXX.bin -------------------------------------------------------------------------------- /loop_closure_detection_simulation/build/CMakeFiles/slam_test.dir/src/laserSimulation.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdream/robot_projects/HEAD/loop_closure_detection_simulation/build/CMakeFiles/slam_test.dir/src/laserSimulation.cpp.o -------------------------------------------------------------------------------- /bottom_control_board/motor_pid_velocity_control/dht11.h: -------------------------------------------------------------------------------- 1 | #ifndef __DHT11_H 2 | #define __DHT11_H 3 | 4 | #include 5 | 6 | #define DHT11_PIN 16 7 | 8 | void getHumidityAndTemperature( int& humidity, int& temperature ); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /global_planner/main.cpp: -------------------------------------------------------------------------------- 1 | #include "simulation.h" 2 | 3 | 4 | int main() 5 | { 6 | std::cout<<"--------------- GLOABAL PLANNER ---------------"< simulator; 9 | simulator.initMap(); 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /bottom_control_board/motor_pid_velocity_control/ultrasonic.h: -------------------------------------------------------------------------------- 1 | #ifndef __ULTRA_SONIC_H 2 | #define __ULTRA_SONIC_H 3 | 4 | #include 5 | 6 | #define Trig 22 7 | #define Echo 23 8 | 9 | void ultraSonicInit(); 10 | float getDistance(); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /bottom_control_board/motor_pid_velocity_control/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef __UART_H 2 | #define __UART_H 3 | 4 | #include 5 | 6 | #define UART1_RX 19 7 | #define UART1_TX 21 8 | 9 | extern HardwareSerial uart1; 10 | 11 | void uartInit( int port ); 12 | 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /bottom_control_board/motor_pid_velocity_control/battery.cpp: -------------------------------------------------------------------------------- 1 | #include "battery.h" 2 | 3 | float getBatteryVoltage() 4 | { 5 | int adc_value = analogRead( Battery_Pin ); 6 | float voltage = ( ( (float)adc_value ) / 4095 ) * 16.5; // * 3.3 * 5; 7 | 8 | return voltage; 9 | } 10 | -------------------------------------------------------------------------------- /bottom_control_board/motor_pid_velocity_control/dht11.cpp: -------------------------------------------------------------------------------- 1 | #include "dht11.h" 2 | 3 | DFRobot_DHT11 DHT; 4 | 5 | void getHumidityAndTemperature( int& humidity, int& temperature ) 6 | { 7 | DHT.read( DHT11_PIN ); 8 | 9 | humidity = DHT.humidity; 10 | temperature = DHT.temperature; 11 | } 12 | -------------------------------------------------------------------------------- /bottom_control_board/motor_pid_velocity_control/wifi.h: -------------------------------------------------------------------------------- 1 | #ifndef __WIFI_H 2 | #define __WIFI_H 3 | 4 | #include 5 | 6 | extern WiFiUDP udp, udp2; 7 | extern IPAddress remote_IP; 8 | extern unsigned int remote_port; 9 | extern unsigned int remote_port2; 10 | 11 | void wifiInit(); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /bottom_control_board/motor_pid_velocity_control/server.h: -------------------------------------------------------------------------------- 1 | #ifndef __SERVER_H 2 | #define __SERVER_H 3 | 4 | #include 5 | 6 | 7 | void initMotor(); 8 | int calculatePWM(int degree); 9 | 10 | void motor1Run( int degree ); 11 | void motor2Run( int degree ); 12 | 13 | void motor3Run( int degree ); 14 | void motor4Run( int degree ); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /M1C1_Lidar/include/utils.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #ifdef WIN32 5 | #ifdef cspclidar_IMPORTS 6 | #define C_CSPCLIDAR_API __declspec(dllimport) 7 | #else 8 | #ifdef cspclidarStatic_IMPORTS 9 | #define C_CSPCLIDAR_API 10 | #else 11 | 12 | #define C_CSPCLIDAR_API __declspec(dllexport) 13 | #endif 14 | #endif 15 | 16 | #else 17 | #define C_CSPCLIDAR_API 18 | #endif // ifdef WIN32 19 | -------------------------------------------------------------------------------- /m1c1_lidar_test/include/lidar_include/utils.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #ifdef WIN32 5 | #ifdef cspclidar_IMPORTS 6 | #define C_CSPCLIDAR_API __declspec(dllimport) 7 | #else 8 | #ifdef cspclidarStatic_IMPORTS 9 | #define C_CSPCLIDAR_API 10 | #else 11 | 12 | #define C_CSPCLIDAR_API __declspec(dllexport) 13 | #endif 14 | #endif 15 | 16 | #else 17 | #define C_CSPCLIDAR_API 18 | #endif // ifdef WIN32 19 | -------------------------------------------------------------------------------- /robot_slam/include/lidar/lidar_include/utils.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #ifdef WIN32 5 | #ifdef cspclidar_IMPORTS 6 | #define C_CSPCLIDAR_API __declspec(dllimport) 7 | #else 8 | #ifdef cspclidarStatic_IMPORTS 9 | #define C_CSPCLIDAR_API 10 | #else 11 | 12 | #define C_CSPCLIDAR_API __declspec(dllexport) 13 | #endif 14 | #endif 15 | 16 | #else 17 | #define C_CSPCLIDAR_API 18 | #endif // ifdef WIN32 19 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/build/CMakeFiles/TargetDirectories.txt: -------------------------------------------------------------------------------- 1 | /groupdata/share/ddf/Test/robot_test/robot_projects/loop_closure_detection_simulation/build/CMakeFiles/rebuild_cache.dir 2 | /groupdata/share/ddf/Test/robot_test/robot_projects/loop_closure_detection_simulation/build/CMakeFiles/slam_test.dir 3 | /groupdata/share/ddf/Test/robot_test/robot_projects/loop_closure_detection_simulation/build/CMakeFiles/edit_cache.dir 4 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/build/CMakeFiles/slam_test.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "CMakeFiles/slam_test.dir/slam_test.cpp.o" 3 | "CMakeFiles/slam_test.dir/src/laserSimulation.cpp.o" 4 | "slam_test" 5 | "slam_test.pdb" 6 | ) 7 | 8 | # Per-language clean rules from dependency scanning. 9 | foreach(lang CXX) 10 | include(CMakeFiles/slam_test.dir/cmake_clean_${lang}.cmake OPTIONAL) 11 | endforeach() 12 | -------------------------------------------------------------------------------- /M1C1_Lidar/src/common.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #if defined(_WIN32) 5 | 6 | #include "impl\windows\win.h" 7 | #include "impl\windows\win_serial.h" 8 | #elif defined(__GNUC__) 9 | #include "impl/unix/unix.h" 10 | #include "impl/unix/unix_serial.h" 11 | #else 12 | #error "unsupported target" 13 | #endif 14 | #include "locker.h" 15 | #include "thread.h" 16 | #include "timer.h" 17 | 18 | #define SDKVerision "1.4.5" 19 | -------------------------------------------------------------------------------- /robot_navigation_global_path_planing/include/lidar/lidar_include/utils.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #ifdef WIN32 5 | #ifdef cspclidar_IMPORTS 6 | #define C_CSPCLIDAR_API __declspec(dllimport) 7 | #else 8 | #ifdef cspclidarStatic_IMPORTS 9 | #define C_CSPCLIDAR_API 10 | #else 11 | 12 | #define C_CSPCLIDAR_API __declspec(dllexport) 13 | #endif 14 | #endif 15 | 16 | #else 17 | #define C_CSPCLIDAR_API 18 | #endif // ifdef WIN32 19 | -------------------------------------------------------------------------------- /robot_navigation_local_path_planning/include/lidar/lidar_include/utils.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #ifdef WIN32 5 | #ifdef cspclidar_IMPORTS 6 | #define C_CSPCLIDAR_API __declspec(dllimport) 7 | #else 8 | #ifdef cspclidarStatic_IMPORTS 9 | #define C_CSPCLIDAR_API 10 | #else 11 | 12 | #define C_CSPCLIDAR_API __declspec(dllexport) 13 | #endif 14 | #endif 15 | 16 | #else 17 | #define C_CSPCLIDAR_API 18 | #endif // ifdef WIN32 19 | -------------------------------------------------------------------------------- /apf_planner/main.cpp: -------------------------------------------------------------------------------- 1 | #include "apf_simulator.h" 2 | 3 | 4 | int main() 5 | { 6 | std::cout<<"--------------- APF PLANNER ---------------"< apf; 9 | apf.initMap(); 10 | 11 | apf.setTargetPose( apf::APF::Vector2( 2.3, -0.5 ) ); 12 | 13 | apf::APF::Vector2 robot_pose( 0, 0 ); 14 | for( int i = 0; i < 100; i ++ ){ 15 | apf.runApfOnce( robot_pose ); 16 | } 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/build/CMakeFiles/slam_test.dir/flags.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.19 3 | 4 | # compile CXX with /usr/bin/c++ 5 | CXX_DEFINES = 6 | 7 | CXX_INCLUDES = -I/usr/include/eigen3 -I/groupdata/share/ddf/Test/robot_test/robot_projects/loop_closure_detection_simulation/include -isystem /usr/local/include/opencv 8 | 9 | CXX_FLAGS = -O2 -g -DNDEBUG -std=c++14 10 | 11 | -------------------------------------------------------------------------------- /bottom_control_board/motor_pid_velocity_control/ultrasonic.cpp: -------------------------------------------------------------------------------- 1 | #include "ultrasonic.h" 2 | 3 | void ultraSonicInit() 4 | { 5 | pinMode( Trig, OUTPUT ); 6 | pinMode( Echo, INPUT ); 7 | 8 | digitalWrite( Trig, LOW ); 9 | } 10 | 11 | float getDistance() 12 | { 13 | digitalWrite( Trig, HIGH ); 14 | delayMicroseconds(10); 15 | digitalWrite( Trig, LOW ); 16 | 17 | float dist = pulseIn( Echo, HIGH ) * 0.034 / 2; 18 | 19 | return dist; 20 | } 21 | -------------------------------------------------------------------------------- /bottom_control_board/motor_pid_velocity_control/imu.h: -------------------------------------------------------------------------------- 1 | #ifndef __IMU_H 2 | #define __IMU_H 3 | 4 | #include 5 | #include "Wire.h" 6 | #include 7 | 8 | #define IMU_SDA 5 9 | #define IMU_SCL 18 10 | 11 | typedef struct ImuData_ 12 | { 13 | float ax; 14 | float ay; 15 | float gz; 16 | }ImuData; 17 | 18 | typedef struct ImuStatus_ 19 | { 20 | 21 | }ImuStatus; 22 | 23 | void imuInit(); 24 | ImuData getImuData(); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/build/CMakeFiles/3.19.6/CMakeSystem.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_HOST_SYSTEM "Linux-5.4.0-148-generic") 2 | set(CMAKE_HOST_SYSTEM_NAME "Linux") 3 | set(CMAKE_HOST_SYSTEM_VERSION "5.4.0-148-generic") 4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64") 5 | 6 | 7 | 8 | set(CMAKE_SYSTEM "Linux-5.4.0-148-generic") 9 | set(CMAKE_SYSTEM_NAME "Linux") 10 | set(CMAKE_SYSTEM_VERSION "5.4.0-148-generic") 11 | set(CMAKE_SYSTEM_PROCESSOR "x86_64") 12 | 13 | set(CMAKE_CROSSCOMPILING "FALSE") 14 | 15 | set(CMAKE_SYSTEM_LOADED 1) 16 | -------------------------------------------------------------------------------- /M1C1_Lidar/samples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | cmake_minimum_required(VERSION 2.8) 3 | PROJECT(cspclidar_test) 4 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 5 | add_definitions(-std=c++11) # Use C++11 6 | 7 | #Include directories 8 | INCLUDE_DIRECTORIES( 9 | ${CMAKE_SOURCE_DIR} 10 | ${CMAKE_SOURCE_DIR}/../ 11 | ${CMAKE_CURRENT_BINARY_DIR} 12 | ) 13 | 14 | SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}) 15 | ADD_EXECUTABLE(${PROJECT_NAME} 16 | main.cpp) 17 | 18 | # Add the required libraries for linking: 19 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} cspclidar_driver) 20 | -------------------------------------------------------------------------------- /m1c1_lidar_test/REDME.md: -------------------------------------------------------------------------------- 1 | |-- CMakeLists.txt 2 | |-- include 3 | | |-- data_container.h 4 | | |-- data_transport.h 5 | | |-- data_type.h 6 | | |-- lidar_drive.h 7 | | `-- lidar_include 8 | | |-- C_CSPC_Lidar.h 9 | | |-- angles.h 10 | | |-- cspclidar_driver.h 11 | | |-- cspclidar_protocol.h 12 | | |-- help_info.h 13 | | |-- lock.h 14 | | |-- locker.h 15 | | |-- serial.h 16 | | |-- thread.h 17 | | |-- timer.h 18 | | |-- utils.h 19 | | `-- v8stdint.h 20 | |-- lib 21 | | `-- libcspclidar_driver.a 22 | `-- src 23 | `-- main.cpp 24 | 25 | -------------------------------------------------------------------------------- /M1C1_Lidar/src/impl/unix/unix.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // libc dep 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | // libc++ dep 13 | #include 14 | #include 15 | 16 | // linux specific 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | -------------------------------------------------------------------------------- /bottom_control_board/motor_pid_velocity_control/pid.h: -------------------------------------------------------------------------------- 1 | #ifndef __PID_H 2 | #define __PID_H 3 | 4 | #include 5 | 6 | class PID 7 | { 8 | public: 9 | PID(); 10 | 11 | PID( const float dt, const float max, const float min, const float kp, const float ki, const float kd ); 12 | 13 | ~PID(); 14 | 15 | const float caculate( const float& target, const float& current ); 16 | 17 | private: 18 | float dt_; 19 | float max_; 20 | float min_; 21 | float kp_; 22 | float ki_; 23 | float kd_; 24 | float pre_error_ = 0; 25 | float integral_ = 0; 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /bottom_control_board/motor_pid_velocity_control/wifi.cpp: -------------------------------------------------------------------------------- 1 | #include "wifi.h" 2 | 3 | const char *ssid = "1234567"; 4 | const char *password = "xd123456"; 5 | WiFiUDP udp, udp2; 6 | IPAddress remote_IP(192, 168, 43, 190); // udp 服务端ip 7 | unsigned int remote_port = 2333; 8 | unsigned int remote_port2 = 2335; 9 | 10 | void wifiInit() 11 | { 12 | WiFi.mode(WIFI_STA); 13 | WiFi.setSleep(false); 14 | 15 | WiFi.begin(ssid, password); 16 | while(WiFi.status() != WL_CONNECTED){ 17 | delay(2500); 18 | //Serial.print("."); 19 | WiFi.begin(ssid, password); 20 | } 21 | //Serial.print("Connected, IP : "); 22 | //Serial.println(WiFi.localIP()); 23 | } 24 | -------------------------------------------------------------------------------- /M1C1_Lidar/src/impl/unix/unix_timer.cpp: -------------------------------------------------------------------------------- 1 | #if !defined(_WIN32) 2 | #include "timer.h" 3 | 4 | namespace impl { 5 | uint32_t getHDTimer() { 6 | struct timespec t; 7 | t.tv_sec = t.tv_nsec = 0; 8 | clock_gettime(CLOCK_MONOTONIC, &t); 9 | return t.tv_sec * 1000L + t.tv_nsec / 1000000L; 10 | } 11 | uint64_t getCurrentTime() { 12 | #if HAS_CLOCK_GETTIME 13 | struct timespec tim; 14 | clock_gettime(CLOCK_REALTIME, &tim); 15 | return static_cast(tim.tv_sec) * 1000000000LL + tim.tv_nsec; 16 | #else 17 | struct timeval timeofday; 18 | gettimeofday(&timeofday, NULL); 19 | return static_cast(timeofday.tv_sec) * 1000000000LL + 20 | static_cast(timeofday.tv_usec) * 1000LL; 21 | #endif 22 | } 23 | } 24 | #endif 25 | -------------------------------------------------------------------------------- /odometry/include/IEvent.h: -------------------------------------------------------------------------------- 1 | #ifndef __IEVENT_H_ 2 | #define __IEVENT_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | typedef std::function FUNC; 10 | 11 | typedef struct{ 12 | int fd;// the fd want to monitor 13 | short event;// the event want to monitor 14 | //void *( *callback )( int fd, void *arg );// the callback function 15 | FUNC callback; 16 | void *arg;// the parameters of the callback function 17 | }Event; 18 | 19 | 20 | /* the interface of the event */ 21 | class IEvent{ 22 | public: 23 | virtual int addEvent( const Event &event ) = 0; 24 | virtual int delEvent( const Event &event ) = 0; 25 | virtual int dispatcher() = 0; 26 | 27 | virtual ~IEvent() 28 | { 29 | 30 | } 31 | }; 32 | 33 | 34 | 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tele_control/include/IEvent.h: -------------------------------------------------------------------------------- 1 | #ifndef __IEVENT_H_ 2 | #define __IEVENT_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | typedef std::function FUNC; 10 | 11 | typedef struct{ 12 | int fd;// the fd want to monitor 13 | short event;// the event want to monitor 14 | //void *( *callback )( int fd, void *arg );// the callback function 15 | FUNC callback; 16 | void *arg;// the parameters of the callback function 17 | }Event; 18 | 19 | 20 | /* the interface of the event */ 21 | class IEvent{ 22 | public: 23 | virtual int addEvent( const Event &event ) = 0; 24 | virtual int delEvent( const Event &event ) = 0; 25 | virtual int dispatcher() = 0; 26 | 27 | virtual ~IEvent() 28 | { 29 | 30 | } 31 | }; 32 | 33 | 34 | 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /uart_test/main.cpp: -------------------------------------------------------------------------------- 1 | #include "uart.h" 2 | #include 3 | 4 | #pragma pack(4) 5 | 6 | char buffer[100]; 7 | 8 | typedef struct IMU_ 9 | { 10 | float ax; 11 | float ay; 12 | float gz; 13 | }IMU; 14 | 15 | typedef struct Measurement_ 16 | { 17 | long time_stamp; 18 | float v; 19 | float delta_s; 20 | float delta_angle; 21 | 22 | IMU imu; 23 | }Measurement; 24 | 25 | int main() 26 | { 27 | std::cout<<"------------ UART TEST ------------"< 0 ) { 35 | std::cout<<"ret = "< 5 | #include 6 | 7 | #include 8 | 9 | namespace epoll 10 | { 11 | 12 | typedef std::function FUNC; 13 | 14 | typedef struct{ 15 | int fd;// the fd want to monitor 16 | short event;// the event want to monitor 17 | //void *( *callback )( int fd, void *arg );// the callback function 18 | FUNC callback; 19 | void *arg;// the parameters of the callback function 20 | }Event; 21 | 22 | 23 | /* the interface of the event */ 24 | class IEvent{ 25 | public: 26 | virtual int addEvent( const Event &event ) = 0; 27 | virtual int delEvent( const Event &event ) = 0; 28 | virtual int dispatcher() = 0; 29 | 30 | virtual ~IEvent() 31 | { 32 | 33 | } 34 | }; 35 | 36 | } 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /rtmp_stream/main.cpp_cpy: -------------------------------------------------------------------------------- 1 | #include "librtmp_send264.h" 2 | #include 3 | #include 4 | 5 | FILE* fp_send = NULL; 6 | 7 | int readBuffer(unsigned char *buf, int buf_size ){ 8 | if( !feof( fp_send ) ) { 9 | int true_size = fread( buf, 1, buf_size, fp_send ); 10 | return true_size; 11 | } 12 | else { 13 | return -1; 14 | } 15 | } 16 | 17 | 18 | int main() 19 | { 20 | std::cout<<"----------------------- RTMP TEST -----------------------"< 5 | #include 6 | 7 | #include 8 | 9 | namespace epoll 10 | { 11 | 12 | typedef std::function FUNC; 13 | 14 | typedef struct{ 15 | int fd;// the fd want to monitor 16 | short event;// the event want to monitor 17 | //void *( *callback )( int fd, void *arg );// the callback function 18 | FUNC callback; 19 | void *arg;// the parameters of the callback function 20 | }Event; 21 | 22 | 23 | /* the interface of the event */ 24 | class IEvent{ 25 | public: 26 | virtual int addEvent( const Event &event ) = 0; 27 | virtual int delEvent( const Event &event ) = 0; 28 | virtual int dispatcher() = 0; 29 | 30 | virtual ~IEvent() 31 | { 32 | 33 | } 34 | }; 35 | 36 | } 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /jpeg_stream/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED( VERSION 3.16 ) 2 | 3 | # project name 4 | PROJECT(encoder_test) 5 | 6 | # 7 | ADD_DEFINITIONS( -std=c++17 ) 8 | 9 | # find required opencv 10 | FIND_PACKAGE( OpenCV REQUIRED ) 11 | 12 | # directory of opencv headers 13 | INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) 14 | 15 | # directory of opencv link libs 16 | LINK_DIRECTORIES(${OpenCV_LIBRARY_DIRS}) 17 | 18 | INCLUDE_DIRECTORIES( 19 | ${CMAKE_SOURCE_DIR}/include 20 | ${CMAKE_SOURCE_DIR}/src 21 | ${CMAKE_SOURCE_DIR} 22 | ) 23 | 24 | AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR} src_files) 25 | 26 | AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/src src_files) 27 | 28 | ADD_EXECUTABLE( ${PROJECT_NAME} ${src_files} ) 29 | 30 | #TARGET_LINK_LIBRARIES(${PROJECT_NAME} spcdev ) 31 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OpenCV_LIBS}) 32 | -------------------------------------------------------------------------------- /robot_navigation_global_path_planing/include/common/IEvent.h: -------------------------------------------------------------------------------- 1 | #ifndef __IEVENT_H_ 2 | #define __IEVENT_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | namespace epoll 10 | { 11 | 12 | typedef std::function FUNC; 13 | 14 | typedef struct{ 15 | int fd;// the fd want to monitor 16 | short event;// the event want to monitor 17 | //void *( *callback )( int fd, void *arg );// the callback function 18 | FUNC callback; 19 | void *arg;// the parameters of the callback function 20 | }Event; 21 | 22 | 23 | /* the interface of the event */ 24 | class IEvent{ 25 | public: 26 | virtual int addEvent( const Event &event ) = 0; 27 | virtual int delEvent( const Event &event ) = 0; 28 | virtual int dispatcher() = 0; 29 | 30 | virtual ~IEvent() 31 | { 32 | 33 | } 34 | }; 35 | 36 | } 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /robot_navigation_local_path_planning/include/common/IEvent.h: -------------------------------------------------------------------------------- 1 | #ifndef __IEVENT_H_ 2 | #define __IEVENT_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | namespace epoll 10 | { 11 | 12 | typedef std::function FUNC; 13 | 14 | typedef struct{ 15 | int fd;// the fd want to monitor 16 | short event;// the event want to monitor 17 | //void *( *callback )( int fd, void *arg );// the callback function 18 | FUNC callback; 19 | void *arg;// the parameters of the callback function 20 | }Event; 21 | 22 | 23 | /* the interface of the event */ 24 | class IEvent{ 25 | public: 26 | virtual int addEvent( const Event &event ) = 0; 27 | virtual int delEvent( const Event &event ) = 0; 28 | virtual int dispatcher() = 0; 29 | 30 | virtual ~IEvent() 31 | { 32 | 33 | } 34 | }; 35 | 36 | } 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/build/CMakeFiles/CMakeDirectoryInformation.cmake: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.19 3 | 4 | # Relative path conversion top directories. 5 | set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/groupdata/share/ddf/Test/robot_test/robot_projects/loop_closure_detection_simulation") 6 | set(CMAKE_RELATIVE_PATH_TOP_BINARY "/groupdata/share/ddf/Test/robot_test/robot_projects/loop_closure_detection_simulation/build") 7 | 8 | # Force unix paths in dependencies. 9 | set(CMAKE_FORCE_UNIX_PATHS 1) 10 | 11 | 12 | # The C and CXX include file regular expressions for this directory. 13 | set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") 14 | set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") 15 | set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) 16 | set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) 17 | -------------------------------------------------------------------------------- /M1C1_Lidar/src/impl/windows/win_timer.cpp: -------------------------------------------------------------------------------- 1 | #if defined(_WIN32) 2 | #include "timer.h" 3 | #include 4 | #pragma comment(lib, "Winmm.lib") 5 | 6 | namespace impl { 7 | 8 | static LARGE_INTEGER _current_freq; 9 | 10 | void HPtimer_reset() { 11 | BOOL ans = QueryPerformanceFrequency(&_current_freq); 12 | _current_freq.QuadPart /= 1000; 13 | } 14 | 15 | uint32_t getHDTimer() { 16 | LARGE_INTEGER current; 17 | QueryPerformanceCounter(¤t); 18 | 19 | return (uint32_t)(current.QuadPart / (_current_freq.QuadPart)); 20 | } 21 | 22 | uint64_t getCurrentTime() { 23 | FILETIME t; 24 | GetSystemTimeAsFileTime(&t); 25 | return ((((uint64_t)t.dwHighDateTime) << 32) | ((uint64_t)t.dwLowDateTime)) * 100; 26 | } 27 | 28 | 29 | BEGIN_STATIC_CODE(timer_cailb) { 30 | HPtimer_reset(); 31 | } END_STATIC_CODE(timer_cailb) 32 | 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /rtmp_stream/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED( VERSION 3.16 ) 2 | 3 | # project name 4 | PROJECT(rtmp_test) 5 | 6 | # 7 | ADD_DEFINITIONS( -std=c++17 ) 8 | 9 | # find required opencv 10 | FIND_PACKAGE( OpenCV REQUIRED ) 11 | 12 | # directory of opencv headers 13 | INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) 14 | 15 | # directory of opencv link libs 16 | LINK_DIRECTORIES(${OpenCV_LIBRARY_DIRS}) 17 | 18 | INCLUDE_DIRECTORIES( 19 | ${CMAKE_SOURCE_DIR}/include 20 | ${CMAKE_SOURCE_DIR}/src 21 | ${CMAKE_SOURCE_DIR} 22 | ) 23 | 24 | AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR} src_files) 25 | 26 | AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/src src_files) 27 | 28 | ADD_EXECUTABLE( ${PROJECT_NAME} ${src_files} ) 29 | 30 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} rtmp gmp ssl crypto z dap nettle gnutls ) 31 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OpenCV_LIBS}) 32 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} spcdev ) 33 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/build/CMakeFiles/slam_test.dir/link.txt: -------------------------------------------------------------------------------- 1 | /usr/bin/c++ -O2 -g -DNDEBUG CMakeFiles/slam_test.dir/src/laserSimulation.cpp.o CMakeFiles/slam_test.dir/slam_test.cpp.o -o slam_test -Wl,-rpath,/usr/local/lib /usr/local/lib/libopencv_dnn.so.3.4.15 /usr/local/lib/libopencv_highgui.so.3.4.15 /usr/local/lib/libopencv_ml.so.3.4.15 /usr/local/lib/libopencv_objdetect.so.3.4.15 /usr/local/lib/libopencv_shape.so.3.4.15 /usr/local/lib/libopencv_stitching.so.3.4.15 /usr/local/lib/libopencv_superres.so.3.4.15 /usr/local/lib/libopencv_videostab.so.3.4.15 -lpthread /usr/local/lib/libopencv_calib3d.so.3.4.15 /usr/local/lib/libopencv_features2d.so.3.4.15 /usr/local/lib/libopencv_flann.so.3.4.15 /usr/local/lib/libopencv_photo.so.3.4.15 /usr/local/lib/libopencv_video.so.3.4.15 /usr/local/lib/libopencv_videoio.so.3.4.15 /usr/local/lib/libopencv_imgcodecs.so.3.4.15 /usr/local/lib/libopencv_imgproc.so.3.4.15 /usr/local/lib/libopencv_core.so.3.4.15 2 | -------------------------------------------------------------------------------- /odometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED( VERSION 3.16.3 ) 2 | 3 | PROJECT(robot) 4 | 5 | SET( EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin" ) 6 | 7 | ADD_DEFINITIONS( -std=c++17 ) 8 | 9 | #find required eigen 10 | FIND_PACKAGE( Eigen3 ) 11 | 12 | #directory of eigen headers 13 | INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} ) 14 | 15 | #find required opencv 16 | FIND_PACKAGE( OpenCV REQUIRED ) 17 | 18 | #directory of opencv headers 19 | INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) 20 | 21 | INCLUDE_DIRECTORIES( 22 | ${CMAKE_SOURCE_DIR}/include 23 | ${CMAKE_SOURCE_DIR}/src 24 | ) 25 | 26 | AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/src src_file) 27 | AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR} src_file) 28 | 29 | #directory of opencv link libs 30 | LINK_DIRECTORIES(${OpenCV_LIBRARY_DIRS}) 31 | 32 | ADD_EXECUTABLE( ${PROJECT_NAME} ${src_file} ) 33 | 34 | TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${OpenCV_LIBS} ) 35 | TARGET_LINK_LIBRARIES( ${PROJECT_NAME} pthread ) 36 | -------------------------------------------------------------------------------- /tele_control/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED( VERSION 3.16.3 ) 2 | 3 | PROJECT(robot) 4 | 5 | SET( EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin" ) 6 | 7 | ADD_DEFINITIONS( -std=c++17 ) 8 | 9 | #find required eigen 10 | FIND_PACKAGE( Eigen3 ) 11 | 12 | #directory of eigen headers 13 | INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} ) 14 | 15 | #find required opencv 16 | FIND_PACKAGE( OpenCV REQUIRED ) 17 | 18 | #directory of opencv headers 19 | INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) 20 | 21 | INCLUDE_DIRECTORIES( 22 | ${CMAKE_SOURCE_DIR}/include 23 | ${CMAKE_SOURCE_DIR}/src 24 | ) 25 | 26 | AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/src src_file) 27 | AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR} src_file) 28 | 29 | #directory of opencv link libs 30 | LINK_DIRECTORIES(${OpenCV_LIBRARY_DIRS}) 31 | 32 | ADD_EXECUTABLE( ${PROJECT_NAME} ${src_file} ) 33 | 34 | TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${OpenCV_LIBS} ) 35 | TARGET_LINK_LIBRARIES( ${PROJECT_NAME} pthread ) 36 | -------------------------------------------------------------------------------- /icp_test/include/laserSimulation.h: -------------------------------------------------------------------------------- 1 | #ifndef __LASER_SIMULATION_H_ 2 | #define __LASER_SIMULATION_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include "data_type.h" 15 | 16 | namespace simulation{ 17 | 18 | 19 | class Simulation 20 | { 21 | public: 22 | Simulation(); 23 | ~Simulation(); 24 | 25 | bool openSimulationFile( const std::string &inputFile ); 26 | void closeSimulationFile(); 27 | 28 | bool readAFrameData( sensor::LaserScan &scan ); 29 | 30 | bool readLaserInfo( sensor::LaserScan &scan ); 31 | 32 | inline const int filePointPose() 33 | { 34 | return input_file.tellg(); 35 | } 36 | 37 | inline const int endOfFile() 38 | { 39 | return input_file.eof(); 40 | } 41 | 42 | inline const long getFrameCount() const 43 | { 44 | return count; 45 | } 46 | 47 | private: 48 | std::ifstream input_file; 49 | long count; 50 | }; 51 | 52 | 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /slam_simu/include/laserSimulation.h: -------------------------------------------------------------------------------- 1 | #ifndef __LASER_SIMULATION_H_ 2 | #define __LASER_SIMULATION_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include "data_type.h" 15 | 16 | namespace simulation{ 17 | 18 | 19 | class Simulation 20 | { 21 | public: 22 | Simulation(); 23 | ~Simulation(); 24 | 25 | bool openSimulationFile( const std::string &inputFile ); 26 | void closeSimulationFile(); 27 | 28 | bool readAFrameData( sensor::LaserScan &scan ); 29 | 30 | bool readLaserInfo( sensor::LaserScan &scan ); 31 | 32 | inline const int filePointPose() 33 | { 34 | return input_file.tellg(); 35 | } 36 | 37 | inline const int endOfFile() 38 | { 39 | return input_file.eof(); 40 | } 41 | 42 | inline const long getFrameCount() const 43 | { 44 | return count; 45 | } 46 | 47 | private: 48 | std::ifstream input_file; 49 | long count; 50 | }; 51 | 52 | 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/include/laserSimulation.h: -------------------------------------------------------------------------------- 1 | #ifndef __LASER_SIMULATION_H_ 2 | #define __LASER_SIMULATION_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include "data_type.h" 15 | 16 | namespace simulation{ 17 | 18 | 19 | class Simulation 20 | { 21 | public: 22 | Simulation(); 23 | ~Simulation(); 24 | 25 | bool openSimulationFile( const std::string &inputFile ); 26 | void closeSimulationFile(); 27 | 28 | bool readAFrameData( sensor::LaserScan &scan ); 29 | 30 | bool readLaserInfo( sensor::LaserScan &scan ); 31 | 32 | inline const int filePointPose() 33 | { 34 | return input_file.tellg(); 35 | } 36 | 37 | inline const int endOfFile() 38 | { 39 | return input_file.eof(); 40 | } 41 | 42 | inline const long getFrameCount() const 43 | { 44 | return count; 45 | } 46 | 47 | private: 48 | std::ifstream input_file; 49 | long count; 50 | }; 51 | 52 | 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /navigation_global_path_planning_simulation/include/laserSimulation.h: -------------------------------------------------------------------------------- 1 | #ifndef __LASER_SIMULATION_H_ 2 | #define __LASER_SIMULATION_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include "data_type.h" 15 | 16 | namespace simulation{ 17 | 18 | 19 | class Simulation 20 | { 21 | public: 22 | Simulation(); 23 | ~Simulation(); 24 | 25 | bool openSimulationFile( const std::string &inputFile ); 26 | void closeSimulationFile(); 27 | 28 | bool readAFrameData( sensor::LaserScan &scan ); 29 | 30 | bool readLaserInfo( sensor::LaserScan &scan ); 31 | 32 | inline const int filePointPose() 33 | { 34 | return input_file.tellg(); 35 | } 36 | 37 | inline const int endOfFile() 38 | { 39 | return input_file.eof(); 40 | } 41 | 42 | inline const long getFrameCount() const 43 | { 44 | return count; 45 | } 46 | 47 | private: 48 | std::ifstream input_file; 49 | long count; 50 | }; 51 | 52 | 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /navigation_local_path_planning_simulation/include/laserSimulation.h: -------------------------------------------------------------------------------- 1 | #ifndef __LASER_SIMULATION_H_ 2 | #define __LASER_SIMULATION_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include "data_type.h" 15 | 16 | namespace simulation{ 17 | 18 | 19 | class Simulation 20 | { 21 | public: 22 | Simulation(); 23 | ~Simulation(); 24 | 25 | bool openSimulationFile( const std::string &inputFile ); 26 | void closeSimulationFile(); 27 | 28 | bool readAFrameData( sensor::LaserScan &scan ); 29 | 30 | bool readLaserInfo( sensor::LaserScan &scan ); 31 | 32 | inline const int filePointPose() 33 | { 34 | return input_file.tellg(); 35 | } 36 | 37 | inline const int endOfFile() 38 | { 39 | return input_file.eof(); 40 | } 41 | 42 | inline const long getFrameCount() const 43 | { 44 | return count; 45 | } 46 | 47 | private: 48 | std::ifstream input_file; 49 | long count; 50 | }; 51 | 52 | 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /M1C1_Lidar/include/timer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "v8stdint.h" 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | 9 | #define BEGIN_STATIC_CODE( _blockname_ ) \ 10 | static class _static_code_##_blockname_ { \ 11 | public: \ 12 | _static_code_##_blockname_ () 13 | 14 | 15 | #define END_STATIC_CODE( _blockname_ ) \ 16 | } _instance_##_blockname_; 17 | 18 | 19 | #if defined(_WIN32) 20 | #include 21 | #define delay(x) ::Sleep(x) 22 | #else 23 | #include 24 | #include 25 | 26 | static inline void delay(uint32_t ms) { 27 | while (ms >= 1000) { 28 | usleep(1000 * 1000); 29 | ms -= 1000; 30 | }; 31 | 32 | if (ms != 0) { 33 | usleep(ms * 1000); 34 | } 35 | } 36 | #endif 37 | 38 | 39 | namespace impl { 40 | 41 | #if defined(_WIN32) 42 | void HPtimer_reset(); 43 | #endif 44 | uint32_t getHDTimer(); 45 | uint64_t getCurrentTime(); 46 | } // namespace impl 47 | 48 | 49 | #define getms() impl::getHDTimer() 50 | #define getTime() impl::getCurrentTime() 51 | -------------------------------------------------------------------------------- /odometry/include/EpollEvent.h: -------------------------------------------------------------------------------- 1 | #ifndef __EPOLLEVENT_H_ 2 | #define __EPOLLEVENT_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include "IEvent.h" 8 | 9 | class EpollEvent : public IEvent 10 | { 11 | public: 12 | EpollEvent(): epollCreateSize(16) 13 | { 14 | initEvent(); 15 | } 16 | EpollEvent( int createSize_ ) 17 | { 18 | if( createSize_ < 16 ) createSize_ = 16; 19 | epollCreateSize = createSize_; 20 | initEvent(); 21 | } 22 | 23 | virtual int addEvent( const Event &event ); 24 | virtual int delEvent( const Event &event ); 25 | virtual int dispatcher(); 26 | 27 | private: 28 | int initEvent() 29 | { 30 | int epollFd = epoll_create( this->epollCreateSize ); 31 | if( epollFd <= 0 ){ 32 | std::cerr<<"epoll create error ..."<epollFd = epollFd; 36 | return true; 37 | } 38 | int epollCreateSize; 39 | int epollFd; 40 | std::map events; 41 | }; 42 | 43 | 44 | #endif 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /tele_control/include/EpollEvent.h: -------------------------------------------------------------------------------- 1 | #ifndef __EPOLLEVENT_H_ 2 | #define __EPOLLEVENT_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include "IEvent.h" 8 | 9 | class EpollEvent : public IEvent 10 | { 11 | public: 12 | EpollEvent(): epollCreateSize(16) 13 | { 14 | initEvent(); 15 | } 16 | EpollEvent( int createSize_ ) 17 | { 18 | if( createSize_ < 16 ) createSize_ = 16; 19 | epollCreateSize = createSize_; 20 | initEvent(); 21 | } 22 | 23 | virtual int addEvent( const Event &event ); 24 | virtual int delEvent( const Event &event ); 25 | virtual int dispatcher(); 26 | 27 | private: 28 | int initEvent() 29 | { 30 | int epollFd = epoll_create( this->epollCreateSize ); 31 | if( epollFd <= 0 ){ 32 | std::cerr<<"epoll create error ..."<epollFd = epollFd; 36 | return true; 37 | } 38 | int epollCreateSize; 39 | int epollFd; 40 | std::map events; 41 | }; 42 | 43 | 44 | #endif 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /m1c1_lidar_test/include/lidar_include/timer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "v8stdint.h" 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | 9 | #define BEGIN_STATIC_CODE( _blockname_ ) \ 10 | static class _static_code_##_blockname_ { \ 11 | public: \ 12 | _static_code_##_blockname_ () 13 | 14 | 15 | #define END_STATIC_CODE( _blockname_ ) \ 16 | } _instance_##_blockname_; 17 | 18 | 19 | #if defined(_WIN32) 20 | #include 21 | #define delay(x) ::Sleep(x) 22 | #else 23 | #include 24 | #include 25 | 26 | static inline void delay(uint32_t ms) { 27 | while (ms >= 1000) { 28 | usleep(1000 * 1000); 29 | ms -= 1000; 30 | }; 31 | 32 | if (ms != 0) { 33 | usleep(ms * 1000); 34 | } 35 | } 36 | #endif 37 | 38 | 39 | namespace impl { 40 | 41 | #if defined(_WIN32) 42 | void HPtimer_reset(); 43 | #endif 44 | uint32_t getHDTimer(); 45 | uint64_t getCurrentTime(); 46 | } // namespace impl 47 | 48 | 49 | #define getms() impl::getHDTimer() 50 | #define getTime() impl::getCurrentTime() 51 | -------------------------------------------------------------------------------- /robot_slam/include/lidar/lidar_include/timer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "v8stdint.h" 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | 9 | #define BEGIN_STATIC_CODE( _blockname_ ) \ 10 | static class _static_code_##_blockname_ { \ 11 | public: \ 12 | _static_code_##_blockname_ () 13 | 14 | 15 | #define END_STATIC_CODE( _blockname_ ) \ 16 | } _instance_##_blockname_; 17 | 18 | 19 | #if defined(_WIN32) 20 | #include 21 | #define delay(x) ::Sleep(x) 22 | #else 23 | #include 24 | #include 25 | 26 | static inline void delay(uint32_t ms) { 27 | while (ms >= 1000) { 28 | usleep(1000 * 1000); 29 | ms -= 1000; 30 | }; 31 | 32 | if (ms != 0) { 33 | usleep(ms * 1000); 34 | } 35 | } 36 | #endif 37 | 38 | 39 | namespace impl { 40 | 41 | #if defined(_WIN32) 42 | void HPtimer_reset(); 43 | #endif 44 | uint32_t getHDTimer(); 45 | uint64_t getCurrentTime(); 46 | } // namespace impl 47 | 48 | 49 | #define getms() impl::getHDTimer() 50 | #define getTime() impl::getCurrentTime() 51 | -------------------------------------------------------------------------------- /robot_navigation_global_path_planing/include/lidar/lidar_include/timer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "v8stdint.h" 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | 9 | #define BEGIN_STATIC_CODE( _blockname_ ) \ 10 | static class _static_code_##_blockname_ { \ 11 | public: \ 12 | _static_code_##_blockname_ () 13 | 14 | 15 | #define END_STATIC_CODE( _blockname_ ) \ 16 | } _instance_##_blockname_; 17 | 18 | 19 | #if defined(_WIN32) 20 | #include 21 | #define delay(x) ::Sleep(x) 22 | #else 23 | #include 24 | #include 25 | 26 | static inline void delay(uint32_t ms) { 27 | while (ms >= 1000) { 28 | usleep(1000 * 1000); 29 | ms -= 1000; 30 | }; 31 | 32 | if (ms != 0) { 33 | usleep(ms * 1000); 34 | } 35 | } 36 | #endif 37 | 38 | 39 | namespace impl { 40 | 41 | #if defined(_WIN32) 42 | void HPtimer_reset(); 43 | #endif 44 | uint32_t getHDTimer(); 45 | uint64_t getCurrentTime(); 46 | } // namespace impl 47 | 48 | 49 | #define getms() impl::getHDTimer() 50 | #define getTime() impl::getCurrentTime() 51 | -------------------------------------------------------------------------------- /robot_navigation_local_path_planning/include/lidar/lidar_include/timer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "v8stdint.h" 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | 9 | #define BEGIN_STATIC_CODE( _blockname_ ) \ 10 | static class _static_code_##_blockname_ { \ 11 | public: \ 12 | _static_code_##_blockname_ () 13 | 14 | 15 | #define END_STATIC_CODE( _blockname_ ) \ 16 | } _instance_##_blockname_; 17 | 18 | 19 | #if defined(_WIN32) 20 | #include 21 | #define delay(x) ::Sleep(x) 22 | #else 23 | #include 24 | #include 25 | 26 | static inline void delay(uint32_t ms) { 27 | while (ms >= 1000) { 28 | usleep(1000 * 1000); 29 | ms -= 1000; 30 | }; 31 | 32 | if (ms != 0) { 33 | usleep(ms * 1000); 34 | } 35 | } 36 | #endif 37 | 38 | 39 | namespace impl { 40 | 41 | #if defined(_WIN32) 42 | void HPtimer_reset(); 43 | #endif 44 | uint32_t getHDTimer(); 45 | uint64_t getCurrentTime(); 46 | } // namespace impl 47 | 48 | 49 | #define getms() impl::getHDTimer() 50 | #define getTime() impl::getCurrentTime() 51 | -------------------------------------------------------------------------------- /jpeg_stream/include/EpollEvent.h: -------------------------------------------------------------------------------- 1 | #ifndef __EPOLLEVENT_H_ 2 | #define __EPOLLEVENT_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include "IEvent.h" 8 | 9 | namespace epoll 10 | { 11 | 12 | class EpollEvent : public IEvent 13 | { 14 | public: 15 | EpollEvent(): epollCreateSize(16) 16 | { 17 | initEvent(); 18 | } 19 | EpollEvent( int createSize_ ) 20 | { 21 | if( createSize_ < 16 ) createSize_ = 16; 22 | epollCreateSize = createSize_; 23 | initEvent(); 24 | } 25 | 26 | virtual int addEvent( const Event &event ); 27 | virtual int delEvent( const Event &event ); 28 | virtual int dispatcher(); 29 | 30 | private: 31 | int initEvent() 32 | { 33 | int epollFd = epoll_create( this->epollCreateSize ); 34 | if( epollFd <= 0 ){ 35 | std::cerr<<"epoll create error ..."<epollFd = epollFd; 39 | return true; 40 | } 41 | int epollCreateSize; 42 | int epollFd; 43 | std::map events; 44 | }; 45 | 46 | } 47 | 48 | #endif 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /robot_slam/include/common/EpollEvent.h: -------------------------------------------------------------------------------- 1 | #ifndef __EPOLLEVENT_H_ 2 | #define __EPOLLEVENT_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include "IEvent.h" 8 | 9 | namespace epoll 10 | { 11 | 12 | class EpollEvent : public IEvent 13 | { 14 | public: 15 | EpollEvent(): epollCreateSize(16) 16 | { 17 | initEvent(); 18 | } 19 | EpollEvent( int createSize_ ) 20 | { 21 | if( createSize_ < 16 ) createSize_ = 16; 22 | epollCreateSize = createSize_; 23 | initEvent(); 24 | } 25 | 26 | virtual int addEvent( const Event &event ); 27 | virtual int delEvent( const Event &event ); 28 | virtual int dispatcher(); 29 | 30 | private: 31 | int initEvent() 32 | { 33 | int epollFd = epoll_create( this->epollCreateSize ); 34 | if( epollFd <= 0 ){ 35 | std::cerr<<"epoll create error ..."<epollFd = epollFd; 39 | return true; 40 | } 41 | int epollCreateSize; 42 | int epollFd; 43 | std::map events; 44 | }; 45 | 46 | } 47 | 48 | #endif 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /time_synchronize/main.cpp: -------------------------------------------------------------------------------- 1 | #include "time_synchronize.h" 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | time_manage::Synchronize> sync_list; 9 | 10 | void testThread1() 11 | { 12 | float cnt = 0; 13 | 14 | while ( 1 ) { 15 | auto stamp = time_manage::TimeManage::getTimeStamp(); 16 | Eigen::Vector2f data( cnt, cnt ); 17 | std::cout<<"thread 1 stamp : "< 5 | #include 6 | #include 7 | #include "IEvent.h" 8 | 9 | namespace epoll 10 | { 11 | 12 | class EpollEvent : public IEvent 13 | { 14 | public: 15 | EpollEvent(): epollCreateSize(16) 16 | { 17 | initEvent(); 18 | } 19 | EpollEvent( int createSize_ ) 20 | { 21 | if( createSize_ < 16 ) createSize_ = 16; 22 | epollCreateSize = createSize_; 23 | initEvent(); 24 | } 25 | 26 | virtual int addEvent( const Event &event ); 27 | virtual int delEvent( const Event &event ); 28 | virtual int dispatcher(); 29 | 30 | private: 31 | int initEvent() 32 | { 33 | int epollFd = epoll_create( this->epollCreateSize ); 34 | if( epollFd <= 0 ){ 35 | std::cerr<<"epoll create error ..."<epollFd = epollFd; 39 | return true; 40 | } 41 | int epollCreateSize; 42 | int epollFd; 43 | std::map events; 44 | }; 45 | 46 | } 47 | 48 | #endif 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /robot_navigation_local_path_planning/include/common/EpollEvent.h: -------------------------------------------------------------------------------- 1 | #ifndef __EPOLLEVENT_H_ 2 | #define __EPOLLEVENT_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include "IEvent.h" 8 | 9 | namespace epoll 10 | { 11 | 12 | class EpollEvent : public IEvent 13 | { 14 | public: 15 | EpollEvent(): epollCreateSize(16) 16 | { 17 | initEvent(); 18 | } 19 | EpollEvent( int createSize_ ) 20 | { 21 | if( createSize_ < 16 ) createSize_ = 16; 22 | epollCreateSize = createSize_; 23 | initEvent(); 24 | } 25 | 26 | virtual int addEvent( const Event &event ); 27 | virtual int delEvent( const Event &event ); 28 | virtual int dispatcher(); 29 | 30 | private: 31 | int initEvent() 32 | { 33 | int epollFd = epoll_create( this->epollCreateSize ); 34 | if( epollFd <= 0 ){ 35 | std::cerr<<"epoll create error ..."<epollFd = epollFd; 39 | return true; 40 | } 41 | int epollCreateSize; 42 | int epollFd; 43 | std::map events; 44 | }; 45 | 46 | } 47 | 48 | #endif 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /apf_planner/include/obstacles.h: -------------------------------------------------------------------------------- 1 | #ifndef __OBSTACLES_H 2 | #define __OBSTACLES_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace apf 9 | { 10 | 11 | template 12 | class Obstacles 13 | { 14 | public: 15 | using value_type = T; 16 | using PoseType = typename Eigen::Matrix; 17 | 18 | Obstacles() 19 | { 20 | 21 | } 22 | 23 | ~Obstacles() 24 | { 25 | 26 | } 27 | 28 | void addObstacle( const PoseType& pose ) 29 | { 30 | return obstacles.push_back( pose ); 31 | } 32 | 33 | void clearAll() 34 | { 35 | return obstacles.clear(); 36 | } 37 | 38 | const std::vector& getObstacles() const 39 | { 40 | return obstacles; 41 | } 42 | 43 | void updateObstacles( const std::vector& obs ) 44 | { 45 | obstacles = obs; 46 | } 47 | 48 | const int getSize() const 49 | { 50 | return obstacles.size(); 51 | } 52 | 53 | const PoseType& operator[]( const int i ) const 54 | { 55 | return obstacles[i]; 56 | } 57 | 58 | const bool isEmpty() const 59 | { 60 | return obstacles.empty(); 61 | } 62 | 63 | private: 64 | std::vector obstacles; 65 | }; 66 | 67 | } 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/build/CMakeFiles/slam_test.dir/DependInfo.cmake: -------------------------------------------------------------------------------- 1 | # The set of languages for which implicit dependencies are needed: 2 | set(CMAKE_DEPENDS_LANGUAGES 3 | "CXX" 4 | ) 5 | # The set of files for implicit dependencies of each language: 6 | set(CMAKE_DEPENDS_CHECK_CXX 7 | "/groupdata/share/ddf/Test/robot_test/robot_projects/loop_closure_detection_simulation/slam_test.cpp" "/groupdata/share/ddf/Test/robot_test/robot_projects/loop_closure_detection_simulation/build/CMakeFiles/slam_test.dir/slam_test.cpp.o" 8 | "/groupdata/share/ddf/Test/robot_test/robot_projects/loop_closure_detection_simulation/src/laserSimulation.cpp" "/groupdata/share/ddf/Test/robot_test/robot_projects/loop_closure_detection_simulation/build/CMakeFiles/slam_test.dir/src/laserSimulation.cpp.o" 9 | ) 10 | set(CMAKE_CXX_COMPILER_ID "GNU") 11 | 12 | # The include file search paths: 13 | set(CMAKE_CXX_TARGET_INCLUDE_PATH 14 | "/usr/include/eigen3" 15 | "../include" 16 | "/usr/local/include/opencv" 17 | ) 18 | 19 | # Targets to which this target links. 20 | set(CMAKE_TARGET_LINKED_INFO_FILES 21 | ) 22 | 23 | # Fortran module output directory. 24 | set(CMAKE_Fortran_TARGET_MODULE_DIR "") 25 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/include/obstacles.h: -------------------------------------------------------------------------------- 1 | #ifndef __OBSTACLES_H 2 | #define __OBSTACLES_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace apf 9 | { 10 | 11 | template 12 | class Obstacles 13 | { 14 | public: 15 | using value_type = T; 16 | using PoseType = typename Eigen::Matrix; 17 | 18 | Obstacles() 19 | { 20 | 21 | } 22 | 23 | ~Obstacles() 24 | { 25 | 26 | } 27 | 28 | void addObstacle( const PoseType& pose ) 29 | { 30 | return obstacles.push_back( pose ); 31 | } 32 | 33 | void clearAll() 34 | { 35 | return obstacles.clear(); 36 | } 37 | 38 | const std::vector& getObstacles() const 39 | { 40 | return obstacles; 41 | } 42 | 43 | void updateObstacles( const std::vector& obs ) 44 | { 45 | obstacles = obs; 46 | } 47 | 48 | const int getSize() const 49 | { 50 | return obstacles.size(); 51 | } 52 | 53 | const PoseType& operator[]( const int i ) const 54 | { 55 | return obstacles[i]; 56 | } 57 | 58 | const bool isEmpty() const 59 | { 60 | return obstacles.empty(); 61 | } 62 | 63 | private: 64 | std::vector obstacles; 65 | }; 66 | 67 | } 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /navigation_global_path_planning_simulation/include/obstacles.h: -------------------------------------------------------------------------------- 1 | #ifndef __OBSTACLES_H 2 | #define __OBSTACLES_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace apf 9 | { 10 | 11 | template 12 | class Obstacles 13 | { 14 | public: 15 | using value_type = T; 16 | using PoseType = typename Eigen::Matrix; 17 | 18 | Obstacles() 19 | { 20 | 21 | } 22 | 23 | ~Obstacles() 24 | { 25 | 26 | } 27 | 28 | void addObstacle( const PoseType& pose ) 29 | { 30 | return obstacles.push_back( pose ); 31 | } 32 | 33 | void clearAll() 34 | { 35 | return obstacles.clear(); 36 | } 37 | 38 | const std::vector& getObstacles() const 39 | { 40 | return obstacles; 41 | } 42 | 43 | void updateObstacles( const std::vector& obs ) 44 | { 45 | obstacles = obs; 46 | } 47 | 48 | const int getSize() const 49 | { 50 | return obstacles.size(); 51 | } 52 | 53 | const PoseType& operator[]( const int i ) const 54 | { 55 | return obstacles[i]; 56 | } 57 | 58 | const bool isEmpty() const 59 | { 60 | return obstacles.empty(); 61 | } 62 | 63 | private: 64 | std::vector obstacles; 65 | }; 66 | 67 | } 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /navigation_local_path_planning_simulation/include/obstacles.h: -------------------------------------------------------------------------------- 1 | #ifndef __OBSTACLES_H 2 | #define __OBSTACLES_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace apf 9 | { 10 | 11 | template 12 | class Obstacles 13 | { 14 | public: 15 | using value_type = T; 16 | using PoseType = typename Eigen::Matrix; 17 | 18 | Obstacles() 19 | { 20 | 21 | } 22 | 23 | ~Obstacles() 24 | { 25 | 26 | } 27 | 28 | void addObstacle( const PoseType& pose ) 29 | { 30 | return obstacles.push_back( pose ); 31 | } 32 | 33 | void clearAll() 34 | { 35 | return obstacles.clear(); 36 | } 37 | 38 | const std::vector& getObstacles() const 39 | { 40 | return obstacles; 41 | } 42 | 43 | void updateObstacles( const std::vector& obs ) 44 | { 45 | obstacles = obs; 46 | } 47 | 48 | const int getSize() const 49 | { 50 | return obstacles.size(); 51 | } 52 | 53 | const PoseType& operator[]( const int i ) const 54 | { 55 | return obstacles[i]; 56 | } 57 | 58 | const bool isEmpty() const 59 | { 60 | return obstacles.empty(); 61 | } 62 | 63 | private: 64 | std::vector obstacles; 65 | }; 66 | 67 | } 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /dnn_body_detect/src/main.cpp_cpy2: -------------------------------------------------------------------------------- 1 | #include "body_detect.h" 2 | 3 | int main() 4 | { 5 | std::cout<<"---------------- BODY DETECT ---------------"<> frame; 21 | 22 | if( cv::waitKey(40) == 'q' ){ 23 | break; 24 | } 25 | 26 | cv::resize( frame, frame, cv::Size( 960, 544 ) ); 27 | cv::flip( frame, frame, 0 ); 28 | 29 | detect.imageProcess( frame ); 30 | detect.displayResults( frame ); 31 | cv::imshow( "ret", frame ); 32 | 33 | } 34 | */ 35 | 36 | cv::Mat frame = cv::imread( "/home/sunrise/workstation/sunrise_bpu/dnn_body_detect/test_data/3.jpg" ); 37 | 38 | cv::resize( frame, frame, cv::Size( 960, 544 ) ); 39 | 40 | detect.imageProcess( frame ); 41 | detect.displayResults( frame ); 42 | cv::imshow( "ret", frame ); 43 | cv::waitKey( 0 ); 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /robot_navigation_global_path_planing/include/path_planner/obstacles.h: -------------------------------------------------------------------------------- 1 | #ifndef __OBSTACLES_H 2 | #define __OBSTACLES_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace apf 9 | { 10 | 11 | template 12 | class Obstacles 13 | { 14 | public: 15 | using value_type = T; 16 | using PoseType = typename Eigen::Matrix; 17 | 18 | Obstacles() 19 | { 20 | 21 | } 22 | 23 | ~Obstacles() 24 | { 25 | 26 | } 27 | 28 | void addObstacle( const PoseType& pose ) 29 | { 30 | return obstacles.push_back( pose ); 31 | } 32 | 33 | void clearAll() 34 | { 35 | return obstacles.clear(); 36 | } 37 | 38 | const std::vector& getObstacles() const 39 | { 40 | return obstacles; 41 | } 42 | 43 | void updateObstacles( const std::vector& obs ) 44 | { 45 | obstacles = obs; 46 | } 47 | 48 | const int getSize() const 49 | { 50 | return obstacles.size(); 51 | } 52 | 53 | const PoseType& operator[]( const int i ) const 54 | { 55 | return obstacles[i]; 56 | } 57 | 58 | const bool isEmpty() const 59 | { 60 | return obstacles.empty(); 61 | } 62 | 63 | private: 64 | std::vector obstacles; 65 | }; 66 | 67 | } 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /robot_navigation_local_path_planning/include/path_planner/obstacles.h: -------------------------------------------------------------------------------- 1 | #ifndef __OBSTACLES_H 2 | #define __OBSTACLES_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace apf 9 | { 10 | 11 | template 12 | class Obstacles 13 | { 14 | public: 15 | using value_type = T; 16 | using PoseType = typename Eigen::Matrix; 17 | 18 | Obstacles() 19 | { 20 | 21 | } 22 | 23 | ~Obstacles() 24 | { 25 | 26 | } 27 | 28 | void addObstacle( const PoseType& pose ) 29 | { 30 | return obstacles.push_back( pose ); 31 | } 32 | 33 | void clearAll() 34 | { 35 | return obstacles.clear(); 36 | } 37 | 38 | const std::vector& getObstacles() const 39 | { 40 | return obstacles; 41 | } 42 | 43 | void updateObstacles( const std::vector& obs ) 44 | { 45 | obstacles = obs; 46 | } 47 | 48 | const int getSize() const 49 | { 50 | return obstacles.size(); 51 | } 52 | 53 | const PoseType& operator[]( const int i ) const 54 | { 55 | return obstacles[i]; 56 | } 57 | 58 | const bool isEmpty() const 59 | { 60 | return obstacles.empty(); 61 | } 62 | 63 | private: 64 | std::vector obstacles; 65 | }; 66 | 67 | } 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /dnn_body_detect/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 3.16.1) 2 | 3 | PROJECT(body_detect) 4 | 5 | # Default to C++14 6 | if(NOT CMAKE_CXX_STANDARD) 7 | SET(CMAKE_CXX_STANDARD 14) 8 | endif() 9 | 10 | ADD_COMPILE_OPTIONS(-Wall -Wextra -Wpedantic) 11 | 12 | INCLUDE_DIRECTORIES(include include/util/) 13 | 14 | INCLUDE_DIRECTORIES(include ${PROJECT_SOURCE_DIR}) 15 | 16 | SET(SYS_ROOT ${CMAKE_SYSROOT}) 17 | MESSAGE("SYS_ROOT : " ${SYS_ROOT}) 18 | 19 | LINK_DIRECTORIES(${SYS_ROOT}/usr/lib/hbbpu/) 20 | 21 | #find required opencv 22 | FIND_PACKAGE( OpenCV REQUIRED ) 23 | 24 | #directory of opencv headers 25 | INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) 26 | 27 | AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/src/ src_file) 28 | 29 | #directory of opencv link libs 30 | LINK_DIRECTORIES(${OpenCV_LIBRARY_DIRS}) 31 | 32 | LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/lib/) 33 | 34 | ADD_EXECUTABLE( body_detect ${src_file} ) 35 | 36 | TARGET_LINK_LIBRARIES( body_detect ${OpenCV_LIBS} ) 37 | 38 | TARGET_LINK_LIBRARIES( body_detect libdnn_node.so ) 39 | 40 | TARGET_LINK_LIBRARIES( body_detect 41 | alog 42 | hlog 43 | easy_dnn 44 | dnn 45 | cnn_intf 46 | ion 47 | hbrt_bernoulli_aarch64 ) 48 | -------------------------------------------------------------------------------- /odometry/include/visualize.h: -------------------------------------------------------------------------------- 1 | #ifndef __VISUALIZE_H 2 | #define __VISUALIZE_H 3 | 4 | #include 5 | #include 6 | 7 | namespace visualize 8 | { 9 | 10 | class Visualization 11 | { 12 | public: 13 | Visualization() 14 | { 15 | mapInit(); 16 | } 17 | 18 | Visualization( const int width, const int height ) : map_width_( width ), map_height_( height ) 19 | { 20 | mapInit(); 21 | } 22 | 23 | ~Visualization() 24 | { 25 | 26 | } 27 | 28 | template 29 | void setOdometryPose( const Eigen::Matrix& pose ) 30 | { 31 | cv::circle(map_, cv::Point2f(map_width_ / 2 - static_cast(pose[0]) * scale_, map_height_ / 2 - static_cast(pose[1]) * scale_), 3, cv::Scalar(0, 0, 255), -1); 32 | } 33 | 34 | void onMapDisplay() 35 | { 36 | cv::imshow( "map", map_ ); 37 | cv::waitKey(5); 38 | } 39 | 40 | void resetMap() 41 | { 42 | map_ = cv::Mat::zeros( map_width_, map_height_, CV_8UC3 ); 43 | } 44 | 45 | private: 46 | void mapInit() 47 | { 48 | map_ = cv::Mat::zeros( map_width_, map_height_, CV_8UC3 ); 49 | } 50 | 51 | private: 52 | cv::Mat map_; 53 | int map_width_ = 800; 54 | int map_height_ = 800; 55 | const float scale_ = 400; 56 | }; 57 | 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /robot_slam/include/odom/visualize.h: -------------------------------------------------------------------------------- 1 | #ifndef __VISUALIZE_H 2 | #define __VISUALIZE_H 3 | 4 | #include 5 | #include 6 | 7 | namespace visualize 8 | { 9 | 10 | class Visualization 11 | { 12 | public: 13 | Visualization() 14 | { 15 | mapInit(); 16 | } 17 | 18 | Visualization( const int width, const int height ) : map_width_( width ), map_height_( height ) 19 | { 20 | mapInit(); 21 | } 22 | 23 | ~Visualization() 24 | { 25 | 26 | } 27 | 28 | template 29 | void setOdometryPose( const Eigen::Matrix& pose ) 30 | { 31 | cv::circle(map_, cv::Point2f(map_width_ / 2 - static_cast(pose[0]) * scale_, map_height_ / 2 - static_cast(pose[1]) * scale_), 3, cv::Scalar(0, 0, 255), -1); 32 | } 33 | 34 | void onMapDisplay() 35 | { 36 | cv::imshow( "map", map_ ); 37 | cv::waitKey(5); 38 | } 39 | 40 | void resetMap() 41 | { 42 | map_ = cv::Mat::zeros( map_width_, map_height_, CV_8UC3 ); 43 | } 44 | 45 | private: 46 | void mapInit() 47 | { 48 | map_ = cv::Mat::zeros( map_width_, map_height_, CV_8UC3 ); 49 | } 50 | 51 | private: 52 | cv::Mat map_; 53 | int map_width_ = 800; 54 | int map_height_ = 800; 55 | const float scale_ = 400; 56 | }; 57 | 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /tele_control/include/visualize.h: -------------------------------------------------------------------------------- 1 | #ifndef __VISUALIZE_H 2 | #define __VISUALIZE_H 3 | 4 | #include 5 | #include 6 | 7 | namespace visualize 8 | { 9 | 10 | class Visualization 11 | { 12 | public: 13 | Visualization() 14 | { 15 | mapInit(); 16 | } 17 | 18 | Visualization( const int width, const int height ) : map_width_( width ), map_height_( height ) 19 | { 20 | mapInit(); 21 | } 22 | 23 | ~Visualization() 24 | { 25 | 26 | } 27 | 28 | template 29 | void setOdometryPose( const Eigen::Matrix& pose ) 30 | { 31 | cv::circle(map_, cv::Point2f(map_width_ / 2 - static_cast(pose[0]) * scale_, map_height_ / 2 - static_cast(pose[1]) * scale_), 3, cv::Scalar(0, 0, 255), -1); 32 | } 33 | 34 | void onMapDisplay() 35 | { 36 | cv::imshow( "map", map_ ); 37 | cv::waitKey(5); 38 | } 39 | 40 | void resetMap() 41 | { 42 | map_ = cv::Mat::zeros( map_width_, map_height_, CV_8UC3 ); 43 | } 44 | 45 | private: 46 | void mapInit() 47 | { 48 | map_ = cv::Mat::zeros( map_width_, map_height_, CV_8UC3 ); 49 | } 50 | 51 | private: 52 | cv::Mat map_; 53 | int map_width_ = 800; 54 | int map_height_ = 800; 55 | const float scale_ = 400; 56 | }; 57 | 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /robot_navigation_global_path_planing/include/odom/visualize.h: -------------------------------------------------------------------------------- 1 | #ifndef __VISUALIZE_H 2 | #define __VISUALIZE_H 3 | 4 | #include 5 | #include 6 | 7 | namespace visualize 8 | { 9 | 10 | class Visualization 11 | { 12 | public: 13 | Visualization() 14 | { 15 | mapInit(); 16 | } 17 | 18 | Visualization( const int width, const int height ) : map_width_( width ), map_height_( height ) 19 | { 20 | mapInit(); 21 | } 22 | 23 | ~Visualization() 24 | { 25 | 26 | } 27 | 28 | template 29 | void setOdometryPose( const Eigen::Matrix& pose ) 30 | { 31 | cv::circle(map_, cv::Point2f(map_width_ / 2 - static_cast(pose[0]) * scale_, map_height_ / 2 - static_cast(pose[1]) * scale_), 3, cv::Scalar(0, 0, 255), -1); 32 | } 33 | 34 | void onMapDisplay() 35 | { 36 | cv::imshow( "map", map_ ); 37 | cv::waitKey(5); 38 | } 39 | 40 | void resetMap() 41 | { 42 | map_ = cv::Mat::zeros( map_width_, map_height_, CV_8UC3 ); 43 | } 44 | 45 | private: 46 | void mapInit() 47 | { 48 | map_ = cv::Mat::zeros( map_width_, map_height_, CV_8UC3 ); 49 | } 50 | 51 | private: 52 | cv::Mat map_; 53 | int map_width_ = 800; 54 | int map_height_ = 800; 55 | const float scale_ = 400; 56 | }; 57 | 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /robot_navigation_local_path_planning/include/odom/visualize.h: -------------------------------------------------------------------------------- 1 | #ifndef __VISUALIZE_H 2 | #define __VISUALIZE_H 3 | 4 | #include 5 | #include 6 | 7 | namespace visualize 8 | { 9 | 10 | class Visualization 11 | { 12 | public: 13 | Visualization() 14 | { 15 | mapInit(); 16 | } 17 | 18 | Visualization( const int width, const int height ) : map_width_( width ), map_height_( height ) 19 | { 20 | mapInit(); 21 | } 22 | 23 | ~Visualization() 24 | { 25 | 26 | } 27 | 28 | template 29 | void setOdometryPose( const Eigen::Matrix& pose ) 30 | { 31 | cv::circle(map_, cv::Point2f(map_width_ / 2 - static_cast(pose[0]) * scale_, map_height_ / 2 - static_cast(pose[1]) * scale_), 3, cv::Scalar(0, 0, 255), -1); 32 | } 33 | 34 | void onMapDisplay() 35 | { 36 | cv::imshow( "map", map_ ); 37 | cv::waitKey(5); 38 | } 39 | 40 | void resetMap() 41 | { 42 | map_ = cv::Mat::zeros( map_width_, map_height_, CV_8UC3 ); 43 | } 44 | 45 | private: 46 | void mapInit() 47 | { 48 | map_ = cv::Mat::zeros( map_width_, map_height_, CV_8UC3 ); 49 | } 50 | 51 | private: 52 | cv::Mat map_; 53 | int map_width_ = 800; 54 | int map_height_ = 800; 55 | const float scale_ = 400; 56 | }; 57 | 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /bottom_control_board/motor_pid_velocity_control/pid.cpp: -------------------------------------------------------------------------------- 1 | #include "pid.h" 2 | 3 | PID::PID() : dt_( 0.05 ), max_( 255 ), min_(-255), kp_(10), kd_(0), ki_(1.1) 4 | { 5 | 6 | } 7 | 8 | PID::PID( const float dt, const float max, const float min, const float kp, const float ki, const float kd ) 9 | : dt_(dt), max_(max), min_(min), kp_(kp_), ki_(ki), kd_(kd) 10 | { 11 | 12 | } 13 | 14 | PID::~PID() 15 | { 16 | 17 | } 18 | 19 | const float PID::caculate( const float& target, const float& current ) 20 | { 21 | // error 22 | float error = target - current; 23 | 24 | // Proportional 25 | float p_out = kp_ * error; 26 | 27 | // Integral 28 | integral_ += error; 29 | if( target == 0 && error == 0 ){ 30 | integral_ = 0; 31 | } 32 | 33 | float i_out = ki_ * integral_; 34 | 35 | // Derivative 36 | float derivative = ( error - pre_error_ ); 37 | float d_out = kd_ * derivative; 38 | 39 | // total output 40 | float out = p_out + i_out + d_out; 41 | 42 | // limit 43 | if( out > max_ ){ 44 | out = max_; 45 | } 46 | else if( out < min_ ){ 47 | out = min_; 48 | } 49 | 50 | // update the pre_error 51 | pre_error_ = error; 52 | 53 | return out; 54 | } 55 | -------------------------------------------------------------------------------- /dnn_body_detect/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "body_detect.h" 2 | #include "data_transport.h" 3 | 4 | transport::Sender images_sender( "192.168.3.27", 2400 ); 5 | 6 | int main() 7 | { 8 | std::cout<<"---------------- BODY DETECT ---------------"<> frame; 24 | 25 | if( cv::waitKey(40) == 'q' ){ 26 | break; 27 | } 28 | 29 | cv::resize( frame, frame, cv::Size( 960, 544 ) ); 30 | cv::flip( frame, frame, 0 ); 31 | 32 | detect.imageProcess( frame ); 33 | detect.displayResults( frame ); 34 | //cv::imshow( "ret", frame ); 35 | 36 | std::vector vec; 37 | std::vector params; 38 | 39 | params.push_back(cv::IMWRITE_JPEG_QUALITY); 40 | params.push_back( 50 ); 41 | cv::imencode( ".jpg", frame, vec, params ); 42 | 43 | std::cout<<"encoded size = "< 11 | struct KdTreeObstaclesEigenAdaptor 12 | { 13 | using coord_t = typename Derived::value_type; 14 | 15 | const Derived& obj_; 16 | 17 | KdTreeObstaclesEigenAdaptor() = delete; 18 | 19 | KdTreeObstaclesEigenAdaptor( const Derived& obj ) : obj_( obj ) 20 | { 21 | 22 | } 23 | 24 | inline const Derived& derived() const 25 | { 26 | return obj_; 27 | } 28 | 29 | inline size_t kdtree_get_point_count() const 30 | { 31 | return derived().getSize(); 32 | } 33 | 34 | inline coord_t kdtree_get_pt( const size_t idx, const size_t dim ) const 35 | { 36 | return derived()[idx]( dim ); 37 | } 38 | 39 | template 40 | bool kdtree_get_bbox( BBOX& ) const 41 | { 42 | return false; 43 | } 44 | }; 45 | 46 | template 47 | using KdTreeObstaclesType = KdTreeObstaclesEigenAdaptor>; 48 | 49 | template 50 | using KdTreeType = nanoflann::KDTreeSingleIndexAdaptor>, KdTreeObstaclesType, 2>; 51 | 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /navigation_local_path_planning_simulation/include/kdtree_obstacles_eigen_adaptor.h: -------------------------------------------------------------------------------- 1 | #ifndef __KDTREE_OBSTACLES_EIGEN_ADAPTOR_H 2 | #define __KDTREE_OBSTACLES_EIGEN_ADAPTOR_H 3 | 4 | #include "nanoflann.hpp" 5 | #include "obstacles.h" 6 | 7 | namespace kdtree 8 | { 9 | 10 | template 11 | struct KdTreeObstaclesEigenAdaptor 12 | { 13 | using coord_t = typename Derived::value_type; 14 | 15 | const Derived& obj_; 16 | 17 | KdTreeObstaclesEigenAdaptor() = delete; 18 | 19 | KdTreeObstaclesEigenAdaptor( const Derived& obj ) : obj_( obj ) 20 | { 21 | 22 | } 23 | 24 | inline const Derived& derived() const 25 | { 26 | return obj_; 27 | } 28 | 29 | inline size_t kdtree_get_point_count() const 30 | { 31 | return derived().getSize(); 32 | } 33 | 34 | inline coord_t kdtree_get_pt( const size_t idx, const size_t dim ) const 35 | { 36 | return derived()[idx]( dim ); 37 | } 38 | 39 | template 40 | bool kdtree_get_bbox( BBOX& ) const 41 | { 42 | return false; 43 | } 44 | }; 45 | 46 | template 47 | using KdTreeObstaclesType = KdTreeObstaclesEigenAdaptor>; 48 | 49 | template 50 | using KdTreeType = nanoflann::KDTreeSingleIndexAdaptor>, KdTreeObstaclesType, 2>; 51 | 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /navigation_global_path_planning_simulation/include/kdtree_obstacles_eigen_adaptor.h: -------------------------------------------------------------------------------- 1 | #ifndef __KDTREE_OBSTACLES_EIGEN_ADAPTOR_H 2 | #define __KDTREE_OBSTACLES_EIGEN_ADAPTOR_H 3 | 4 | #include "nanoflann.hpp" 5 | #include "obstacles.h" 6 | 7 | namespace kdtree 8 | { 9 | 10 | template 11 | struct KdTreeObstaclesEigenAdaptor 12 | { 13 | using coord_t = typename Derived::value_type; 14 | 15 | const Derived& obj_; 16 | 17 | KdTreeObstaclesEigenAdaptor() = delete; 18 | 19 | KdTreeObstaclesEigenAdaptor( const Derived& obj ) : obj_( obj ) 20 | { 21 | 22 | } 23 | 24 | inline const Derived& derived() const 25 | { 26 | return obj_; 27 | } 28 | 29 | inline size_t kdtree_get_point_count() const 30 | { 31 | return derived().getSize(); 32 | } 33 | 34 | inline coord_t kdtree_get_pt( const size_t idx, const size_t dim ) const 35 | { 36 | return derived()[idx]( dim ); 37 | } 38 | 39 | template 40 | bool kdtree_get_bbox( BBOX& ) const 41 | { 42 | return false; 43 | } 44 | }; 45 | 46 | template 47 | using KdTreeObstaclesType = KdTreeObstaclesEigenAdaptor>; 48 | 49 | template 50 | using KdTreeType = nanoflann::KDTreeSingleIndexAdaptor>, KdTreeObstaclesType, 2>; 51 | 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /robot_navigation_global_path_planing/include/common/kdtree_obstacles_eigen_adaptor.h: -------------------------------------------------------------------------------- 1 | #ifndef __KDTREE_OBSTACLES_EIGEN_ADAPTOR_H 2 | #define __KDTREE_OBSTACLES_EIGEN_ADAPTOR_H 3 | 4 | #include "nanoflann.hpp" 5 | #include "obstacles.h" 6 | 7 | namespace kdtree 8 | { 9 | 10 | template 11 | struct KdTreeObstaclesEigenAdaptor 12 | { 13 | using coord_t = typename Derived::value_type; 14 | 15 | const Derived& obj_; 16 | 17 | KdTreeObstaclesEigenAdaptor() = delete; 18 | 19 | KdTreeObstaclesEigenAdaptor( const Derived& obj ) : obj_( obj ) 20 | { 21 | 22 | } 23 | 24 | inline const Derived& derived() const 25 | { 26 | return obj_; 27 | } 28 | 29 | inline size_t kdtree_get_point_count() const 30 | { 31 | return derived().getSize(); 32 | } 33 | 34 | inline coord_t kdtree_get_pt( const size_t idx, const size_t dim ) const 35 | { 36 | return derived()[idx]( dim ); 37 | } 38 | 39 | template 40 | bool kdtree_get_bbox( BBOX& ) const 41 | { 42 | return false; 43 | } 44 | }; 45 | 46 | template 47 | using KdTreeObstaclesType = KdTreeObstaclesEigenAdaptor>; 48 | 49 | template 50 | using KdTreeType = nanoflann::KDTreeSingleIndexAdaptor>, KdTreeObstaclesType, 2>; 51 | 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /robot_navigation_local_path_planning/include/common/kdtree_obstacles_eigen_adaptor.h: -------------------------------------------------------------------------------- 1 | #ifndef __KDTREE_OBSTACLES_EIGEN_ADAPTOR_H 2 | #define __KDTREE_OBSTACLES_EIGEN_ADAPTOR_H 3 | 4 | #include "nanoflann.hpp" 5 | #include "obstacles.h" 6 | 7 | namespace kdtree 8 | { 9 | 10 | template 11 | struct KdTreeObstaclesEigenAdaptor 12 | { 13 | using coord_t = typename Derived::value_type; 14 | 15 | const Derived& obj_; 16 | 17 | KdTreeObstaclesEigenAdaptor() = delete; 18 | 19 | KdTreeObstaclesEigenAdaptor( const Derived& obj ) : obj_( obj ) 20 | { 21 | 22 | } 23 | 24 | inline const Derived& derived() const 25 | { 26 | return obj_; 27 | } 28 | 29 | inline size_t kdtree_get_point_count() const 30 | { 31 | return derived().getSize(); 32 | } 33 | 34 | inline coord_t kdtree_get_pt( const size_t idx, const size_t dim ) const 35 | { 36 | return derived()[idx]( dim ); 37 | } 38 | 39 | template 40 | bool kdtree_get_bbox( BBOX& ) const 41 | { 42 | return false; 43 | } 44 | }; 45 | 46 | template 47 | using KdTreeObstaclesType = KdTreeObstaclesEigenAdaptor>; 48 | 49 | template 50 | using KdTreeType = nanoflann::KDTreeSingleIndexAdaptor>, KdTreeObstaclesType, 2>; 51 | 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /icp_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED( VERSION 3.16 ) 2 | 3 | # Set a default build type if none was specified 4 | IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 5 | MESSAGE("Setting build type to 'RelWithDebInfo' as none was specified.") 6 | SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) 7 | # Set the possible values of build type for cmake-gui 8 | SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") 9 | ENDIF() 10 | 11 | 12 | # project name 13 | PROJECT( icp_test ) 14 | 15 | ADD_DEFINITIONS( -std=c++14 ) 16 | 17 | #find required eigen 18 | FIND_PACKAGE( Eigen3 ) 19 | 20 | #directory of eigen headers 21 | INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} ) 22 | 23 | #find required opencv 24 | FIND_PACKAGE( OpenCV REQUIRED ) 25 | 26 | #directory of opencv headers 27 | INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) 28 | 29 | AUX_SOURCE_DIRECTORY( ${PROJECT_SOURCE_DIR}/src src_file ) 30 | AUX_SOURCE_DIRECTORY( ${PROJECT_SOURCE_DIR} src_file ) 31 | 32 | INCLUDE_DIRECTORIES( "${PROJECT_SOURCE_DIR}/include" ) 33 | 34 | #directory of opencv link libs 35 | LINK_DIRECTORIES(${OpenCV_LIBRARY_DIRS}) 36 | 37 | ADD_EXECUTABLE( icp_test ${src_file} ) 38 | 39 | TARGET_LINK_LIBRARIES( icp_test ${OpenCV_LIBS} pthread ) 40 | 41 | -------------------------------------------------------------------------------- /jpeg_stream/main.cpp_cpy: -------------------------------------------------------------------------------- 1 | #include 2 | #include "image_utils.h" 3 | 4 | #include 5 | 6 | extern "C" { 7 | #include "sp_codec.h" 8 | #include "sp_sys.h" 9 | } 10 | 11 | char stream_buffer[960 * 544 * 3]; 12 | 13 | int main() 14 | { 15 | 16 | std::cout<<"--------------- ENCODER TEST ------------------"< 19 | #include 20 | #include 21 | 22 | #include "opencv2/core/mat.hpp" 23 | #include "opencv2/imgcodecs.hpp" 24 | #include "opencv2/imgproc.hpp" 25 | 26 | 27 | #define ALIGNED_2E(w, alignment) \ 28 | ((static_cast(w) + (alignment - 1U)) & (~(alignment - 1U))) 29 | #define ALIGN_4(w) ALIGNED_2E(w, 4U) 30 | #define ALIGN_8(w) ALIGNED_2E(w, 8U) 31 | #define ALIGN_16(w) ALIGNED_2E(w, 16U) 32 | #define ALIGN_64(w) ALIGNED_2E(w, 64U) 33 | 34 | class ImageUtils { 35 | public: 36 | static int32_t BGRToNv12(cv::Mat &bgr_mat, cv::Mat &img_nv12); 37 | }; 38 | 39 | #endif // MONO2D_DET_IMAGE_UTILS_H 40 | -------------------------------------------------------------------------------- /rtmp_stream/include/image_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022,Horizon Robotics. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef MONO2D_DET_IMAGE_UTILS_H 16 | #define MONO2D_DET_IMAGE_UTILS_H 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include "opencv2/core/mat.hpp" 23 | #include "opencv2/imgcodecs.hpp" 24 | #include "opencv2/imgproc.hpp" 25 | 26 | 27 | #define ALIGNED_2E(w, alignment) \ 28 | ((static_cast(w) + (alignment - 1U)) & (~(alignment - 1U))) 29 | #define ALIGN_4(w) ALIGNED_2E(w, 4U) 30 | #define ALIGN_8(w) ALIGNED_2E(w, 8U) 31 | #define ALIGN_16(w) ALIGNED_2E(w, 16U) 32 | #define ALIGN_64(w) ALIGNED_2E(w, 64U) 33 | 34 | class ImageUtils { 35 | public: 36 | static int32_t BGRToNv12(cv::Mat &bgr_mat, cv::Mat &img_nv12); 37 | }; 38 | 39 | #endif // MONO2D_DET_IMAGE_UTILS_H 40 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/include/apf_process.h: -------------------------------------------------------------------------------- 1 | #ifndef __APF_PROCESS_H 2 | #define __APF_PROCESS_H 3 | 4 | #include "apf.h" 5 | #include "utils.h" 6 | 7 | namespace apf 8 | { 9 | 10 | template 11 | class APFProcess 12 | { 13 | public: 14 | using DataType = T; 15 | using Vector2 = typename Eigen::Matrix; 16 | using Vector3 = typename Eigen::Matrix; 17 | 18 | APFProcess() 19 | { 20 | 21 | } 22 | 23 | ~APFProcess() 24 | { 25 | 26 | } 27 | 28 | void setTargetPose( const Vector2& target_pose ) 29 | { 30 | return apf_.setTargetPose( target_pose ); 31 | } 32 | 33 | // return ( force, direction ) 34 | const std::pair runApfOnce( const Vector2& robot_pose, 35 | const Obstacles& obstacles ) 36 | { 37 | // 1. attraction vector 38 | Vector2 f_att_vec = apf_.cacuFatt( robot_pose ); 39 | 40 | // 2. repulsion vector 41 | Vector2 f_rep_vec = apf_.cacuFrep( robot_pose, obstacles ); 42 | apf_.clearRepulsionVec1(); 43 | 44 | // 3. total force 45 | Vector2 f_total = f_att_vec + f_rep_vec; 46 | 47 | // 4. get target angle 48 | DataType target_theta = ::atan2( f_total[1], f_total[0] ); 49 | Utils::angleNormalize( target_theta ); 50 | 51 | return { f_total.norm() * force_scale, target_theta }; 52 | } 53 | 54 | private: 55 | APF apf_; 56 | const DataType force_scale = 0.1; 57 | }; 58 | 59 | } 60 | 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /navigation_local_path_planning_simulation/include/apf_process.h: -------------------------------------------------------------------------------- 1 | #ifndef __APF_PROCESS_H 2 | #define __APF_PROCESS_H 3 | 4 | #include "apf.h" 5 | #include "utils.h" 6 | 7 | namespace apf 8 | { 9 | 10 | template 11 | class APFProcess 12 | { 13 | public: 14 | using DataType = T; 15 | using Vector2 = typename Eigen::Matrix; 16 | using Vector3 = typename Eigen::Matrix; 17 | 18 | APFProcess() 19 | { 20 | 21 | } 22 | 23 | ~APFProcess() 24 | { 25 | 26 | } 27 | 28 | void setTargetPose( const Vector2& target_pose ) 29 | { 30 | return apf_.setTargetPose( target_pose ); 31 | } 32 | 33 | // return ( force, direction ) 34 | const std::pair runApfOnce( const Vector2& robot_pose, 35 | const Obstacles& obstacles ) 36 | { 37 | // 1. attraction vector 38 | Vector2 f_att_vec = apf_.cacuFatt( robot_pose ); 39 | 40 | // 2. repulsion vector 41 | Vector2 f_rep_vec = apf_.cacuFrep( robot_pose, obstacles ); 42 | apf_.clearRepulsionVec1(); 43 | 44 | // 3. total force 45 | Vector2 f_total = f_att_vec + f_rep_vec; 46 | 47 | // 4. get target angle 48 | DataType target_theta = ::atan2( f_total[1], f_total[0] ); 49 | Utils::angleNormalize( target_theta ); 50 | 51 | return { f_total.norm() * force_scale, target_theta }; 52 | } 53 | 54 | private: 55 | APF apf_; 56 | const DataType force_scale = 0.1; 57 | }; 58 | 59 | } 60 | 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /navigation_global_path_planning_simulation/include/apf_process.h: -------------------------------------------------------------------------------- 1 | #ifndef __APF_PROCESS_H 2 | #define __APF_PROCESS_H 3 | 4 | #include "apf.h" 5 | #include "utils.h" 6 | 7 | namespace apf 8 | { 9 | 10 | template 11 | class APFProcess 12 | { 13 | public: 14 | using DataType = T; 15 | using Vector2 = typename Eigen::Matrix; 16 | using Vector3 = typename Eigen::Matrix; 17 | 18 | APFProcess() 19 | { 20 | 21 | } 22 | 23 | ~APFProcess() 24 | { 25 | 26 | } 27 | 28 | void setTargetPose( const Vector2& target_pose ) 29 | { 30 | return apf_.setTargetPose( target_pose ); 31 | } 32 | 33 | // return ( force, direction ) 34 | const std::pair runApfOnce( const Vector2& robot_pose, 35 | const Obstacles& obstacles ) 36 | { 37 | // 1. attraction vector 38 | Vector2 f_att_vec = apf_.cacuFatt( robot_pose ); 39 | 40 | // 2. repulsion vector 41 | Vector2 f_rep_vec = apf_.cacuFrep( robot_pose, obstacles ); 42 | apf_.clearRepulsionVec1(); 43 | 44 | // 3. total force 45 | Vector2 f_total = f_att_vec + f_rep_vec; 46 | 47 | // 4. get target angle 48 | DataType target_theta = ::atan2( f_total[1], f_total[0] ); 49 | Utils::angleNormalize( target_theta ); 50 | 51 | return { f_total.norm() * force_scale, target_theta }; 52 | } 53 | 54 | private: 55 | APF apf_; 56 | const DataType force_scale = 0.1; 57 | }; 58 | 59 | } 60 | 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /robot_navigation_global_path_planing/include/path_planner/apf_process.h: -------------------------------------------------------------------------------- 1 | #ifndef __APF_PROCESS_H 2 | #define __APF_PROCESS_H 3 | 4 | #include "apf.h" 5 | #include "utils.h" 6 | 7 | namespace apf 8 | { 9 | 10 | template 11 | class APFProcess 12 | { 13 | public: 14 | using DataType = T; 15 | using Vector2 = typename Eigen::Matrix; 16 | using Vector3 = typename Eigen::Matrix; 17 | 18 | APFProcess() 19 | { 20 | 21 | } 22 | 23 | ~APFProcess() 24 | { 25 | 26 | } 27 | 28 | void setTargetPose( const Vector2& target_pose ) 29 | { 30 | return apf_.setTargetPose( target_pose ); 31 | } 32 | 33 | // return ( force, direction ) 34 | const std::pair runApfOnce( const Vector2& robot_pose, 35 | const Obstacles& obstacles ) 36 | { 37 | // 1. attraction vector 38 | Vector2 f_att_vec = apf_.cacuFatt( robot_pose ); 39 | 40 | // 2. repulsion vector 41 | Vector2 f_rep_vec = apf_.cacuFrep( robot_pose, obstacles ); 42 | apf_.clearRepulsionVec1(); 43 | 44 | // 3. total force 45 | Vector2 f_total = f_att_vec + f_rep_vec; 46 | 47 | // 4. get target angle 48 | DataType target_theta = ::atan2( f_total[1], f_total[0] ); 49 | Utils::angleNormalize( target_theta ); 50 | 51 | return { f_total.norm() * force_scale, target_theta }; 52 | } 53 | 54 | private: 55 | APF apf_; 56 | const DataType force_scale = 0.1; 57 | }; 58 | 59 | } 60 | 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /jpeg_stream/src/image_utils.cpp: -------------------------------------------------------------------------------- 1 | #include "image_utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | int32_t ImageUtils::BGRToNv12(cv::Mat &bgr_mat, cv::Mat &img_nv12) { 12 | auto height = bgr_mat.rows; 13 | auto width = bgr_mat.cols; 14 | 15 | if (height % 2 || width % 2) { 16 | std::cerr << "input img height and width must aligned by 2!"; 17 | return -1; 18 | } 19 | cv::Mat yuv_mat; 20 | cv::cvtColor(bgr_mat, yuv_mat, cv::COLOR_BGR2YUV_I420); 21 | if (yuv_mat.data == nullptr) { 22 | std::cerr << "yuv_mat.data is null pointer" << std::endl; 23 | return -1; 24 | } 25 | 26 | auto *yuv = yuv_mat.ptr(); 27 | if (yuv == nullptr) { 28 | std::cerr << "yuv is null pointer" << std::endl; 29 | return -1; 30 | } 31 | img_nv12 = cv::Mat(height * 3 / 2, width, CV_8UC1); 32 | auto *ynv12 = img_nv12.ptr(); 33 | 34 | int32_t uv_height = height / 2; 35 | int32_t uv_width = width / 2; 36 | 37 | // copy y data 38 | int32_t y_size = height * width; 39 | memcpy(ynv12, yuv, y_size); 40 | 41 | // copy uv data 42 | uint8_t *nv12 = ynv12 + y_size; 43 | uint8_t *u_data = yuv + y_size; 44 | uint8_t *v_data = u_data + uv_height * uv_width; 45 | 46 | for (int32_t i = 0; i < uv_width * uv_height; i++) { 47 | *nv12++ = *u_data++; 48 | *nv12++ = *v_data++; 49 | } 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /rtmp_stream/src/image_utils.cpp: -------------------------------------------------------------------------------- 1 | #include "image_utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | int32_t ImageUtils::BGRToNv12(cv::Mat &bgr_mat, cv::Mat &img_nv12) { 12 | auto height = bgr_mat.rows; 13 | auto width = bgr_mat.cols; 14 | 15 | if (height % 2 || width % 2) { 16 | std::cerr << "input img height and width must aligned by 2!"; 17 | return -1; 18 | } 19 | cv::Mat yuv_mat; 20 | cv::cvtColor(bgr_mat, yuv_mat, cv::COLOR_BGR2YUV_I420); 21 | if (yuv_mat.data == nullptr) { 22 | std::cerr << "yuv_mat.data is null pointer" << std::endl; 23 | return -1; 24 | } 25 | 26 | auto *yuv = yuv_mat.ptr(); 27 | if (yuv == nullptr) { 28 | std::cerr << "yuv is null pointer" << std::endl; 29 | return -1; 30 | } 31 | img_nv12 = cv::Mat(height * 3 / 2, width, CV_8UC1); 32 | auto *ynv12 = img_nv12.ptr(); 33 | 34 | int32_t uv_height = height / 2; 35 | int32_t uv_width = width / 2; 36 | 37 | // copy y data 38 | int32_t y_size = height * width; 39 | memcpy(ynv12, yuv, y_size); 40 | 41 | // copy uv data 42 | uint8_t *nv12 = ynv12 + y_size; 43 | uint8_t *u_data = yuv + y_size; 44 | uint8_t *v_data = u_data + uv_height * uv_width; 45 | 46 | for (int32_t i = 0; i < uv_width * uv_height; i++) { 47 | *nv12++ = *u_data++; 48 | *nv12++ = *v_data++; 49 | } 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /m1c1_lidar_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 3.16) 2 | 3 | # Set a default build type if none was specified 4 | IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 5 | MESSAGE("Setting build type to 'RelWithDebInfo' as none was specified.") 6 | SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) 7 | # Set the possible values of build type for cmake-gui 8 | SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") 9 | ENDIF() 10 | 11 | 12 | PROJECT(lidar_test) 13 | 14 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") 15 | 16 | ADD_DEFINITIONS(-std=c++17) 17 | 18 | # include directories 19 | INCLUDE_DIRECTORIES( 20 | ${CMAKE_SOURCE_DIR} 21 | ${CMAKE_SOURCE_DIR}/include 22 | ${CMAKE_SOURCE_DIR}/include/lidar_include 23 | ${CMAKE_SOURCE_DIR}/src 24 | ) 25 | 26 | # eigen 27 | FIND_PACKAGE( Eigen3 ) 28 | 29 | # directory of eigen 30 | INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} ) 31 | 32 | # opencv 33 | FIND_PACKAGE( OpenCV REQUIRED ) 34 | 35 | # directory of opencv 36 | INCLUDE_DIRECTORIES( ${OpenCV_INCLUDE_DIRS} ) 37 | 38 | # opencv link directories 39 | LINK_DIRECTORIES( ${OpenCV_LIBRARIES_DIRS} ) 40 | 41 | # link directories 42 | LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib) 43 | 44 | SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}) 45 | 46 | ADD_EXECUTABLE(${PROJECT_NAME} ${CMAKE_SOURCE_DIR}/src/main.cpp) 47 | 48 | # link 49 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} libcspclidar_driver.a pthread) 50 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OpenCV_LIBS}) 51 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/include/pid.h: -------------------------------------------------------------------------------- 1 | #ifndef __PID_H 2 | #define __PID_H 3 | 4 | #include 5 | 6 | namespace pt 7 | { 8 | 9 | template 10 | class PID 11 | { 12 | public: 13 | using DataType = T; 14 | 15 | PID() = delete; 16 | 17 | PID(const DataType& dt, const DataType& max, const DataType& min, const DataType& kp, const DataType& ki, const DataType & kd) : 18 | dt_(dt), max_(max), min_(min), kp_(kp), ki_(ki), kd_(kd) 19 | { 20 | 21 | } 22 | 23 | ~PID() 24 | { 25 | 26 | } 27 | 28 | const DataType caculate(const DataType& target, const DataType& current) 29 | { 30 | // error 31 | DataType error = target - current; 32 | 33 | // Proportional 34 | DataType p_out = kp_ * error; 35 | 36 | // Integral 37 | integral_ += error * dt_; 38 | DataType i_out = ki_ * integral_; 39 | 40 | // Derivative 41 | DataType derivative = (error - pre_error_) / dt_; 42 | DataType d_out = kd_ * derivative; 43 | 44 | // total output 45 | DataType out = p_out + i_out + d_out; 46 | 47 | // limit 48 | if (out > max_) { 49 | out = max_; 50 | } 51 | else if (out < min_) { 52 | out = min_; 53 | } 54 | 55 | // update the pre_error 56 | pre_error_ = error; 57 | 58 | return out; 59 | } 60 | 61 | private: 62 | DataType dt_; 63 | DataType max_; 64 | DataType min_; 65 | DataType kp_; 66 | DataType ki_; 67 | DataType kd_; 68 | DataType pre_error_ = 0; 69 | DataType integral_ = 0; 70 | 71 | 72 | }; 73 | 74 | } 75 | 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /navigation_local_path_planning_simulation/include/pid.h: -------------------------------------------------------------------------------- 1 | #ifndef __PID_H 2 | #define __PID_H 3 | 4 | #include 5 | 6 | namespace pt 7 | { 8 | 9 | template 10 | class PID 11 | { 12 | public: 13 | using DataType = T; 14 | 15 | PID() = delete; 16 | 17 | PID(const DataType& dt, const DataType& max, const DataType& min, const DataType& kp, const DataType& ki, const DataType & kd) : 18 | dt_(dt), max_(max), min_(min), kp_(kp), ki_(ki), kd_(kd) 19 | { 20 | 21 | } 22 | 23 | ~PID() 24 | { 25 | 26 | } 27 | 28 | const DataType caculate(const DataType& target, const DataType& current) 29 | { 30 | // error 31 | DataType error = target - current; 32 | 33 | // Proportional 34 | DataType p_out = kp_ * error; 35 | 36 | // Integral 37 | integral_ += error * dt_; 38 | DataType i_out = ki_ * integral_; 39 | 40 | // Derivative 41 | DataType derivative = (error - pre_error_) / dt_; 42 | DataType d_out = kd_ * derivative; 43 | 44 | // total output 45 | DataType out = p_out + i_out + d_out; 46 | 47 | // limit 48 | if (out > max_) { 49 | out = max_; 50 | } 51 | else if (out < min_) { 52 | out = min_; 53 | } 54 | 55 | // update the pre_error 56 | pre_error_ = error; 57 | 58 | return out; 59 | } 60 | 61 | private: 62 | DataType dt_; 63 | DataType max_; 64 | DataType min_; 65 | DataType kp_; 66 | DataType ki_; 67 | DataType kd_; 68 | DataType pre_error_ = 0; 69 | DataType integral_ = 0; 70 | 71 | 72 | }; 73 | 74 | } 75 | 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /navigation_global_path_planning_simulation/include/pid.h: -------------------------------------------------------------------------------- 1 | #ifndef __PID_H 2 | #define __PID_H 3 | 4 | #include 5 | 6 | namespace pt 7 | { 8 | 9 | template 10 | class PID 11 | { 12 | public: 13 | using DataType = T; 14 | 15 | PID() = delete; 16 | 17 | PID(const DataType& dt, const DataType& max, const DataType& min, const DataType& kp, const DataType& ki, const DataType & kd) : 18 | dt_(dt), max_(max), min_(min), kp_(kp), ki_(ki), kd_(kd) 19 | { 20 | 21 | } 22 | 23 | ~PID() 24 | { 25 | 26 | } 27 | 28 | const DataType caculate(const DataType& target, const DataType& current) 29 | { 30 | // error 31 | DataType error = target - current; 32 | 33 | // Proportional 34 | DataType p_out = kp_ * error; 35 | 36 | // Integral 37 | integral_ += error * dt_; 38 | DataType i_out = ki_ * integral_; 39 | 40 | // Derivative 41 | DataType derivative = (error - pre_error_) / dt_; 42 | DataType d_out = kd_ * derivative; 43 | 44 | // total output 45 | DataType out = p_out + i_out + d_out; 46 | 47 | // limit 48 | if (out > max_) { 49 | out = max_; 50 | } 51 | else if (out < min_) { 52 | out = min_; 53 | } 54 | 55 | // update the pre_error 56 | pre_error_ = error; 57 | 58 | return out; 59 | } 60 | 61 | private: 62 | DataType dt_; 63 | DataType max_; 64 | DataType min_; 65 | DataType kp_; 66 | DataType ki_; 67 | DataType kd_; 68 | DataType pre_error_ = 0; 69 | DataType integral_ = 0; 70 | 71 | 72 | }; 73 | 74 | } 75 | 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /apf_planner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED( VERSION 3.16 ) 2 | 3 | # Set a default build type if none was specified 4 | IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 5 | MESSAGE("Setting build type to 'RelWithDebInfo' as none was specified.") 6 | SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) 7 | # Set the possible values of build type for cmake-gui 8 | SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") 9 | ENDIF() 10 | 11 | # project name 12 | PROJECT( apf_test ) 13 | 14 | ADD_DEFINITIONS( -std=c++17 ) 15 | 16 | #SET( EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin" ) 17 | 18 | # set the output directory of the libs 19 | SET( LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib" ) 20 | 21 | #find required eigen 22 | FIND_PACKAGE( Eigen3 ) 23 | 24 | #directory of eigen headers 25 | INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} ) 26 | 27 | #find required opencv 28 | FIND_PACKAGE( OpenCV REQUIRED ) 29 | 30 | #directory of opencv headers 31 | INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) 32 | 33 | AUX_SOURCE_DIRECTORY( ${PROJECT_SOURCE_DIR}/src src_file ) 34 | AUX_SOURCE_DIRECTORY( ${PROJECT_SOURCE_DIR} src_file ) 35 | 36 | INCLUDE_DIRECTORIES( "${PROJECT_SOURCE_DIR}/include" ) 37 | 38 | #directory of opencv link libs 39 | LINK_DIRECTORIES(${OpenCV_LIBRARY_DIRS}) 40 | 41 | # generate the lib files 42 | #ADD_LIBRARY( liteslam SHARED ${slam_src} ) 43 | 44 | #ADD_LIBRARY( liteslam_static STATIC ${slam_src} ) 45 | 46 | 47 | ADD_EXECUTABLE( ${PROJECT_NAME} ${src_file} ) 48 | 49 | TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${OpenCV_LIBS} ) 50 | 51 | -------------------------------------------------------------------------------- /global_planner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED( VERSION 3.16 ) 2 | 3 | # Set a default build type if none was specified 4 | IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 5 | MESSAGE("Setting build type to 'RelWithDebInfo' as none was specified.") 6 | SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) 7 | # Set the possible values of build type for cmake-gui 8 | SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") 9 | ENDIF() 10 | 11 | # project name 12 | PROJECT( apf_test ) 13 | 14 | ADD_DEFINITIONS( -std=c++17 ) 15 | 16 | #SET( EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin" ) 17 | 18 | # set the output directory of the libs 19 | SET( LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib" ) 20 | 21 | #find required eigen 22 | FIND_PACKAGE( Eigen3 ) 23 | 24 | #directory of eigen headers 25 | INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} ) 26 | 27 | #find required opencv 28 | FIND_PACKAGE( OpenCV REQUIRED ) 29 | 30 | #directory of opencv headers 31 | INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) 32 | 33 | AUX_SOURCE_DIRECTORY( ${PROJECT_SOURCE_DIR}/src src_file ) 34 | AUX_SOURCE_DIRECTORY( ${PROJECT_SOURCE_DIR} src_file ) 35 | 36 | INCLUDE_DIRECTORIES( "${PROJECT_SOURCE_DIR}/include" ) 37 | 38 | #directory of opencv link libs 39 | LINK_DIRECTORIES(${OpenCV_LIBRARY_DIRS}) 40 | 41 | # generate the lib files 42 | #ADD_LIBRARY( liteslam SHARED ${slam_src} ) 43 | 44 | #ADD_LIBRARY( liteslam_static STATIC ${slam_src} ) 45 | 46 | 47 | ADD_EXECUTABLE( ${PROJECT_NAME} ${src_file} ) 48 | 49 | TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${OpenCV_LIBS} ) 50 | 51 | -------------------------------------------------------------------------------- /2d_cluster_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED( VERSION 3.16 ) 2 | 3 | # Set a default build type if none was specified 4 | IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 5 | MESSAGE("Setting build type to 'RelWithDebInfo' as none was specified.") 6 | SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) 7 | # Set the possible values of build type for cmake-gui 8 | SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") 9 | ENDIF() 10 | 11 | # project name 12 | PROJECT( 2d_cluster ) 13 | 14 | ADD_DEFINITIONS( -std=c++17 ) 15 | 16 | #SET( EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin" ) 17 | 18 | # set the output directory of the libs 19 | SET( LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib" ) 20 | 21 | #find required eigen 22 | FIND_PACKAGE( Eigen3 ) 23 | 24 | #directory of eigen headers 25 | INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} ) 26 | 27 | #find required opencv 28 | FIND_PACKAGE( OpenCV REQUIRED ) 29 | 30 | #directory of opencv headers 31 | INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) 32 | 33 | AUX_SOURCE_DIRECTORY( ${PROJECT_SOURCE_DIR}/src src_file ) 34 | AUX_SOURCE_DIRECTORY( ${PROJECT_SOURCE_DIR} src_file ) 35 | 36 | INCLUDE_DIRECTORIES( "${PROJECT_SOURCE_DIR}/include" ) 37 | 38 | #directory of opencv link libs 39 | LINK_DIRECTORIES(${OpenCV_LIBRARY_DIRS}) 40 | 41 | # generate the lib files 42 | #ADD_LIBRARY( liteslam SHARED ${slam_src} ) 43 | 44 | #ADD_LIBRARY( liteslam_static STATIC ${slam_src} ) 45 | 46 | 47 | ADD_EXECUTABLE( ${PROJECT_NAME} ${src_file} ) 48 | 49 | TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${OpenCV_LIBS} ) 50 | 51 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/include/kdtree_vector_eigen_adaptor.h: -------------------------------------------------------------------------------- 1 | #ifndef __KDTREE_VECTOR_EIGEN_ADAPTOR_H 2 | #define __KDTREE_VECTOR_EIGEN_ADAPTOR_H 3 | 4 | #include "nanoflann.hpp" 5 | #include 6 | #include 7 | 8 | namespace slam 9 | { 10 | 11 | template 12 | struct KdTreeVectorEigenAdaptor 13 | { 14 | using coord_t = typename Derived::value_type::value_type; 15 | 16 | const Derived& obj_; 17 | 18 | KdTreeVectorEigenAdaptor() = delete; 19 | 20 | KdTreeVectorEigenAdaptor( const Derived& obj ) : obj_( obj ) 21 | { 22 | 23 | } 24 | 25 | inline const Derived& derived() const 26 | { 27 | return obj_; 28 | } 29 | 30 | inline size_t kdtree_get_point_count() const 31 | { 32 | return derived().size(); 33 | } 34 | 35 | inline coord_t kdtree_get_pt( const size_t idx, const size_t dim ) const 36 | { 37 | return derived()[idx]( dim ); 38 | } 39 | 40 | template 41 | bool kdtree_get_bbox( BBOX& ) const 42 | { 43 | return false; 44 | } 45 | 46 | }; 47 | 48 | template 49 | using VectorEigenType = typename std::vector>; 50 | 51 | template 52 | using KdTreeVectorEigenType = KdTreeVectorEigenAdaptor>; 53 | 54 | template 55 | using KdTreeType = nanoflann::KDTreeSingleIndexAdaptor>, KdTreeVectorEigenType, Dimension>; 56 | 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /slam_simu/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED( VERSION 3.16 ) 2 | 3 | # Set a default build type if none was specified 4 | IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 5 | MESSAGE("Setting build type to 'RelWithDebInfo' as none was specified.") 6 | SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) 7 | # Set the possible values of build type for cmake-gui 8 | SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") 9 | ENDIF() 10 | 11 | # project name 12 | PROJECT( lite_slam ) 13 | 14 | ADD_DEFINITIONS( -std=c++14 ) 15 | 16 | SET( EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin" ) 17 | 18 | # set the output directory of the libs 19 | SET( LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib" ) 20 | 21 | #find required eigen 22 | FIND_PACKAGE( Eigen3 ) 23 | 24 | #directory of eigen headers 25 | INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} ) 26 | 27 | #find required opencv 28 | FIND_PACKAGE( OpenCV REQUIRED ) 29 | 30 | #directory of opencv headers 31 | INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) 32 | 33 | AUX_SOURCE_DIRECTORY( ${PROJECT_SOURCE_DIR}/src src_file ) 34 | AUX_SOURCE_DIRECTORY( ${PROJECT_SOURCE_DIR} src_file ) 35 | 36 | INCLUDE_DIRECTORIES( "${PROJECT_SOURCE_DIR}/include" ) 37 | 38 | #directory of opencv link libs 39 | LINK_DIRECTORIES(${OpenCV_LIBRARY_DIRS}) 40 | 41 | # generate the lib files 42 | #ADD_LIBRARY( liteslam SHARED ${slam_src} ) 43 | 44 | #ADD_LIBRARY( liteslam_static STATIC ${slam_src} ) 45 | 46 | 47 | ADD_EXECUTABLE( slam_test ${src_file} ) 48 | 49 | TARGET_LINK_LIBRARIES( slam_test ${OpenCV_LIBS} ) 50 | 51 | #SET_TARGET_PROPERTIES( liteslam_static PROPERTIES OUTPUT_NAME "liteslam" ) 52 | -------------------------------------------------------------------------------- /dnn_body_detect/include/dnn_node/util/output_parser/detection/ptq_ssd_output_parser.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022,Horizon Robotics. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef _DETECTION_PTQ_SSD_OUTPUT_PARSER_H_ 16 | #define _DETECTION_PTQ_SSD_OUTPUT_PARSER_H_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "dnn/hb_dnn_ext.h" 24 | #include "dnn_node/dnn_node_data.h" 25 | #include "dnn_node/util/output_parser/perception_common.h" 26 | 27 | using hobot::dnn_node::output_parser::Anchor; 28 | using hobot::dnn_node::output_parser::Bbox; 29 | using hobot::dnn_node::output_parser::Detection; 30 | using hobot::dnn_node::output_parser::DnnParserResult; 31 | using hobot::dnn_node::output_parser::Perception; 32 | 33 | namespace hobot { 34 | namespace dnn_node { 35 | namespace parser_ssd { 36 | int32_t Parse( 37 | const std::shared_ptr &node_output, 38 | std::shared_ptr &output); 39 | 40 | } 41 | } // namespace dnn_node 42 | } // namespace hobot 43 | #endif // _DETECTION_PTQ_SSD_OUTPUT_PARSER_H_ 44 | -------------------------------------------------------------------------------- /dnn_body_detect/include/dnn_node/util/output_parser/detection/nms.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022,Horizon Robotics. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef _DETECTION_NMS_H_ 16 | #define _DETECTION_NMS_H_ 17 | 18 | #include 19 | 20 | #include "dnn_node/util/output_parser/perception_common.h" 21 | 22 | using hobot::dnn_node::output_parser::Detection; 23 | 24 | /** 25 | * Non-maximum suppression 26 | * @param[in] input 27 | * @param[in] iou_threshold 28 | * @param[in] top_k 29 | * @param[out] result 30 | * @param[in] suppress 31 | */ 32 | void nms(std::vector &input, 33 | float iou_threshold, 34 | int top_k, 35 | std::vector &result, 36 | bool suppress = false); 37 | 38 | /** 39 | * Non-maximum suppression 40 | * @param[in] input 41 | * @param[in] iou_threshold 42 | * @param[in] top_k 43 | * @param[out] result 44 | * @param[in] suppress 45 | */ 46 | void yolo5_nms(std::vector &input, 47 | float iou_threshold, 48 | int top_k, 49 | std::vector &result, 50 | bool suppress); 51 | 52 | #endif // _UTIL_NMS_H_ 53 | -------------------------------------------------------------------------------- /dnn_body_detect/include/dnn_node/util/output_parser/detection/fcos_output_parser.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022,Horizon Robotics. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef _DETECTION_FCOS_OUTPUT_PARSER_H 16 | #define _DETECTION_FCOS_OUTPUT_PARSER_H 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "rapidjson/document.h" 24 | 25 | #include "dnn/hb_dnn_ext.h" 26 | #include "dnn_node/dnn_node_data.h" 27 | #include "dnn_node/util/output_parser/perception_common.h" 28 | 29 | using hobot::dnn_node::output_parser::Bbox; 30 | using hobot::dnn_node::output_parser::Detection; 31 | using hobot::dnn_node::output_parser::DnnParserResult; 32 | using hobot::dnn_node::output_parser::Perception; 33 | 34 | namespace hobot { 35 | namespace dnn_node { 36 | namespace parser_fcos { 37 | int LoadConfig(const rapidjson::Document &document); 38 | 39 | int32_t Parse( 40 | const std::shared_ptr &node_output, 41 | std::shared_ptr &output); 42 | 43 | } // namespace parser_fcos 44 | } // namespace dnn_node 45 | } // namespace hobot 46 | #endif // _DETECTION_FCOS_OUTPUT_PARSER_H 47 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED( VERSION 3.16 ) 2 | 3 | # Set a default build type if none was specified 4 | IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 5 | MESSAGE("Setting build type to 'RelWithDebInfo' as none was specified.") 6 | SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) 7 | # Set the possible values of build type for cmake-gui 8 | SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") 9 | ENDIF() 10 | 11 | # project name 12 | PROJECT( lite_slam ) 13 | 14 | ADD_DEFINITIONS( -std=c++14 ) 15 | 16 | #SET( EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin" ) 17 | 18 | # set the output directory of the libs 19 | SET( LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib" ) 20 | 21 | #find required eigen 22 | FIND_PACKAGE( Eigen3 ) 23 | 24 | #directory of eigen headers 25 | INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} ) 26 | 27 | #find required opencv 28 | FIND_PACKAGE( OpenCV REQUIRED ) 29 | 30 | #directory of opencv headers 31 | INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) 32 | 33 | AUX_SOURCE_DIRECTORY( ${PROJECT_SOURCE_DIR}/src src_file ) 34 | AUX_SOURCE_DIRECTORY( ${PROJECT_SOURCE_DIR} src_file ) 35 | 36 | INCLUDE_DIRECTORIES( "${PROJECT_SOURCE_DIR}/include" ) 37 | 38 | #directory of opencv link libs 39 | LINK_DIRECTORIES(${OpenCV_LIBRARY_DIRS}) 40 | 41 | # generate the lib files 42 | #ADD_LIBRARY( liteslam SHARED ${slam_src} ) 43 | 44 | #ADD_LIBRARY( liteslam_static STATIC ${slam_src} ) 45 | 46 | 47 | ADD_EXECUTABLE( slam_test ${src_file} ) 48 | 49 | TARGET_LINK_LIBRARIES( slam_test ${OpenCV_LIBS} pthread ) 50 | 51 | #SET_TARGET_PROPERTIES( liteslam_static PROPERTIES OUTPUT_NAME "liteslam" ) 52 | -------------------------------------------------------------------------------- /navigation_global_path_planning_simulation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED( VERSION 3.16 ) 2 | 3 | # Set a default build type if none was specified 4 | IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 5 | MESSAGE("Setting build type to 'RelWithDebInfo' as none was specified.") 6 | SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) 7 | # Set the possible values of build type for cmake-gui 8 | SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") 9 | ENDIF() 10 | 11 | # project name 12 | PROJECT( lite_slam ) 13 | 14 | ADD_DEFINITIONS( -std=c++14 ) 15 | 16 | #SET( EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin" ) 17 | 18 | # set the output directory of the libs 19 | SET( LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib" ) 20 | 21 | #find required eigen 22 | FIND_PACKAGE( Eigen3 ) 23 | 24 | #directory of eigen headers 25 | INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} ) 26 | 27 | #find required opencv 28 | FIND_PACKAGE( OpenCV REQUIRED ) 29 | 30 | #directory of opencv headers 31 | INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) 32 | 33 | AUX_SOURCE_DIRECTORY( ${PROJECT_SOURCE_DIR}/src src_file ) 34 | AUX_SOURCE_DIRECTORY( ${PROJECT_SOURCE_DIR} src_file ) 35 | 36 | INCLUDE_DIRECTORIES( "${PROJECT_SOURCE_DIR}/include" ) 37 | 38 | #directory of opencv link libs 39 | LINK_DIRECTORIES(${OpenCV_LIBRARY_DIRS}) 40 | 41 | # generate the lib files 42 | #ADD_LIBRARY( liteslam SHARED ${slam_src} ) 43 | 44 | #ADD_LIBRARY( liteslam_static STATIC ${slam_src} ) 45 | 46 | 47 | ADD_EXECUTABLE( slam_test ${src_file} ) 48 | 49 | TARGET_LINK_LIBRARIES( slam_test ${OpenCV_LIBS} pthread ) 50 | 51 | #SET_TARGET_PROPERTIES( liteslam_static PROPERTIES OUTPUT_NAME "liteslam" ) 52 | -------------------------------------------------------------------------------- /navigation_local_path_planning_simulation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED( VERSION 3.16 ) 2 | 3 | # Set a default build type if none was specified 4 | IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 5 | MESSAGE("Setting build type to 'RelWithDebInfo' as none was specified.") 6 | SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) 7 | # Set the possible values of build type for cmake-gui 8 | SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") 9 | ENDIF() 10 | 11 | # project name 12 | PROJECT( lite_slam ) 13 | 14 | ADD_DEFINITIONS( -std=c++14 ) 15 | 16 | #SET( EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin" ) 17 | 18 | # set the output directory of the libs 19 | SET( LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib" ) 20 | 21 | #find required eigen 22 | FIND_PACKAGE( Eigen3 ) 23 | 24 | #directory of eigen headers 25 | INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} ) 26 | 27 | #find required opencv 28 | FIND_PACKAGE( OpenCV REQUIRED ) 29 | 30 | #directory of opencv headers 31 | INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) 32 | 33 | AUX_SOURCE_DIRECTORY( ${PROJECT_SOURCE_DIR}/src src_file ) 34 | AUX_SOURCE_DIRECTORY( ${PROJECT_SOURCE_DIR} src_file ) 35 | 36 | INCLUDE_DIRECTORIES( "${PROJECT_SOURCE_DIR}/include" ) 37 | 38 | #directory of opencv link libs 39 | LINK_DIRECTORIES(${OpenCV_LIBRARY_DIRS}) 40 | 41 | # generate the lib files 42 | #ADD_LIBRARY( liteslam SHARED ${slam_src} ) 43 | 44 | #ADD_LIBRARY( liteslam_static STATIC ${slam_src} ) 45 | 46 | 47 | ADD_EXECUTABLE( slam_test ${src_file} ) 48 | 49 | TARGET_LINK_LIBRARIES( slam_test ${OpenCV_LIBS} pthread ) 50 | 51 | #SET_TARGET_PROPERTIES( liteslam_static PROPERTIES OUTPUT_NAME "liteslam" ) 52 | -------------------------------------------------------------------------------- /bottom_control_board/motor_pid_velocity_control/server.cpp: -------------------------------------------------------------------------------- 1 | #include "server.h" 2 | 3 | const int freq = 50; // 频率(20ms周期) 4 | const int channel1 = 8; // 通道(高速通道(0 ~ 7)由80MHz时钟驱动,低速通道(8 ~ 15)由 1MHz 时钟驱动。) 5 | const int channel2 = 9; 6 | const int channel3 = 10; 7 | const int channel4 = 11; 8 | 9 | const int resolution = 8; // 分辨率 10 | const int motor1 = 18; 11 | const int motor2 = 19; 12 | const int motor3 = 5; 13 | const int motor4 = 4; 14 | 15 | void initMotor() 16 | { 17 | ledcSetup(channel1, freq, resolution); // 设置通道 18 | ledcAttachPin(motor1, channel1); // 将通道与对应的引脚连接 19 | 20 | ledcSetup(channel2, freq, resolution); 21 | ledcAttachPin(motor2, channel2); 22 | 23 | ledcSetup(channel3, freq, resolution); 24 | ledcAttachPin(motor3, channel3); 25 | 26 | ledcSetup(channel4, freq, resolution); 27 | ledcAttachPin(motor4, channel4); 28 | } 29 | 30 | int calculatePWM(int degree) 31 | { //0-180度 32 | //20ms周期,高电平0.5-2.5ms,对应0-180度角度 33 | const float deadZone = 6.4;//对应0.5ms(0.5ms/(20ms/256)) 34 | const float max = 32;//对应2.5ms 35 | 36 | if (degree < 0) 37 | degree = 0; 38 | if (degree > 180) 39 | degree = 180; 40 | return (int)(((max - deadZone) / 180) * degree + deadZone); 41 | } 42 | 43 | void motor1Run( int degree ) 44 | { 45 | ledcWrite(channel1, calculatePWM(degree)); // 输出PWM 46 | } 47 | 48 | void motor2Run( int degree ) 49 | { 50 | ledcWrite(channel2, calculatePWM(degree)); // 输出PWM 51 | } 52 | 53 | void motor3Run( int degree ) 54 | { 55 | ledcWrite(channel3, calculatePWM(degree)); // 输出PWM 56 | } 57 | 58 | void motor4Run( int degree ) 59 | { 60 | ledcWrite(channel4, calculatePWM(degree)); // 输出PWM 61 | } 62 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # robot_projects 2 | 室内巡检机器人项目 3 | # 大纲 4 | ## 1. 简介 5 | 为了适应老龄化社会的发展,加速家用小型服务型机器人的落地应用,本人将开发一款小型的自主家庭巡检安防机器人。 6 | 其核心在于能够在家庭环境内自主巡航的同时监测家庭环境的异常状况(譬如老人跌倒、陌生人入侵、有害气体浓度、 7 | 易燃气体浓度、烟雾浓度、火灾情况等等),并且能作为智慧家居的核心接入各种外设(空调、灯光、窗帘、睡眠检测仪等等),方便对智慧家居设备进行 8 | 统一管理、调度和控制; 9 | 10 | ## 2. 项目开发分享大纲 11 | 本人将对整个开发过程进行记录以及分享。提供包括电路设计、外壳设计、算法设计以及代码实现部分的文档以及源码, 12 | 便于交流以及二次开发。 13 | 针对分享过程中的流程和方式在这里先做简单的介绍,后续会根据大纲进行详细的梳理。 14 | 整个分享过程将分为10个大的篇章,每个章节会以文字为主并辅以相应的图片甚至是视频资料。 15 | ### 2.1 第一篇--前序 16 | 第一篇中主要是从整体上对该机器人做一个详细的介绍,让人知道整个项目究竟要做什么。在这一部分中,将从机器人 17 | 的整体硬件框架以及软件框架入手,并分模块大致的介绍各个模块的功能和用途。让人产生一个直观的认识,然后在后续 18 | 篇章中会对每一个模块进行拆分细致的介绍。 19 | 20 | ### 2.2 第二篇--机器人下位机驱动电路设计 21 | 首先将介绍机器人底层控制板的电路设计方案,以及使用这种方案的好处、并提供相应的pcb和bom表。 22 | 23 | ### 2.2 第三篇--机器人下位机驱动软件设计(编码器、直流电机以及IMU篇) 24 | 由于机器人所需的外部硬件设备较多,因此关于底层硬件驱动设计这块将分为若干个篇章来介绍。首先将介绍轮式 25 | 移动机器人中的核心外设--编码器、直流电机以及IMU的硬件电路设计以及软件驱动设计。 26 | 27 | ### 2.3 第四篇--机器人下位机驱动软件设计(超声波传感器、温湿度传感器、烟雾传感器等各种传感器篇) 28 | 机器人由于承担了家庭环境监测的任务,因此需要针对性的加装各种传感器。在这一章中将介绍各种传感器的用途、 29 | 驱动方法。 30 | 31 | ### 2.4 第五篇--机器人上位机软件设计(上下位机间通信程序设计篇) 32 | 该机器人的上位机采用地平线公司的X3派开发板,在这一篇中会介绍如何使用串口协议来架起上下位机之间的沟通桥梁。 33 | 因为下位机中采集到的所有数据都要送到上位机中进行处理,而上位机需要对下位机发送控制指令。 34 | 35 | ### 2.5 第六篇--机器人上位机软件设计(激光雷达驱动程序设计篇) 36 | 激光雷达作为移动机器人的核心是必不可少的,该机器人采用了一台低成本的单线激光雷达,为了能够采集该雷达的 37 | 数据,需要根据产品的开发手册进行相应的程序的编写,在本篇章中将会详细叙述这个过程。 38 | 39 | ### 2.6 第七篇--机器人上位机算法设计(SLAM算法篇) 40 | 本机器人将采用自研的2D激光SLAM算法,该算法让机器人具备构建环境地图并定位的能力。在这一篇章中会详细介绍 41 | SLAM算法的原理以及实现方法。 42 | 43 | ### 2.7 第八篇--机器人上位机算法设计(路径规划和运动控制算法篇) 44 | 在这一部分中将会介绍本机器人上使用的路径规划和运动控制算法原理、仿真和部署方法。 45 | 46 | ### 2.8 第八篇--机器人上位机算法部署(视觉检测算法的部署和后处理) 47 | 由于机器人需要检测陌生人入侵、人员跌倒等异常行为,因此需要在上位机上部署深度学习算法来检测,在这部分中 48 | 将介绍如何在X3派上部署视觉检测深度学习算法以及对检测结果的后处理方法。 49 | 50 | ### 2.9 第九篇--微信小程序开发 51 | 为了能在手机上实现远程机器人遥控、实时监测信息查看、接收异常告警信息,需要开发一个微信小程序来展示这些信息。 52 | 53 | ### 2.10 第十篇--总结和展望 54 | 对上述内容的总结,并且展望下一阶段的工作。 55 | -------------------------------------------------------------------------------- /dnn_body_detect/include/dnn_node/util/output_parser/detection/ptq_yolo3_darknet_output_parser.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022,Horizon Robotics. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef PTQ_YOLO3_DARKNET_OUTPUT_PARSER_H 16 | #define PTQ_YOLO3_DARKNET_OUTPUT_PARSER_H 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "rapidjson/document.h" 24 | 25 | #include "dnn/hb_dnn_ext.h" 26 | #include "dnn_node/dnn_node_data.h" 27 | #include "dnn_node/util/output_parser/perception_common.h" 28 | 29 | using hobot::dnn_node::output_parser::Bbox; 30 | using hobot::dnn_node::output_parser::Detection; 31 | using hobot::dnn_node::output_parser::DnnParserResult; 32 | using hobot::dnn_node::output_parser::Perception; 33 | 34 | namespace hobot { 35 | namespace dnn_node { 36 | namespace parser_yolov3 { 37 | int LoadConfig(const rapidjson::Document &document); 38 | 39 | int32_t Parse( 40 | const std::shared_ptr &node_output, 41 | std::shared_ptr &output); 42 | 43 | } // namespace parser_yolov3 44 | } // namespace dnn_node 45 | } // namespace hobot 46 | #endif // PTQ_YOLO3_DARKNET_OUTPUT_PARSER_H_ 47 | -------------------------------------------------------------------------------- /dnn_body_detect/include/dnn_node/util/output_parser/detection/ptq_yolo2_output_parser.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022,Horizon Robotics. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef _DETECTION_PTQ_YOLO2_OUTPUT_PARSER_H_ 16 | #define _DETECTION_PTQ_YOLO2_OUTPUT_PARSER_H_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "rapidjson/document.h" 24 | 25 | #include "dnn/hb_dnn_ext.h" 26 | #include "dnn_node/dnn_node_data.h" 27 | #include "dnn_node/util/output_parser/perception_common.h" 28 | 29 | using hobot::dnn_node::output_parser::Bbox; 30 | using hobot::dnn_node::output_parser::Detection; 31 | using hobot::dnn_node::output_parser::DnnParserResult; 32 | using hobot::dnn_node::output_parser::Perception; 33 | 34 | namespace hobot { 35 | namespace dnn_node { 36 | namespace parser_yolov2 { 37 | int LoadConfig(const rapidjson::Document &document); 38 | 39 | int32_t Parse( 40 | const std::shared_ptr &node_output, 41 | std::shared_ptr &output); 42 | 43 | } // namespace parser_yolov2 44 | } // namespace dnn_node 45 | } // namespace hobot 46 | #endif // _DETECTION_PTQ_YOLO2_OUTPUT_PARSER_H_ 47 | -------------------------------------------------------------------------------- /dnn_body_detect/include/dnn_node/util/output_parser/detection/ptq_yolo5_output_parser.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022,Horizon Robotics. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef _DETECTION_PTQ_YOLO5_OUTPUT_PARSER_H_ 16 | #define _DETECTION_PTQ_YOLO5_OUTPUT_PARSER_H_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "rapidjson/document.h" 24 | 25 | #include "dnn/hb_dnn_ext.h" 26 | #include "dnn_node/dnn_node_data.h" 27 | #include "dnn_node/util/output_parser/perception_common.h" 28 | 29 | using hobot::dnn_node::output_parser::Bbox; 30 | using hobot::dnn_node::output_parser::Detection; 31 | using hobot::dnn_node::output_parser::DnnParserResult; 32 | using hobot::dnn_node::output_parser::Perception; 33 | 34 | namespace hobot { 35 | namespace dnn_node { 36 | namespace parser_yolov5 { 37 | int LoadConfig(const rapidjson::Document &document); 38 | 39 | int32_t Parse( 40 | const std::shared_ptr &node_output, 41 | std::shared_ptr &output); 42 | 43 | } // namespace parser_yolov5 44 | } // namespace dnn_node 45 | } // namespace hobot 46 | #endif // _DETECTION_PTQ_YOLO5_OUTPUT_PARSER_H_ 47 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/include/pid_tracking.h: -------------------------------------------------------------------------------- 1 | #ifndef __PID_TRACKING_H 2 | #define __PID_TRACKING_H 3 | 4 | #include "pid.h" 5 | 6 | #include 7 | 8 | #include 9 | 10 | namespace pt 11 | { 12 | 13 | template 14 | class Tracking 15 | { 16 | public: 17 | using DataType = T; 18 | using Vector2 = typename Eigen::Matrix; 19 | 20 | 21 | Tracking() 22 | { 23 | yaw_pid = new PID(0.4, 1, -1, 0.8, 0.5, 0.3); 24 | y_pose_pid = new PID(0.5, 2, -2, 0.3, 0.3, 0.3); 25 | x_pose_pid = new PID(0.5, 2, -2, 0.3, 0.3, 0.3); 26 | } 27 | 28 | ~Tracking() 29 | { 30 | delete yaw_pid; 31 | delete y_pose_pid; 32 | delete x_pose_pid; 33 | } 34 | 35 | const DataType cacuYaw(const Vector2& p1, const Vector2& p2) 36 | { 37 | Vector2 tmp = p2 - p1; 38 | DataType yaw = ::atan2(tmp[1], tmp[0]); 39 | 40 | return yaw; 41 | } 42 | 43 | const DataType cacuDist(const Vector2& p1, const Vector2& p2) 44 | { 45 | return (p1 - p2).norm(); 46 | } 47 | 48 | const DataType yawPidProcess(const DataType& current_yaw, const DataType& dst_yaw) 49 | { 50 | return yaw_pid->caculate(dst_yaw, current_yaw); 51 | } 52 | 53 | const DataType yPosePidProcess(const DataType& current_pose, const DataType& dst_pose) 54 | { 55 | return y_pose_pid->caculate(dst_pose, current_pose); 56 | } 57 | 58 | const DataType xPosePidProcess(const DataType& current_pose, const DataType& dst_pose) 59 | { 60 | return x_pose_pid->caculate(dst_pose, current_pose); 61 | } 62 | 63 | 64 | private: 65 | PID* yaw_pid; 66 | PID* y_pose_pid; 67 | PID* x_pose_pid; 68 | 69 | }; 70 | 71 | } 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /dnn_body_detect/include/dnn_node/util/output_parser/classification/ptq_classification_output_parser.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022,Horizon Robotics. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef _CLASSIFICATION_PTQ_CLASSIFICATION_OUTPUT_PARSER_H_ 16 | #define _CLASSIFICATION_PTQ_CLASSIFICATION_OUTPUT_PARSER_H_ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include "rapidjson/document.h" 23 | 24 | #include "dnn/hb_dnn_ext.h" 25 | #include "dnn_node/dnn_node_data.h" 26 | #include "dnn_node/util/output_parser/perception_common.h" 27 | 28 | using hobot::dnn_node::output_parser::Classification; 29 | using hobot::dnn_node::output_parser::DnnParserResult; 30 | using hobot::dnn_node::output_parser::Perception; 31 | 32 | namespace hobot { 33 | namespace dnn_node { 34 | namespace parser_mobilenetv2 { 35 | int LoadConfig(const rapidjson::Document &document); 36 | 37 | int32_t Parse( 38 | const std::shared_ptr &node_output, 39 | std::shared_ptr &output); 40 | 41 | } // namespace parser_mobilenetv2 42 | } // namespace dnn_node 43 | } // namespace hobot 44 | 45 | #endif // _CLASSIFICATION_PTQ_CLASSIFICATION_OUTPUT_PARSER_H_ 46 | -------------------------------------------------------------------------------- /navigation_global_path_planning_simulation/include/pid_tracking.h: -------------------------------------------------------------------------------- 1 | #ifndef __PID_TRACKING_H 2 | #define __PID_TRACKING_H 3 | 4 | #include "pid.h" 5 | 6 | #include 7 | 8 | #include 9 | 10 | namespace pt 11 | { 12 | 13 | template 14 | class Tracking 15 | { 16 | public: 17 | using DataType = T; 18 | using Vector2 = typename Eigen::Matrix; 19 | 20 | 21 | Tracking() 22 | { 23 | yaw_pid = new PID(0.4, 1, -1, 0.8, 0.5, 0.3); 24 | y_pose_pid = new PID(0.5, 2, -2, 0.3, 0.3, 0.3); 25 | x_pose_pid = new PID(0.5, 2, -2, 0.3, 0.3, 0.3); 26 | } 27 | 28 | ~Tracking() 29 | { 30 | delete yaw_pid; 31 | delete y_pose_pid; 32 | delete x_pose_pid; 33 | } 34 | 35 | const DataType cacuYaw(const Vector2& p1, const Vector2& p2) 36 | { 37 | Vector2 tmp = p2 - p1; 38 | DataType yaw = ::atan2(tmp[1], tmp[0]); 39 | 40 | return yaw; 41 | } 42 | 43 | const DataType cacuDist(const Vector2& p1, const Vector2& p2) 44 | { 45 | return (p1 - p2).norm(); 46 | } 47 | 48 | const DataType yawPidProcess(const DataType& current_yaw, const DataType& dst_yaw) 49 | { 50 | return yaw_pid->caculate(dst_yaw, current_yaw); 51 | } 52 | 53 | const DataType yPosePidProcess(const DataType& current_pose, const DataType& dst_pose) 54 | { 55 | return y_pose_pid->caculate(dst_pose, current_pose); 56 | } 57 | 58 | const DataType xPosePidProcess(const DataType& current_pose, const DataType& dst_pose) 59 | { 60 | return x_pose_pid->caculate(dst_pose, current_pose); 61 | } 62 | 63 | 64 | private: 65 | PID* yaw_pid; 66 | PID* y_pose_pid; 67 | PID* x_pose_pid; 68 | 69 | }; 70 | 71 | } 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /navigation_local_path_planning_simulation/include/pid_tracking.h: -------------------------------------------------------------------------------- 1 | #ifndef __PID_TRACKING_H 2 | #define __PID_TRACKING_H 3 | 4 | #include "pid.h" 5 | 6 | #include 7 | 8 | #include 9 | 10 | namespace pt 11 | { 12 | 13 | template 14 | class Tracking 15 | { 16 | public: 17 | using DataType = T; 18 | using Vector2 = typename Eigen::Matrix; 19 | 20 | 21 | Tracking() 22 | { 23 | yaw_pid = new PID(0.4, 1, -1, 0.8, 0.5, 0.3); 24 | y_pose_pid = new PID(0.5, 2, -2, 0.3, 0.3, 0.3); 25 | x_pose_pid = new PID(0.5, 2, -2, 0.3, 0.3, 0.3); 26 | } 27 | 28 | ~Tracking() 29 | { 30 | delete yaw_pid; 31 | delete y_pose_pid; 32 | delete x_pose_pid; 33 | } 34 | 35 | const DataType cacuYaw(const Vector2& p1, const Vector2& p2) 36 | { 37 | Vector2 tmp = p2 - p1; 38 | DataType yaw = ::atan2(tmp[1], tmp[0]); 39 | 40 | return yaw; 41 | } 42 | 43 | const DataType cacuDist(const Vector2& p1, const Vector2& p2) 44 | { 45 | return (p1 - p2).norm(); 46 | } 47 | 48 | const DataType yawPidProcess(const DataType& current_yaw, const DataType& dst_yaw) 49 | { 50 | return yaw_pid->caculate(dst_yaw, current_yaw); 51 | } 52 | 53 | const DataType yPosePidProcess(const DataType& current_pose, const DataType& dst_pose) 54 | { 55 | return y_pose_pid->caculate(dst_pose, current_pose); 56 | } 57 | 58 | const DataType xPosePidProcess(const DataType& current_pose, const DataType& dst_pose) 59 | { 60 | return x_pose_pid->caculate(dst_pose, current_pose); 61 | } 62 | 63 | 64 | private: 65 | PID* yaw_pid; 66 | PID* y_pose_pid; 67 | PID* x_pose_pid; 68 | 69 | }; 70 | 71 | } 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /dnn_body_detect/include/dnn_node/util/output_parser/detection/ptq_efficientdet_output_parser.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022,Horizon Robotics. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef _DETECTION_PTQ_EFFICIENTDET_OUTPUT_PARSER_H_ 16 | #define _DETECTION_PTQ_EFFICIENTDET_OUTPUT_PARSER_H_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include "dnn/hb_dnn_ext.h" 25 | #include "dnn_node/dnn_node_data.h" 26 | #include "dnn_node/util/output_parser/perception_common.h" 27 | 28 | using hobot::dnn_node::output_parser::Bbox; 29 | using hobot::dnn_node::output_parser::Detection; 30 | using hobot::dnn_node::output_parser::DnnParserResult; 31 | using hobot::dnn_node::output_parser::Perception; 32 | 33 | namespace hobot { 34 | namespace dnn_node { 35 | namespace parser_efficientdet { 36 | 37 | int LoadDequantiFile(const std::string &file_name); 38 | 39 | int32_t Parse( 40 | const std::shared_ptr &node_output, 41 | std::shared_ptr &output); 42 | 43 | } // namespace parser_efficientdet 44 | 45 | } // namespace dnn_node 46 | } // namespace hobot 47 | #endif // _DETECTION_PTQ_EFFICIENTDET_OUTPUT_PARSER_H_ 48 | -------------------------------------------------------------------------------- /dnn_body_detect/include/dnn_node/util/output_parser/segmentation/ptq_unet_output_parser.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022,Horizon Robotics. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef _SEGMENTATION_PTQ_UNET_OUTPUT_PARSER_H_ 16 | #define _SEGMENTATION_PTQ_UNET_OUTPUT_PARSER_H_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "dnn/hb_dnn_ext.h" 24 | #include "dnn_node/dnn_node_data.h" 25 | #include "dnn_node/util/output_parser/perception_common.h" 26 | 27 | using hobot::dnn_node::output_parser::Bbox; 28 | using hobot::dnn_node::output_parser::Detection; 29 | using hobot::dnn_node::output_parser::DnnParserResult; 30 | using hobot::dnn_node::output_parser::Parsing; 31 | using hobot::dnn_node::output_parser::Perception; 32 | 33 | namespace hobot { 34 | namespace dnn_node { 35 | namespace parser_unet { 36 | int32_t Parse( 37 | const std::shared_ptr &node_output, 38 | int img_w, 39 | int img_h, 40 | int model_w, 41 | int model_h, 42 | bool parser_render, 43 | std::shared_ptr &output); 44 | 45 | } 46 | } // namespace dnn_node 47 | } // namespace hobot 48 | 49 | #endif // _SEGMENTATION_PTQ_UNET_OUTPUT_PARSER_H_ 50 | -------------------------------------------------------------------------------- /bottom_control_board/motor_pid_velocity_control/motor_pid_velocity_control.ino: -------------------------------------------------------------------------------- 1 | #include "motor.h" 2 | #include "imu.h" 3 | #include "ultrasonic.h" 4 | #include "dht11.h" 5 | #include "uart.h" 6 | #include "battery.h" 7 | #include 8 | 9 | char recv_buff[20]; 10 | 11 | void setup() 12 | { 13 | Serial.begin(115200); 14 | uartInit(230400); 15 | 16 | motorGpioInit(); 17 | delay(100); 18 | imuInit(); 19 | delay(100); 20 | encoderInit(); 21 | delay(100); 22 | motorInit(); 23 | delay(100); 24 | 25 | // 创建任务:获取各个传感器的值 26 | xTaskCreate(taskSensors, // 任务函数 27 | "sensors", // 任务名 28 | 8*1024, // 任务栈大小,根据需要自行设置 29 | NULL, // 参数,入参为空 30 | 1, // 优先级 31 | NULL); // 任务句柄 32 | } 33 | 34 | void loop() 35 | { 36 | // 接收串口发过来的指令,主要是线速度和角速度 37 | int len = uart1.available(); 38 | if( len > 0 ){ 39 | memset(recv_buff, 0, sizeof(recv_buff)); 40 | uart1.readBytes( recv_buff, len ); 41 | if( len == 8 ){ 42 | Control u; 43 | memcpy( &u, recv_buff, sizeof(u) ); 44 | cacuRPM( u.v, u.w ); 45 | Serial.printf( "control : %.2f %.2f\n", u.v, u.w ); 46 | } 47 | } 48 | delay(100); 49 | } 50 | 51 | // 用来获取传感器数据的线程 52 | void taskSensors(void *parameter) 53 | { 54 | ultraSonicInit(); 55 | delay(100); 56 | 57 | while(1){ 58 | int humidity = 0; 59 | int temperature = 0; 60 | getHumidityAndTemperature( humidity, temperature ); 61 | 62 | float distance = getDistance(); 63 | 64 | float voltage = getBatteryVoltage(); 65 | 66 | uart1.printf( "sens %d %d %.2f %.2f\n", humidity, temperature, distance, voltage ); 67 | 68 | vTaskDelay(100); // 10Hz频率 69 | } 70 | 71 | vTaskDelete(NULL); 72 | } 73 | -------------------------------------------------------------------------------- /odometry/src/EpollEvent.cpp: -------------------------------------------------------------------------------- 1 | #include "EpollEvent.h" 2 | 3 | int EpollEvent::addEvent( const Event &event ) 4 | { 5 | struct epoll_event epollEvent; 6 | epollEvent.data.fd = event.fd; 7 | epollEvent.events = event.event; 8 | 9 | 10 | int ret = epoll_ctl( this->epollFd, EPOLL_CTL_ADD, event.fd, &epollEvent ); 11 | if ( ret < 0 ) { 12 | std::cerr<<"epoll_ctl error ..."<events 17 | this->events[event.fd] = event; 18 | return true; 19 | } 20 | 21 | 22 | int EpollEvent::delEvent( const Event &event ) 23 | { 24 | struct epoll_event epollEvent; 25 | epollEvent.data.fd = event.fd; 26 | epollEvent.events = event.event; 27 | int ret = epoll_ctl( this->epollFd, EPOLL_CTL_DEL, event.fd, &epollEvent ); 28 | if ( ret < 0 ) { 29 | std::cerr<<"epoll_ctl EPOLL_CTL_DEL error ..."<events.erase( event.fd ); 34 | return true; 35 | } 36 | 37 | 38 | int EpollEvent::dispatcher() 39 | { 40 | struct epoll_event epollEvents[32]; // 32 is the number of the maximum events 41 | 42 | int nEvents = epoll_wait( epollFd, epollEvents, 32, -1 ); 43 | 44 | if ( nEvents <= 0 ) { 45 | std::cerr<<"epoll wait error ..."<events[fd]; 53 | 54 | if ( event.callback ) { 55 | event.callback( fd, event.arg ); 56 | } 57 | } 58 | return true; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /apf_planner/include/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef __UTILS_H 2 | #define __UTILS_H 3 | 4 | #include "data_type.h" 5 | #include "data_container.h" 6 | 7 | #include 8 | 9 | 10 | class Utils 11 | { 12 | public: 13 | static void laserData2Container( const sensor::LaserScan& scan, sensor::ScanContainer& container ) 14 | { 15 | container.clear(); 16 | 17 | float angle = 0.0; 18 | for ( size_t i = 0; i < scan.size(); i ++ ) { 19 | auto dist = scan.ranges[i]; 20 | if ( dist >= 0.1 && dist < 10.0 ) { 21 | auto pt = Eigen::Vector2f( ::cos( angle ) * dist, ::sin( angle ) * dist ); 22 | Eigen::Matrix2f R; 23 | R << ::cos( M_PI ), -::sin( M_PI ), 24 | ::sin( M_PI ), ::cos( M_PI ); 25 | 26 | container.addData( R * pt ); 27 | } 28 | 29 | angle += scan.angle_increment; 30 | } 31 | 32 | std::cout<<"Scan Container size : "< 8 | 9 | 10 | class Utils 11 | { 12 | public: 13 | static void laserData2Container( const sensor::LaserScan& scan, sensor::ScanContainer& container ) 14 | { 15 | container.clear(); 16 | 17 | float angle = 0.0; 18 | for ( size_t i = 0; i < scan.size(); i ++ ) { 19 | auto dist = scan.ranges[i]; 20 | if ( dist >= 0.1 && dist < 10.0 ) { 21 | auto pt = Eigen::Vector2f( ::cos( angle ) * dist, ::sin( angle ) * dist ); 22 | Eigen::Matrix2f R; 23 | R << ::cos( M_PI ), -::sin( M_PI ), 24 | ::sin( M_PI ), ::cos( M_PI ); 25 | 26 | container.addData( R * pt ); 27 | } 28 | 29 | angle += scan.angle_increment; 30 | } 31 | 32 | std::cout<<"Scan Container size : "<epollFd, EPOLL_CTL_ADD, event.fd, &epollEvent ); 11 | if ( ret < 0 ) { 12 | std::cerr<<"epoll_ctl error ..."<events 17 | this->events[event.fd] = event; 18 | return true; 19 | } 20 | 21 | 22 | int EpollEvent::delEvent( const Event &event ) 23 | { 24 | struct epoll_event epollEvent; 25 | epollEvent.data.fd = event.fd; 26 | epollEvent.events = event.event; 27 | int ret = epoll_ctl( this->epollFd, EPOLL_CTL_DEL, event.fd, &epollEvent ); 28 | if ( ret < 0 ) { 29 | std::cerr<<"epoll_ctl EPOLL_CTL_DEL error ..."<events.erase( event.fd ); 34 | return true; 35 | } 36 | 37 | 38 | int EpollEvent::dispatcher() 39 | { 40 | struct epoll_event epollEvents[32]; // 32 is the number of the maximum events 41 | 42 | int nEvents = epoll_wait( epollFd, epollEvents, 32, -1 ); 43 | 44 | if ( nEvents <= 0 ) { 45 | std::cerr<<"epoll wait error ..."<events[fd]; 53 | 54 | if ( event.callback ) { 55 | event.callback( fd, event.arg ); 56 | } 57 | } 58 | return true; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /2d_cluster_test/include/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef __UTILS_H 2 | #define __UTILS_H 3 | 4 | #include "data_type.h" 5 | #include "data_container.h" 6 | 7 | #include 8 | 9 | 10 | class Utils 11 | { 12 | public: 13 | static void laserData2Container( const sensor::LaserScan& scan, sensor::ScanContainer& container ) 14 | { 15 | container.clear(); 16 | 17 | float angle = 0.0; 18 | for ( size_t i = 0; i < scan.size(); i ++ ) { 19 | auto dist = scan.ranges[i]; 20 | if ( dist >= 0.1 && dist < 10.0 ) { 21 | auto pt = Eigen::Vector2f( ::cos( angle ) * dist, ::sin( angle ) * dist ); 22 | Eigen::Matrix2f R; 23 | R << ::cos( M_PI ), -::sin( M_PI ), 24 | ::sin( M_PI ), ::cos( M_PI ); 25 | 26 | container.addData( R * pt ); 27 | } 28 | 29 | angle += scan.angle_increment; 30 | } 31 | 32 | std::cout<<"Scan Container size : "< 8 | 9 | 10 | class Utils 11 | { 12 | public: 13 | static void laserData2Container( const sensor::LaserScan& scan, sensor::ScanContainer& container ) 14 | { 15 | container.clear(); 16 | 17 | float angle = 0.0; 18 | for ( size_t i = 0; i < scan.size(); i ++ ) { 19 | auto dist = scan.ranges[i]; 20 | if ( dist >= 0.1 && dist < 10.0 ) { 21 | auto pt = Eigen::Vector2f( ::cos( angle ) * dist, ::sin( angle ) * dist ); 22 | Eigen::Matrix2f R; 23 | R << ::cos( M_PI ), -::sin( M_PI ), 24 | ::sin( M_PI ), ::cos( M_PI ); 25 | 26 | container.addData( R * pt ); 27 | } 28 | 29 | angle += scan.angle_increment; 30 | } 31 | 32 | std::cout<<"Scan Container size : "< 5 | #include 6 | 7 | #include "pid.h" 8 | 9 | #ifndef M_PI 10 | #define M_PI 3.141592653 11 | #endif 12 | 13 | // 左轮电机 14 | #define IN1 26 // 电机1控制引脚1 15 | #define IN2 27 // 电机1控制引脚2 16 | #define PWMA 14 // 电机1 pwm引脚 17 | 18 | // 右轮电机 19 | #define IN3 25 // 电机2控制引脚1 20 | #define IN4 4 // 电机2控制引脚2 21 | #define PWMB 0 // 电机2 pwm引脚 22 | 23 | #define FREQ 50000 // pwm频率 24 | 25 | #define pwm_Channel_A 0 //电机1使用PWM的通道0 26 | #define pwm_Channel_B 1 //电机1使用PWM的通道1 27 | 28 | #define resolution 8 //使用PWM占空比的分辨率 29 | #define interrupt_time_control 50//定时器50ms中断控制时间 30 | 31 | #define LA 13 // 电机1编码器 A 相位 32 | #define LB 12 // 电机1编码器 B 相位 33 | #define RA 2 // 电机2编码器 A 相位 34 | #define RB 15 // 电机2编码器 B 相位 35 | 36 | // --------------------- 车身参数 --------------------- // 37 | #define circumference 0.132889 // 轮子的周长,单位m 38 | #define base_width 0.166 // 车身宽度,单位m 39 | #define MAX_RPM 300 // 电机最大转数 40 | #define pulse_number 468 // 电机转一圈编码器的脉冲数 41 | 42 | 43 | // ------------------- 定时器 & 电机 ------------------ // 44 | 45 | extern float required_rpm_left; 46 | extern float required_rpm_right; 47 | 48 | // 控制量 49 | typedef struct Control_ 50 | { 51 | float v; 52 | float w; 53 | }Control; 54 | 55 | 56 | void leftEncoder(); 57 | void rightEncoder(); 58 | 59 | void encoderInit(); 60 | int rpmToPWM(float rpm); 61 | void setPwm( int motor1_pwm, int motor2_pwm ); 62 | 63 | float getVelocity( float motor1_rpm, float motor2_rpm ); 64 | float getDeltaS( long l_count_c, long r_count_c ); 65 | float getDeltaAngle( long l_count_c, long r_count_c ); 66 | 67 | void motorControl(); 68 | void motorGpioInit(); 69 | void motorInit(); 70 | 71 | // motion model 72 | void cacuRPM( float v, float w ); 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /robot_navigation_local_path_planning/include/path_planner/apf_process.h: -------------------------------------------------------------------------------- 1 | #ifndef __APF_PROCESS_H 2 | #define __APF_PROCESS_H 3 | 4 | #include "apf.h" 5 | #include "utils.h" 6 | 7 | namespace apf 8 | { 9 | 10 | template 11 | class APFProcess 12 | { 13 | public: 14 | using DataType = T; 15 | using Vector2 = typename Eigen::Matrix; 16 | using Vector3 = typename Eigen::Matrix; 17 | 18 | APFProcess() 19 | { 20 | 21 | } 22 | 23 | ~APFProcess() 24 | { 25 | 26 | } 27 | 28 | void setTargetPose( const Vector2& target_pose ) 29 | { 30 | return apf_.setTargetPose( target_pose ); 31 | } 32 | 33 | // return ( force, direction ) 34 | const std::pair runApfOnce( const Vector2& robot_pose, 35 | const Obstacles& obstacles ) 36 | { 37 | // 1. attraction vector 38 | Vector2 f_att_vec = apf_.cacuFatt( robot_pose ); 39 | 40 | // 2. repulsion vector 41 | Vector2 f_rep_vec = apf_.cacuFrep( robot_pose, obstacles ); 42 | apf_.clearRepulsionVec1(); 43 | 44 | // 3. total force 45 | Vector2 f_total = f_att_vec + f_rep_vec; 46 | 47 | std::cout<<"f_total = "< 0 ) { 52 | target_theta = M_PI + ::atan2( f_total[1], f_total[0] ); 53 | } 54 | else if ( f_total[0] < 0 && f_total[1] < 0 ) { 55 | 56 | target_theta = ::atan2( f_total[1], f_total[0] ) - M_PI; 57 | } 58 | else { 59 | target_theta = ::atan2( f_total[1], f_total[0] ); 60 | }*/ 61 | 62 | DataType target_theta = ::atan2( f_total[1], f_total[0] ); 63 | 64 | Utils::angleNormalize( target_theta ); 65 | 66 | return { f_total.norm() * force_scale, target_theta }; 67 | } 68 | 69 | private: 70 | APF apf_; 71 | const DataType force_scale = 0.1; 72 | }; 73 | 74 | } 75 | 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /jpeg_stream/src/EpollEvent.cpp: -------------------------------------------------------------------------------- 1 | #include "EpollEvent.h" 2 | 3 | namespace epoll 4 | { 5 | 6 | int EpollEvent::addEvent( const Event &event ) 7 | { 8 | struct epoll_event epollEvent; 9 | epollEvent.data.fd = event.fd; 10 | epollEvent.events = event.event; 11 | 12 | 13 | int ret = epoll_ctl( this->epollFd, EPOLL_CTL_ADD, event.fd, &epollEvent ); 14 | if ( ret < 0 ) { 15 | std::cerr<<"epoll_ctl error ..."<events 20 | this->events[event.fd] = event; 21 | return true; 22 | } 23 | 24 | 25 | int EpollEvent::delEvent( const Event &event ) 26 | { 27 | struct epoll_event epollEvent; 28 | epollEvent.data.fd = event.fd; 29 | epollEvent.events = event.event; 30 | int ret = epoll_ctl( this->epollFd, EPOLL_CTL_DEL, event.fd, &epollEvent ); 31 | if ( ret < 0 ) { 32 | std::cerr<<"epoll_ctl EPOLL_CTL_DEL error ..."<events.erase( event.fd ); 37 | return true; 38 | } 39 | 40 | 41 | int EpollEvent::dispatcher() 42 | { 43 | struct epoll_event epollEvents[32]; // 32 is the number of the maximum events 44 | 45 | int nEvents = epoll_wait( epollFd, epollEvents, 32, -1 ); 46 | 47 | if ( nEvents <= 0 ) { 48 | std::cerr<<"epoll wait error ..."<events[fd]; 56 | 57 | if ( event.callback ) { 58 | event.callback( fd, event.arg ); 59 | } 60 | } 61 | return true; 62 | } 63 | 64 | } 65 | 66 | -------------------------------------------------------------------------------- /robot_slam/src/EpollEvent.cpp: -------------------------------------------------------------------------------- 1 | #include "EpollEvent.h" 2 | 3 | namespace epoll 4 | { 5 | 6 | int EpollEvent::addEvent( const Event &event ) 7 | { 8 | struct epoll_event epollEvent; 9 | epollEvent.data.fd = event.fd; 10 | epollEvent.events = event.event; 11 | 12 | 13 | int ret = epoll_ctl( this->epollFd, EPOLL_CTL_ADD, event.fd, &epollEvent ); 14 | if ( ret < 0 ) { 15 | std::cerr<<"epoll_ctl error ..."<events 20 | this->events[event.fd] = event; 21 | return true; 22 | } 23 | 24 | 25 | int EpollEvent::delEvent( const Event &event ) 26 | { 27 | struct epoll_event epollEvent; 28 | epollEvent.data.fd = event.fd; 29 | epollEvent.events = event.event; 30 | int ret = epoll_ctl( this->epollFd, EPOLL_CTL_DEL, event.fd, &epollEvent ); 31 | if ( ret < 0 ) { 32 | std::cerr<<"epoll_ctl EPOLL_CTL_DEL error ..."<events.erase( event.fd ); 37 | return true; 38 | } 39 | 40 | 41 | int EpollEvent::dispatcher() 42 | { 43 | struct epoll_event epollEvents[32]; // 32 is the number of the maximum events 44 | 45 | int nEvents = epoll_wait( epollFd, epollEvents, 32, -1 ); 46 | 47 | if ( nEvents <= 0 ) { 48 | std::cerr<<"epoll wait error ..."<events[fd]; 56 | 57 | if ( event.callback ) { 58 | event.callback( fd, event.arg ); 59 | } 60 | } 61 | return true; 62 | } 63 | 64 | } 65 | 66 | -------------------------------------------------------------------------------- /slam_simu/include/dataContainer.h: -------------------------------------------------------------------------------- 1 | #ifndef __DATA_CONTAINER_H_ 2 | #define __DATA_CONTAINER_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace sensor 11 | { 12 | 13 | template 15 | class EigenType> 16 | struct is_Eigen_type 17 | { 18 | static const bool value = false; 19 | }; 20 | 21 | template 22 | struct is_Eigen_type 23 | { 24 | using type = Eigen::Matrix; 25 | static const bool value = true; 26 | }; 27 | 28 | template::value>::type> 30 | class DataContainer 31 | { 32 | public: 33 | using type = DataType; 34 | using value_type = typename DataType::value_type; 35 | 36 | using ConstSharedPtr = const std::shared_ptr; 37 | using SharedPtr = std::shared_ptr; 38 | 39 | DataContainer() { } 40 | ~DataContainer() { } 41 | 42 | void addData( const DataType &data ) 43 | { 44 | return data_vec_.push_back( data ); 45 | } 46 | 47 | void clear() 48 | { 49 | return data_vec_.clear(); 50 | } 51 | 52 | const DataType& getIndexData( const int index ) const 53 | { 54 | return data_vec_[index]; 55 | } 56 | 57 | 58 | const int getSize() const 59 | { 60 | return data_vec_.size(); 61 | } 62 | 63 | 64 | bool isEmpty() const 65 | { 66 | return data_vec_.empty(); 67 | } 68 | 69 | const DataType& operator[] (const int i) 70 | { 71 | return data_vec_[i]; 72 | } 73 | 74 | private: 75 | std::vector data_vec_; 76 | 77 | }; 78 | 79 | using ScanContainer = DataContainer; 80 | 81 | } 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /m1c1_lidar_test/include/data_container.h: -------------------------------------------------------------------------------- 1 | #ifndef __DATA_CONTAINER_H_ 2 | #define __DATA_CONTAINER_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace sensor 11 | { 12 | 13 | template 15 | class EigenType> 16 | struct is_Eigen_type 17 | { 18 | static const bool value = false; 19 | }; 20 | 21 | template 22 | struct is_Eigen_type 23 | { 24 | using type = Eigen::Matrix; 25 | static const bool value = true; 26 | }; 27 | 28 | template::value>::type> 30 | class DataContainer 31 | { 32 | public: 33 | using type = DataType; 34 | using value_type = typename DataType::value_type; 35 | 36 | using ConstSharedPtr = const std::shared_ptr; 37 | using SharedPtr = std::shared_ptr; 38 | 39 | DataContainer() { } 40 | ~DataContainer() { } 41 | 42 | void addData( const DataType &data ) 43 | { 44 | return data_vec_.push_back( data ); 45 | } 46 | 47 | void clear() 48 | { 49 | return data_vec_.clear(); 50 | } 51 | 52 | const DataType& getIndexData( const int index ) const 53 | { 54 | return data_vec_[index]; 55 | } 56 | 57 | 58 | const int getSize() const 59 | { 60 | return data_vec_.size(); 61 | } 62 | 63 | 64 | bool isEmpty() const 65 | { 66 | return data_vec_.empty(); 67 | } 68 | 69 | const DataType& operator[] (const int i) 70 | { 71 | return data_vec_[i]; 72 | } 73 | 74 | private: 75 | std::vector data_vec_; 76 | 77 | }; 78 | 79 | using ScanContainer = DataContainer; 80 | 81 | } 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /robot_navigation_global_path_planing/src/EpollEvent.cpp: -------------------------------------------------------------------------------- 1 | #include "EpollEvent.h" 2 | 3 | namespace epoll 4 | { 5 | 6 | int EpollEvent::addEvent( const Event &event ) 7 | { 8 | struct epoll_event epollEvent; 9 | epollEvent.data.fd = event.fd; 10 | epollEvent.events = event.event; 11 | 12 | 13 | int ret = epoll_ctl( this->epollFd, EPOLL_CTL_ADD, event.fd, &epollEvent ); 14 | if ( ret < 0 ) { 15 | std::cerr<<"epoll_ctl error ..."<events 20 | this->events[event.fd] = event; 21 | return true; 22 | } 23 | 24 | 25 | int EpollEvent::delEvent( const Event &event ) 26 | { 27 | struct epoll_event epollEvent; 28 | epollEvent.data.fd = event.fd; 29 | epollEvent.events = event.event; 30 | int ret = epoll_ctl( this->epollFd, EPOLL_CTL_DEL, event.fd, &epollEvent ); 31 | if ( ret < 0 ) { 32 | std::cerr<<"epoll_ctl EPOLL_CTL_DEL error ..."<events.erase( event.fd ); 37 | return true; 38 | } 39 | 40 | 41 | int EpollEvent::dispatcher() 42 | { 43 | struct epoll_event epollEvents[32]; // 32 is the number of the maximum events 44 | 45 | int nEvents = epoll_wait( epollFd, epollEvents, 32, -1 ); 46 | 47 | if ( nEvents <= 0 ) { 48 | std::cerr<<"epoll wait error ..."<events[fd]; 56 | 57 | if ( event.callback ) { 58 | event.callback( fd, event.arg ); 59 | } 60 | } 61 | return true; 62 | } 63 | 64 | } 65 | 66 | -------------------------------------------------------------------------------- /robot_navigation_local_path_planning/src/EpollEvent.cpp: -------------------------------------------------------------------------------- 1 | #include "EpollEvent.h" 2 | 3 | namespace epoll 4 | { 5 | 6 | int EpollEvent::addEvent( const Event &event ) 7 | { 8 | struct epoll_event epollEvent; 9 | epollEvent.data.fd = event.fd; 10 | epollEvent.events = event.event; 11 | 12 | 13 | int ret = epoll_ctl( this->epollFd, EPOLL_CTL_ADD, event.fd, &epollEvent ); 14 | if ( ret < 0 ) { 15 | std::cerr<<"epoll_ctl error ..."<events 20 | this->events[event.fd] = event; 21 | return true; 22 | } 23 | 24 | 25 | int EpollEvent::delEvent( const Event &event ) 26 | { 27 | struct epoll_event epollEvent; 28 | epollEvent.data.fd = event.fd; 29 | epollEvent.events = event.event; 30 | int ret = epoll_ctl( this->epollFd, EPOLL_CTL_DEL, event.fd, &epollEvent ); 31 | if ( ret < 0 ) { 32 | std::cerr<<"epoll_ctl EPOLL_CTL_DEL error ..."<events.erase( event.fd ); 37 | return true; 38 | } 39 | 40 | 41 | int EpollEvent::dispatcher() 42 | { 43 | struct epoll_event epollEvents[32]; // 32 is the number of the maximum events 44 | 45 | int nEvents = epoll_wait( epollFd, epollEvents, 32, -1 ); 46 | 47 | if ( nEvents <= 0 ) { 48 | std::cerr<<"epoll wait error ..."<events[fd]; 56 | 57 | if ( event.callback ) { 58 | event.callback( fd, event.arg ); 59 | } 60 | } 61 | return true; 62 | } 63 | 64 | } 65 | 66 | -------------------------------------------------------------------------------- /jpeg_stream/main.cpp_cpy2: -------------------------------------------------------------------------------- 1 | #include 2 | #include "image_utils.h" 3 | 4 | #include "data_transport.h" 5 | 6 | #include 7 | 8 | extern "C" { 9 | #include "sp_codec.h" 10 | #include "sp_sys.h" 11 | } 12 | 13 | char stream_buffer[960 * 544 * 3]; 14 | 15 | transport::Sender imgs_sender( "192.168.3.27", 3333 ); 16 | 17 | int main() 18 | { 19 | 20 | std::cout<<"--------------- ENCODER TEST ------------------"<> image; 44 | 45 | cv::resize( image, image, cv::Size( 720, 480 ) ); 46 | 47 | cv::imshow("image", image); 48 | 49 | if ( cv::waitKey(50) == 'q' ) { 50 | break; 51 | } 52 | 53 | cv::Mat nv12_img; 54 | int c_ret = ImageUtils::BGRToNv12( image, nv12_img ); 55 | std::cout<<"convert ret = "< 19 | #include 20 | #include 21 | 22 | #include "dnn_node/dnn_node.h" 23 | #include "opencv2/core/mat.hpp" 24 | #include "opencv2/imgcodecs.hpp" 25 | #include "opencv2/imgproc.hpp" 26 | 27 | using hobot::dnn_node::NV12PyramidInput; 28 | 29 | #define ALIGNED_2E(w, alignment) \ 30 | ((static_cast(w) + (alignment - 1U)) & (~(alignment - 1U))) 31 | #define ALIGN_4(w) ALIGNED_2E(w, 4U) 32 | #define ALIGN_8(w) ALIGNED_2E(w, 8U) 33 | #define ALIGN_16(w) ALIGNED_2E(w, 16U) 34 | #define ALIGN_64(w) ALIGNED_2E(w, 64U) 35 | 36 | class ImageUtils { 37 | public: 38 | static std::shared_ptr GetNV12Pyramid( 39 | const cv::Mat &image, 40 | int scaled_img_height, 41 | int scaled_img_width); 42 | 43 | // 输入图片size小于scale size(模型输入size):将输入图片padding到左上区域 44 | // 输入图片size大于scale size(模型输入size):crop输入图片左上区域 45 | static std::shared_ptr GetNV12PyramidFromNV12Img( 46 | const char* in_img_data, 47 | int in_img_height, 48 | int in_img_width, 49 | int scaled_img_height, 50 | int scaled_img_width); 51 | 52 | static int32_t BGRToNv12(cv::Mat &bgr_mat, cv::Mat &img_nv12); 53 | }; 54 | 55 | #endif // MONO2D_DET_IMAGE_UTILS_H 56 | -------------------------------------------------------------------------------- /icp_test/include/data_container.h: -------------------------------------------------------------------------------- 1 | #ifndef __DATA_CONTAINER_H_ 2 | #define __DATA_CONTAINER_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace sensor 11 | { 12 | 13 | template 15 | class EigenType> 16 | struct is_Eigen_type 17 | { 18 | static const bool value = false; 19 | }; 20 | 21 | template 22 | struct is_Eigen_type 23 | { 24 | using type = Eigen::Matrix; 25 | static const bool value = true; 26 | }; 27 | 28 | template::value>::type> 30 | class DataContainer 31 | { 32 | public: 33 | using type = DataType; 34 | using value_type = typename DataType::value_type; 35 | 36 | using ConstSharedPtr = const std::shared_ptr; 37 | using SharedPtr = std::shared_ptr; 38 | 39 | DataContainer() { } 40 | ~DataContainer() { } 41 | 42 | void addData( const DataType &data ) 43 | { 44 | return data_vec_.push_back( data ); 45 | } 46 | 47 | void clear() 48 | { 49 | return data_vec_.clear(); 50 | } 51 | 52 | const DataType& getIndexData( const int index ) const 53 | { 54 | return data_vec_[index]; 55 | } 56 | 57 | 58 | int getSize() const 59 | { 60 | return data_vec_.size(); 61 | } 62 | 63 | 64 | bool isEmpty() const 65 | { 66 | return data_vec_.empty(); 67 | } 68 | 69 | const DataType& operator[] (const int i) const 70 | { 71 | return data_vec_[i]; 72 | } 73 | 74 | private: 75 | std::vector data_vec_; 76 | 77 | }; 78 | 79 | using ScanContainer = DataContainer; 80 | using ScanContainerD = DataContainer; 81 | 82 | } 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /robot_slam/include/slam/data_container.h: -------------------------------------------------------------------------------- 1 | #ifndef __DATA_CONTAINER_H_ 2 | #define __DATA_CONTAINER_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace sensor 11 | { 12 | 13 | template 15 | class EigenType> 16 | struct is_Eigen_type 17 | { 18 | static const bool value = false; 19 | }; 20 | 21 | template 22 | struct is_Eigen_type 23 | { 24 | using type = Eigen::Matrix; 25 | static const bool value = true; 26 | }; 27 | 28 | template::value>::type> 30 | class DataContainer 31 | { 32 | public: 33 | using type = DataType; 34 | using value_type = typename DataType::value_type; 35 | 36 | using ConstSharedPtr = const std::shared_ptr; 37 | using SharedPtr = std::shared_ptr; 38 | 39 | DataContainer() { } 40 | ~DataContainer() { } 41 | 42 | void addData( const DataType &data ) 43 | { 44 | return data_vec_.push_back( data ); 45 | } 46 | 47 | void clear() 48 | { 49 | return data_vec_.clear(); 50 | } 51 | 52 | const DataType& getIndexData( const int index ) const 53 | { 54 | return data_vec_[index]; 55 | } 56 | 57 | 58 | int getSize() const 59 | { 60 | return data_vec_.size(); 61 | } 62 | 63 | 64 | bool isEmpty() const 65 | { 66 | return data_vec_.empty(); 67 | } 68 | 69 | const DataType& operator[] (const int i) 70 | { 71 | return data_vec_[i]; 72 | } 73 | 74 | private: 75 | std::vector data_vec_; 76 | 77 | }; 78 | 79 | using ScanContainer = DataContainer; 80 | using ScanContainerD = DataContainer; 81 | 82 | } 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/include/data_container.h: -------------------------------------------------------------------------------- 1 | #ifndef __DATA_CONTAINER_H_ 2 | #define __DATA_CONTAINER_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace sensor 11 | { 12 | 13 | template 15 | class EigenType> 16 | struct is_Eigen_type 17 | { 18 | static const bool value = false; 19 | }; 20 | 21 | template 22 | struct is_Eigen_type 23 | { 24 | using type = Eigen::Matrix; 25 | static const bool value = true; 26 | }; 27 | 28 | template::value>::type> 30 | class DataContainer 31 | { 32 | public: 33 | using type = DataType; 34 | using value_type = typename DataType::value_type; 35 | 36 | using ConstSharedPtr = const std::shared_ptr; 37 | using SharedPtr = std::shared_ptr; 38 | 39 | DataContainer() { } 40 | ~DataContainer() { } 41 | 42 | void addData( const DataType &data ) 43 | { 44 | return data_vec_.push_back( data ); 45 | } 46 | 47 | void clear() 48 | { 49 | return data_vec_.clear(); 50 | } 51 | 52 | const DataType& getIndexData( const int index ) const 53 | { 54 | return data_vec_[index]; 55 | } 56 | 57 | 58 | int getSize() const 59 | { 60 | return data_vec_.size(); 61 | } 62 | 63 | 64 | bool isEmpty() const 65 | { 66 | return data_vec_.empty(); 67 | } 68 | 69 | const DataType& operator[] (const int i) const 70 | { 71 | return data_vec_[i]; 72 | } 73 | 74 | private: 75 | std::vector data_vec_; 76 | 77 | }; 78 | 79 | using ScanContainer = DataContainer; 80 | using ScanContainerD = DataContainer; 81 | 82 | } 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /navigation_local_path_planning_simulation/include/data_container.h: -------------------------------------------------------------------------------- 1 | #ifndef __DATA_CONTAINER_H_ 2 | #define __DATA_CONTAINER_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace sensor 11 | { 12 | 13 | template 15 | class EigenType> 16 | struct is_Eigen_type 17 | { 18 | static const bool value = false; 19 | }; 20 | 21 | template 22 | struct is_Eigen_type 23 | { 24 | using type = Eigen::Matrix; 25 | static const bool value = true; 26 | }; 27 | 28 | template::value>::type> 30 | class DataContainer 31 | { 32 | public: 33 | using type = DataType; 34 | using value_type = typename DataType::value_type; 35 | 36 | using ConstSharedPtr = const std::shared_ptr; 37 | using SharedPtr = std::shared_ptr; 38 | 39 | DataContainer() { } 40 | ~DataContainer() { } 41 | 42 | void addData( const DataType &data ) 43 | { 44 | return data_vec_.push_back( data ); 45 | } 46 | 47 | void clear() 48 | { 49 | return data_vec_.clear(); 50 | } 51 | 52 | const DataType& getIndexData( const int index ) const 53 | { 54 | return data_vec_[index]; 55 | } 56 | 57 | 58 | int getSize() const 59 | { 60 | return data_vec_.size(); 61 | } 62 | 63 | 64 | bool isEmpty() const 65 | { 66 | return data_vec_.empty(); 67 | } 68 | 69 | const DataType& operator[] (const int i) 70 | { 71 | return data_vec_[i]; 72 | } 73 | 74 | private: 75 | std::vector data_vec_; 76 | 77 | }; 78 | 79 | using ScanContainer = DataContainer; 80 | using ScanContainerD = DataContainer; 81 | 82 | } 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /robot_navigation_global_path_planing/include/slam/data_container.h: -------------------------------------------------------------------------------- 1 | #ifndef __DATA_CONTAINER_H_ 2 | #define __DATA_CONTAINER_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace sensor 11 | { 12 | 13 | template 15 | class EigenType> 16 | struct is_Eigen_type 17 | { 18 | static const bool value = false; 19 | }; 20 | 21 | template 22 | struct is_Eigen_type 23 | { 24 | using type = Eigen::Matrix; 25 | static const bool value = true; 26 | }; 27 | 28 | template::value>::type> 30 | class DataContainer 31 | { 32 | public: 33 | using type = DataType; 34 | using value_type = typename DataType::value_type; 35 | 36 | using ConstSharedPtr = const std::shared_ptr; 37 | using SharedPtr = std::shared_ptr; 38 | 39 | DataContainer() { } 40 | ~DataContainer() { } 41 | 42 | void addData( const DataType &data ) 43 | { 44 | return data_vec_.push_back( data ); 45 | } 46 | 47 | void clear() 48 | { 49 | return data_vec_.clear(); 50 | } 51 | 52 | const DataType& getIndexData( const int index ) const 53 | { 54 | return data_vec_[index]; 55 | } 56 | 57 | 58 | int getSize() const 59 | { 60 | return data_vec_.size(); 61 | } 62 | 63 | 64 | bool isEmpty() const 65 | { 66 | return data_vec_.empty(); 67 | } 68 | 69 | const DataType& operator[] (const int i) 70 | { 71 | return data_vec_[i]; 72 | } 73 | 74 | private: 75 | std::vector data_vec_; 76 | 77 | }; 78 | 79 | using ScanContainer = DataContainer; 80 | using ScanContainerD = DataContainer; 81 | 82 | } 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /robot_navigation_local_path_planning/include/slam/data_container.h: -------------------------------------------------------------------------------- 1 | #ifndef __DATA_CONTAINER_H_ 2 | #define __DATA_CONTAINER_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace sensor 11 | { 12 | 13 | template 15 | class EigenType> 16 | struct is_Eigen_type 17 | { 18 | static const bool value = false; 19 | }; 20 | 21 | template 22 | struct is_Eigen_type 23 | { 24 | using type = Eigen::Matrix; 25 | static const bool value = true; 26 | }; 27 | 28 | template::value>::type> 30 | class DataContainer 31 | { 32 | public: 33 | using type = DataType; 34 | using value_type = typename DataType::value_type; 35 | 36 | using ConstSharedPtr = const std::shared_ptr; 37 | using SharedPtr = std::shared_ptr; 38 | 39 | DataContainer() { } 40 | ~DataContainer() { } 41 | 42 | void addData( const DataType &data ) 43 | { 44 | return data_vec_.push_back( data ); 45 | } 46 | 47 | void clear() 48 | { 49 | return data_vec_.clear(); 50 | } 51 | 52 | const DataType& getIndexData( const int index ) const 53 | { 54 | return data_vec_[index]; 55 | } 56 | 57 | 58 | int getSize() const 59 | { 60 | return data_vec_.size(); 61 | } 62 | 63 | 64 | bool isEmpty() const 65 | { 66 | return data_vec_.empty(); 67 | } 68 | 69 | const DataType& operator[] (const int i) 70 | { 71 | return data_vec_[i]; 72 | } 73 | 74 | private: 75 | std::vector data_vec_; 76 | 77 | }; 78 | 79 | using ScanContainer = DataContainer; 80 | using ScanContainerD = DataContainer; 81 | 82 | } 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /loop_closure_detection_simulation/build/cmake_install.cmake: -------------------------------------------------------------------------------- 1 | # Install script for directory: /groupdata/share/ddf/Test/robot_test/robot_projects/loop_closure_detection_simulation 2 | 3 | # Set the install prefix 4 | if(NOT DEFINED CMAKE_INSTALL_PREFIX) 5 | set(CMAKE_INSTALL_PREFIX "/usr/local") 6 | endif() 7 | string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") 8 | 9 | # Set the install configuration name. 10 | if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) 11 | if(BUILD_TYPE) 12 | string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" 13 | CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") 14 | else() 15 | set(CMAKE_INSTALL_CONFIG_NAME "RelWithDebInfo") 16 | endif() 17 | message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") 18 | endif() 19 | 20 | # Set the component getting installed. 21 | if(NOT CMAKE_INSTALL_COMPONENT) 22 | if(COMPONENT) 23 | message(STATUS "Install component: \"${COMPONENT}\"") 24 | set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") 25 | else() 26 | set(CMAKE_INSTALL_COMPONENT) 27 | endif() 28 | endif() 29 | 30 | # Install shared libraries without execute permission? 31 | if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) 32 | set(CMAKE_INSTALL_SO_NO_EXE "1") 33 | endif() 34 | 35 | # Is this installation the result of a crosscompile? 36 | if(NOT DEFINED CMAKE_CROSSCOMPILING) 37 | set(CMAKE_CROSSCOMPILING "FALSE") 38 | endif() 39 | 40 | # Set default install directory permissions. 41 | if(NOT DEFINED CMAKE_OBJDUMP) 42 | set(CMAKE_OBJDUMP "/usr/bin/objdump") 43 | endif() 44 | 45 | if(CMAKE_INSTALL_COMPONENT) 46 | set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") 47 | else() 48 | set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") 49 | endif() 50 | 51 | string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT 52 | "${CMAKE_INSTALL_MANIFEST_FILES}") 53 | file(WRITE "/groupdata/share/ddf/Test/robot_test/robot_projects/loop_closure_detection_simulation/build/${CMAKE_INSTALL_MANIFEST}" 54 | "${CMAKE_INSTALL_MANIFEST_CONTENT}") 55 | -------------------------------------------------------------------------------- /navigation_global_path_planning_simulation/include/data_container.h: -------------------------------------------------------------------------------- 1 | #ifndef __DATA_CONTAINER_H_ 2 | #define __DATA_CONTAINER_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace sensor 11 | { 12 | 13 | template 15 | class EigenType> 16 | struct is_Eigen_type 17 | { 18 | static const bool value = false; 19 | }; 20 | 21 | template 22 | struct is_Eigen_type 23 | { 24 | using type = Eigen::Matrix; 25 | static const bool value = true; 26 | }; 27 | 28 | template::value>::type> 30 | class DataContainer 31 | { 32 | public: 33 | using type = DataType; 34 | using value_type = typename DataType::value_type; 35 | 36 | using ConstSharedPtr = const std::shared_ptr; 37 | using SharedPtr = std::shared_ptr; 38 | 39 | DataContainer() { } 40 | ~DataContainer() { } 41 | 42 | void addData( const DataType &data ) 43 | { 44 | return data_vec_.push_back( data ); 45 | } 46 | 47 | void clear() 48 | { 49 | return data_vec_.clear(); 50 | } 51 | 52 | const DataType& getIndexData( const int index ) const 53 | { 54 | return data_vec_[index]; 55 | } 56 | 57 | 58 | int getSize() const 59 | { 60 | return data_vec_.size(); 61 | } 62 | 63 | 64 | bool isEmpty() const 65 | { 66 | return data_vec_.empty(); 67 | } 68 | 69 | const DataType& operator[] (const int i) 70 | { 71 | return data_vec_[i]; 72 | } 73 | 74 | private: 75 | std::vector data_vec_; 76 | 77 | }; 78 | 79 | using ScanContainer = DataContainer; 80 | using ScanContainerD = DataContainer; 81 | 82 | } 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /robot_navigation_global_path_planing/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED( VERSION 3.16 ) 2 | 3 | # Set a default build type if none was specified 4 | IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 5 | MESSAGE("Setting build type to 'RelWithDebInfo' as none was specified.") 6 | SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) 7 | # Set the possible values of build type for cmake-gui 8 | SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") 9 | ENDIF() 10 | 11 | # project name 12 | PROJECT( robot_slam ) 13 | 14 | # 15 | ADD_DEFINITIONS( -std=c++17 ) 16 | 17 | # find required eigen 18 | FIND_PACKAGE( Eigen3 ) 19 | 20 | # directory of eigen headers 21 | INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} ) 22 | 23 | # find required opencv 24 | FIND_PACKAGE( OpenCV REQUIRED ) 25 | 26 | # directory of opencv headers 27 | INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) 28 | 29 | # directory of opencv link libs 30 | LINK_DIRECTORIES(${OpenCV_LIBRARY_DIRS}) 31 | 32 | # headers of this project 33 | INCLUDE_DIRECTORIES( 34 | ${CMAKE_SOURCE_DIR}/include 35 | ${CMAKE_SOURCE_DIR}/include/common 36 | ${CMAKE_SOURCE_DIR}/include/lidar/lidar_include 37 | ${CMAKE_SOURCE_DIR}/include/lidar 38 | ${CMAKE_SOURCE_DIR}/include/odom 39 | ${CMAKE_SOURCE_DIR}/include/slam 40 | ${CMAKE_SOURCE_DIR}/include/device 41 | ${CMAKE_SOURCE_DIR}/include/path_planner 42 | ${CMAKE_SOURCE_DIR}/include/path_tracking 43 | ${CMAKE_SOURCE_DIR}/include/target_planner 44 | ${CMAKE_SOURCE_DIR}/src 45 | ) 46 | 47 | # link directory of this project 48 | LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib) 49 | 50 | # add source files 51 | AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/src src_files) 52 | AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR} src_files) 53 | 54 | # generate executable file 55 | ADD_EXECUTABLE( ${PROJECT_NAME} ${src_files} ) 56 | 57 | # link 58 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} libcspclidar_driver.a pthread) 59 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OpenCV_LIBS}) 60 | 61 | -------------------------------------------------------------------------------- /robot_navigation_local_path_planning/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED( VERSION 3.16 ) 2 | 3 | # Set a default build type if none was specified 4 | IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 5 | MESSAGE("Setting build type to 'RelWithDebInfo' as none was specified.") 6 | SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) 7 | # Set the possible values of build type for cmake-gui 8 | SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") 9 | ENDIF() 10 | 11 | # project name 12 | PROJECT( robot_slam ) 13 | 14 | # 15 | ADD_DEFINITIONS( -std=c++17 ) 16 | 17 | # find required eigen 18 | FIND_PACKAGE( Eigen3 ) 19 | 20 | # directory of eigen headers 21 | INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} ) 22 | 23 | # find required opencv 24 | FIND_PACKAGE( OpenCV REQUIRED ) 25 | 26 | # directory of opencv headers 27 | INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS}) 28 | 29 | # directory of opencv link libs 30 | LINK_DIRECTORIES(${OpenCV_LIBRARY_DIRS}) 31 | 32 | # headers of this project 33 | INCLUDE_DIRECTORIES( 34 | ${CMAKE_SOURCE_DIR}/include 35 | ${CMAKE_SOURCE_DIR}/include/common 36 | ${CMAKE_SOURCE_DIR}/include/lidar/lidar_include 37 | ${CMAKE_SOURCE_DIR}/include/lidar 38 | ${CMAKE_SOURCE_DIR}/include/odom 39 | ${CMAKE_SOURCE_DIR}/include/slam 40 | ${CMAKE_SOURCE_DIR}/include/device 41 | ${CMAKE_SOURCE_DIR}/include/path_planner 42 | ${CMAKE_SOURCE_DIR}/include/path_tracking 43 | ${CMAKE_SOURCE_DIR}/include/target_planner 44 | ${CMAKE_SOURCE_DIR}/src 45 | ) 46 | 47 | # link directory of this project 48 | LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib) 49 | 50 | # add source files 51 | AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/src src_files) 52 | AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR} src_files) 53 | 54 | # generate executable file 55 | ADD_EXECUTABLE( ${PROJECT_NAME} ${src_files} ) 56 | 57 | # link 58 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} libcspclidar_driver.a pthread) 59 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OpenCV_LIBS}) 60 | 61 | -------------------------------------------------------------------------------- /jpeg_stream/main.cpp_cpy3: -------------------------------------------------------------------------------- 1 | #include 2 | #include "image_utils.h" 3 | 4 | #include "image_stream.h" 5 | 6 | extern "C" { 7 | #include "sp_codec.h" 8 | #include "sp_sys.h" 9 | } 10 | // -------------------------- GLOBAL DATA -------------------------- // 11 | stream::ImageStream image_stream; 12 | cv::VideoCapture cap(8); 13 | 14 | void* encoder = nullptr; 15 | 16 | int cnt = 0; 17 | 18 | void imageProcessCallback( cv::Mat& image, char* buffer, int& size ) 19 | { 20 | std::cout<<"recv cnt = "<> image; 22 | if ( image.empty() ) return; 23 | 24 | cv::resize( image, image, cv::Size( WIDTH, HEIGHT ) ); 25 | cv::imshow( "video", image ); 26 | 27 | // cv::Mat to nv12 28 | /*cv::Mat nv12_img; 29 | int c_ret = ImageUtils::BGRToNv12( image, nv12_img ); 30 | std::cout<<"convert ret = "< 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace sensor 11 | { 12 | 13 | template 15 | class EigenType> 16 | struct is_Eigen_type 17 | { 18 | static const bool value = false; 19 | }; 20 | 21 | template 22 | struct is_Eigen_type 23 | { 24 | using type = Eigen::Matrix; 25 | static const bool value = true; 26 | }; 27 | 28 | template::value>::type> 30 | class DataContainer 31 | { 32 | public: 33 | using type = DataType; 34 | using value_type = typename DataType::value_type; 35 | 36 | using ConstSharedPtr = const std::shared_ptr; 37 | using SharedPtr = std::shared_ptr; 38 | 39 | DataContainer() { } 40 | ~DataContainer() { } 41 | 42 | void addData( const DataType &data ) 43 | { 44 | return data_vec_.push_back( data ); 45 | } 46 | 47 | void clear() 48 | { 49 | return data_vec_.clear(); 50 | } 51 | 52 | const DataType& getIndexData( const int index ) const 53 | { 54 | return data_vec_[index]; 55 | } 56 | 57 | 58 | int getSize() const 59 | { 60 | return data_vec_.size(); 61 | } 62 | 63 | 64 | bool isEmpty() const 65 | { 66 | return data_vec_.empty(); 67 | } 68 | 69 | DataType operator[] (const int i) 70 | { 71 | return data_vec_[i]; 72 | } 73 | 74 | private: 75 | std::vector data_vec_; 76 | 77 | }; 78 | 79 | template 80 | using ScanContainerType = DataContainer>; 81 | 82 | using ScanContainer = DataContainer; 83 | using ScanContainerD = DataContainer; 84 | 85 | } 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /2d_cluster_test/include/data_container.h: -------------------------------------------------------------------------------- 1 | #ifndef __DATA_CONTAINER_H_ 2 | #define __DATA_CONTAINER_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace sensor 11 | { 12 | 13 | template 15 | class EigenType> 16 | struct is_Eigen_type 17 | { 18 | static const bool value = false; 19 | }; 20 | 21 | template 22 | struct is_Eigen_type 23 | { 24 | using type = Eigen::Matrix; 25 | static const bool value = true; 26 | }; 27 | 28 | template::value>::type> 30 | class DataContainer 31 | { 32 | public: 33 | using type = DataType; 34 | using value_type = typename DataType::value_type; 35 | 36 | using ConstSharedPtr = const std::shared_ptr; 37 | using SharedPtr = std::shared_ptr; 38 | 39 | DataContainer() { } 40 | ~DataContainer() { } 41 | 42 | void addData( const DataType &data ) 43 | { 44 | return data_vec_.push_back( data ); 45 | } 46 | 47 | void clear() 48 | { 49 | return data_vec_.clear(); 50 | } 51 | 52 | const DataType& getIndexData( const int index ) const 53 | { 54 | return data_vec_[index]; 55 | } 56 | 57 | 58 | int getSize() const 59 | { 60 | return data_vec_.size(); 61 | } 62 | 63 | 64 | bool isEmpty() const 65 | { 66 | return data_vec_.empty(); 67 | } 68 | 69 | DataType operator[] (const int i) 70 | { 71 | return data_vec_[i]; 72 | } 73 | 74 | private: 75 | std::vector data_vec_; 76 | 77 | }; 78 | 79 | template 80 | using ScanContainerType = DataContainer>; 81 | 82 | using ScanContainer = DataContainer; 83 | using ScanContainerD = DataContainer; 84 | 85 | } 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /global_planner/include/data_container.h: -------------------------------------------------------------------------------- 1 | #ifndef __DATA_CONTAINER_H_ 2 | #define __DATA_CONTAINER_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace sensor 11 | { 12 | 13 | template 15 | class EigenType> 16 | struct is_Eigen_type 17 | { 18 | static const bool value = false; 19 | }; 20 | 21 | template 22 | struct is_Eigen_type 23 | { 24 | using type = Eigen::Matrix; 25 | static const bool value = true; 26 | }; 27 | 28 | template::value>::type> 30 | class DataContainer 31 | { 32 | public: 33 | using type = DataType; 34 | using value_type = typename DataType::value_type; 35 | 36 | using ConstSharedPtr = const std::shared_ptr; 37 | using SharedPtr = std::shared_ptr; 38 | 39 | DataContainer() { } 40 | ~DataContainer() { } 41 | 42 | void addData( const DataType &data ) 43 | { 44 | return data_vec_.push_back( data ); 45 | } 46 | 47 | void clear() 48 | { 49 | return data_vec_.clear(); 50 | } 51 | 52 | const DataType& getIndexData( const int index ) const 53 | { 54 | return data_vec_[index]; 55 | } 56 | 57 | 58 | int getSize() const 59 | { 60 | return data_vec_.size(); 61 | } 62 | 63 | 64 | bool isEmpty() const 65 | { 66 | return data_vec_.empty(); 67 | } 68 | 69 | DataType operator[] (const int i) 70 | { 71 | return data_vec_[i]; 72 | } 73 | 74 | private: 75 | std::vector data_vec_; 76 | 77 | }; 78 | 79 | template 80 | using ScanContainerType = DataContainer>; 81 | 82 | using ScanContainer = DataContainer; 83 | using ScanContainerD = DataContainer; 84 | 85 | } 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /jpeg_stream/include/image_stream.h: -------------------------------------------------------------------------------- 1 | #ifndef __IMAGE_STREAM_H 2 | #define __IMAGE_STREAM_H 3 | 4 | #include "EpollEvent.h" 5 | #include "data_transport.h" 6 | #include 7 | 8 | #include 9 | 10 | 11 | #define WIDTH 480 12 | #define HEIGHT 360 13 | 14 | namespace stream 15 | { 16 | 17 | using namespace std::placeholders; 18 | 19 | class ImageStream 20 | { 21 | public: 22 | using CallBackFunc = std::function; 23 | 24 | ImageStream() 25 | { 26 | udp_ = new transport::UdpServer<50>( 3333 ); 27 | 28 | epoll::Event udp_event; 29 | udp_event.fd = udp_->getSocketFd(); 30 | udp_event.event |= EPOLLIN; 31 | udp_event.event |= EPOLLERR; 32 | udp_event.event |= EPOLLET; 33 | udp_event.arg = NULL; 34 | 35 | epoll::FUNC recv_cb = std::bind( &ImageStream::udpRecvCallback, this, _1, _2 ); 36 | udp_event.callback = recv_cb; 37 | 38 | event_base_.addEvent( udp_event ); 39 | } 40 | 41 | ~ImageStream() 42 | { 43 | delete udp_; 44 | } 45 | 46 | void registerCallBack( const CallBackFunc& cb ) 47 | { 48 | cb_ = cb; 49 | } 50 | 51 | void* udpRecvCallback( int fd, void* arg ) 52 | { 53 | int ret = udp_->read(); // receive 54 | 55 | if ( ret > 0 ) { 56 | std::string str = udp_->getRecvBuffer(); 57 | std::cout<<"str = "<write( stream_buffer_, size_ ); 70 | } 71 | } 72 | 73 | return nullptr; 74 | } 75 | 76 | void spin() 77 | { 78 | while ( true ) { 79 | event_base_.dispatcher(); 80 | } 81 | } 82 | 83 | private: 84 | epoll::EpollEvent event_base_; 85 | 86 | transport::UdpServer<50> *udp_ = nullptr; 87 | 88 | CallBackFunc cb_; 89 | 90 | cv::Mat frame_; 91 | char stream_buffer_[WIDTH * HEIGHT]; 92 | int size_ = -1; 93 | }; 94 | 95 | } 96 | 97 | #endif 98 | --------------------------------------------------------------------------------