├── README.md ├── easymqOs_AStar_planning ├── Makefile ├── Mqtt │ ├── CMakeLists.txt │ ├── Makefile │ ├── client_pub_sub.h │ ├── client_shared.c │ ├── client_shared.h │ ├── lib │ │ └── libmosquitto.so │ ├── mosquitto.h │ ├── pub_client.c │ └── sub_client.c ├── astar.jpg ├── easy_mqos.cpp ├── easy_mqos.h ├── inc │ ├── astar.h │ ├── cJSON.h │ ├── osp_common.h │ └── osp_syslog.h ├── main.cpp ├── map.png └── src │ ├── aStar.cpp │ ├── cJSON.c │ └── osp_syslog.c ├── easymqOs_AStar_planning_indoor22 ├── Makefile ├── Mqtt │ ├── CMakeLists.txt │ ├── Makefile │ ├── client_pub_sub.h │ ├── client_shared.c │ ├── client_shared.h │ ├── mosquitto.h │ ├── pub_client.c │ └── sub_client.c ├── astar.jpg ├── easy_mqos.cpp ├── easy_mqos.h ├── inc │ ├── astar.h │ ├── cJSON.h │ ├── osp_common.h │ └── osp_syslog.h ├── main.cpp ├── map.png ├── src │ ├── aStar.cpp │ ├── cJSON.c │ └── osp_syslog.c ├── word.png ├── 中值滤波.png ├── 微信截图_20230712150030.png ├── 微信截图_20230712150148.png ├── 微信截图_20230712173505.png ├── 微信截图_20230712174127.png └── 微信截图_20230715124303.png ├── easymqOs_IMU_node ├── Makefile ├── Mqtt │ ├── client_pub_sub.h │ ├── client_shared.c │ ├── client_shared.h │ ├── lib │ │ └── README.MD │ ├── mosquitto.h │ ├── pub_client.c │ └── sub_client.c ├── README.MD ├── RTIMULib │ ├── CMakeLists.txt │ ├── IMUDrivers │ │ ├── README.MD │ │ ├── RTHumidity.cpp │ │ ├── RTHumidity.h │ │ ├── RTHumidityDefs.h │ │ ├── RTHumidityHTS221.cpp │ │ ├── RTHumidityHTS221.h │ │ ├── RTHumidityHTU21D.cpp │ │ ├── RTHumidityHTU21D.h │ │ ├── RTIMU.cpp │ │ ├── RTIMU.h │ │ ├── RTIMUBMX055.cpp │ │ ├── RTIMUBMX055.h │ │ ├── RTIMUBNO055.cpp │ │ ├── RTIMUBNO055.h │ │ ├── RTIMUDefs.h │ │ ├── RTIMUGD20HM303D.cpp │ │ ├── RTIMUGD20HM303D.h │ │ ├── RTIMUGD20HM303DLHC.cpp │ │ ├── RTIMUGD20HM303DLHC.h │ │ ├── RTIMUGD20M303DLHC.cpp │ │ ├── RTIMUGD20M303DLHC.h │ │ ├── RTIMUGY85.cpp │ │ ├── RTIMUGY85.h │ │ ├── RTIMUHMC5883LADXL345.cpp │ │ ├── RTIMUHMC5883LADXL345.h │ │ ├── RTIMULSM9DS0.cpp │ │ ├── RTIMULSM9DS0.h │ │ ├── RTIMULSM9DS1.cpp │ │ ├── RTIMULSM9DS1.h │ │ ├── RTIMUMPU9150.cpp │ │ ├── RTIMUMPU9150.h │ │ ├── RTIMUMPU9250.cpp │ │ ├── RTIMUMPU9250.h │ │ ├── RTIMUNull.cpp │ │ ├── RTIMUNull.h │ │ ├── RTPressure.cpp │ │ ├── RTPressure.h │ │ ├── RTPressureBMP180.cpp │ │ ├── RTPressureBMP180.h │ │ ├── RTPressureDefs.h │ │ ├── RTPressureLPS25H.cpp │ │ ├── RTPressureLPS25H.h │ │ ├── RTPressureMS5611.cpp │ │ ├── RTPressureMS5611.h │ │ ├── RTPressureMS5637.cpp │ │ └── RTPressureMS5637.h │ ├── RTFusion.cpp │ ├── RTFusion.h │ ├── RTFusionKalman4.cpp │ ├── RTFusionKalman4.h │ ├── RTFusionRTQF.cpp │ ├── RTFusionRTQF.h │ ├── RTIMUAccelCal.cpp │ ├── RTIMUAccelCal.h │ ├── RTIMUCalDefs.h │ ├── RTIMUHal.cpp │ ├── RTIMUHal.h │ ├── RTIMULIB LICENSE │ ├── RTIMULib.h │ ├── RTIMULib.pri │ ├── RTIMULibDefs.h │ ├── RTIMUMagCal.cpp │ ├── RTIMUMagCal.h │ ├── RTIMUSettings.cpp │ ├── RTIMUSettings.h │ ├── RTMath.cpp │ └── RTMath.h ├── easy_mqos.cpp ├── easy_mqos.h ├── inc │ ├── PID_v1.h │ ├── cJSON.h │ ├── imu.h │ ├── kalman.h │ ├── method_parse.h │ ├── osp_common.h │ └── osp_syslog.h ├── main.cpp └── src │ ├── PID_v1.cpp │ ├── cJSON.c │ ├── imu.cpp │ ├── kalman.cpp │ ├── method_parse.cpp │ └── osp_syslog.c ├── easymqOs_base_OdomControl ├── Makefile ├── Mqtt │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.MD │ ├── client_pub_sub.h │ ├── client_shared.c │ ├── client_shared.h │ ├── lib │ │ └── libmosquitto.so │ ├── mosquitto.h │ ├── pub_client.c │ └── sub_client.c ├── README.MD ├── easy_mqos.cpp ├── easy_mqos.h ├── inc │ ├── README.MD │ ├── Uart_comm.h │ ├── cJSON.h │ ├── odometry.h │ ├── osp_common.h │ ├── osp_syslog.h │ ├── rtquaternion.h │ ├── serial.h │ └── stm32_control.h ├── main.cpp └── src │ ├── README.MD │ ├── Uart_comm.c │ ├── cJSON.c │ ├── odometry.cpp │ ├── osp_syslog.c │ ├── rtquaternion.cpp │ └── stm32_control.cpp ├── easymqOs_collect_datas ├── LICENSE ├── Makefile ├── Mqtt │ ├── CMakeLists.txt │ ├── Makefile │ ├── client_pub_sub.h │ ├── client_shared.c │ ├── client_shared.h │ ├── lib │ │ └── libmosquitto.so │ ├── mosquitto.h │ ├── pub_client.c │ └── sub_client.c ├── README.MD ├── easy_mqos.cpp ├── easy_mqos.h ├── inc │ ├── cJSON.h │ ├── ekf.h.bak │ ├── kalman.h │ ├── osp_common.h │ ├── osp_syslog.h │ ├── rtquaternion.h │ └── sensor_msg.h ├── main.cpp └── src │ ├── cJSON.c │ ├── ekf.cpp.bak │ ├── init_ekf.cpp.bak │ ├── kalman.cpp │ ├── osp_syslog.c │ └── rtquaternion.cpp ├── easymqOs_detectDistance_3sonars ├── LICENSE ├── Makefile ├── Mqtt │ ├── CMakeLists.txt │ ├── Makefile │ ├── client_pub_sub.h │ ├── client_shared.c │ ├── client_shared.d │ ├── client_shared.h │ ├── client_shared.o │ ├── mosquitto.h │ ├── pub_client.c │ ├── pub_client.d │ ├── pub_client.o │ ├── sub_client.c │ ├── sub_client.d │ └── sub_client.o ├── easy_mqos.cpp ├── easy_mqos.h ├── inc │ ├── cJSON.h │ ├── osp_common.h │ ├── osp_syslog.h │ └── sonars.h ├── main.cpp └── src │ ├── cJSON.c │ ├── osp_syslog.c │ └── sonars.cpp ├── easymqOs_detectDistance_vl53 ├── LICENSE ├── Makefile ├── Mqtt │ ├── CMakeLists.txt │ ├── Makefile │ ├── client_pub_sub.h │ ├── client_shared.c │ ├── client_shared.d │ ├── client_shared.h │ ├── client_shared.o │ ├── mosquitto.h │ ├── pub_client.c │ ├── pub_client.d │ ├── pub_client.o │ ├── sub_client.c │ ├── sub_client.d │ └── sub_client.o ├── easy_mqos.cpp ├── easy_mqos.h ├── inc │ ├── VL53_interface.h │ ├── cJSON.h │ ├── osp_common.h │ ├── osp_syslog.h │ └── vl53_common.h ├── main.cpp ├── src │ ├── cJSON.c │ ├── osp_syslog.c │ ├── vl53_1.c │ ├── vl53_2.c │ └── vl53_3.c └── 微信截图_20230424141606.png ├── easymqOs_gpsKalmanfilter ├── Makefile ├── Mqtt │ ├── CMakeLists.txt │ ├── Makefile │ ├── client_pub_sub.h │ ├── client_shared.c │ ├── client_shared.h │ ├── lib │ │ └── libmosquitto.so │ ├── mosquitto.h │ ├── pub_client.c │ └── sub_client.c ├── README.MD ├── data │ ├── filtered_data.txt │ ├── plot.py │ └── raw_data.txt ├── easy_mqos.cpp ├── easy_mqos.h ├── gps_srcs │ ├── coordinate_sys.cpp │ ├── d │ ├── gps_apply.cpp │ ├── gps_apply.h │ ├── gps_kalman.cpp │ ├── gps_kalman.h │ ├── gps_main.cpp │ ├── gps_main.h │ ├── gpsparser.h │ ├── matrix.cpp │ └── matrix.h ├── inc │ ├── README.MD │ ├── Uart_comm.h │ ├── cJSON.h │ ├── coordinate_sys.h │ ├── geocoords.h │ ├── method_parse.h │ └── serial.h ├── main.cpp └── src │ ├── README.MD │ ├── cJSON.c │ ├── geocoords.cpp │ └── method_parse.cpp ├── easymqOs_lidarA1_node ├── LidarDemo │ ├── README.MD │ ├── RPLidar.cpp │ ├── RPLidar.h │ ├── hardwareserial.cpp │ ├── hardwareserial.h │ ├── inc │ │ ├── README.MD │ │ ├── rplidar_cmd.h │ │ ├── rplidar_protocol.h │ │ └── rptypes.h │ └── makefile ├── Makefile ├── Mqtt │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.MD │ ├── client_pub_sub.h │ ├── client_shared.c │ ├── client_shared.h │ ├── lib │ │ └── libmosquitto.so │ ├── mosquitto.h │ ├── pub_client.c │ └── sub_client.c ├── README.MD ├── easy_mqos.cpp ├── easy_mqos.h ├── inc │ ├── README.MD │ ├── cJSON.h │ ├── getlidars.h │ ├── method_parse.h │ ├── osp_common.h │ └── osp_syslog.h ├── main.cpp └── src │ ├── README.MD │ ├── cJSON.c │ ├── getlidars.cpp │ ├── method_parse.cpp │ └── osp_syslog.c ├── easymqOs_lidardelta2_node ├── LidarDemo │ ├── app │ │ └── node.cpp │ ├── include │ │ ├── C3iroboticsLidar.h │ │ ├── C3iroboticsLidarProtocol.h │ │ ├── CArcTime.h │ │ ├── CCountDown.h │ │ ├── CDeviceConnection.h │ │ ├── CLidarPacket.h │ │ ├── CLidarPacketReceiver.h │ │ ├── CLidarUnpacket.h │ │ ├── CLogUtitls.h │ │ ├── CSerialConnection.h │ │ ├── CSimulateSerial.h │ │ ├── CTime.h │ │ └── typedef.h │ └── src │ │ ├── C3iroboticsLidar.cpp │ │ ├── CArcTime.cpp │ │ ├── CCountDown.cpp │ │ ├── CDeviceConnection.cpp │ │ ├── CLidarPacket.cpp │ │ ├── CLidarPacketReceiver.cpp │ │ ├── CLidarUnpacket.cpp │ │ ├── CSerialConnection.cpp │ │ ├── CSimulateSerial.cpp │ │ └── CTime.cpp ├── Makefile ├── Mqtt │ ├── CMakeLists.txt │ ├── Makefile │ ├── client_pub_sub.h │ ├── client_shared.c │ ├── client_shared.h │ ├── mosquitto.h │ ├── pub_client.c │ └── sub_client.c ├── easy_mqos.cpp ├── easy_mqos.h ├── inc │ ├── cJSON.h │ ├── getlidars.h │ ├── method_parse.h │ ├── osp_common.h │ └── osp_syslog.h ├── main.cpp ├── readme.MD ├── sn.txt └── src │ ├── cJSON.c │ ├── getlidars.cpp │ ├── method_parse.cpp │ └── osp_syslog.c ├── easymqOs_navigation ├── Makefile ├── Mqtt │ ├── CMakeLists.txt │ ├── Makefile │ ├── client_pub_sub.h │ ├── client_shared.c │ ├── client_shared.h │ ├── mosquitto.h │ ├── pub_client.c │ └── sub_client.c ├── easy_mqos.cpp ├── easy_mqos.h ├── inc │ ├── cJSON.h │ ├── ekf.h.bak │ ├── kalman.h │ ├── mydwa.h │ ├── osp_common.h │ ├── osp_syslog.h │ ├── rtquaternion.h │ ├── sensor_msg.h │ └── simple_navigation.h ├── main.cpp ├── src │ ├── cJSON.c │ ├── dwa2.jpg │ ├── kalman.cpp │ ├── mydwa.cpp │ ├── osp_syslog.c │ └── simple_navigation.cpp └── word.png ├── easymqOs_odom_imu_fusion ├── Makefile ├── Mqtt │ ├── CMakeLists.txt │ ├── Makefile │ ├── client_pub_sub.h │ ├── client_shared.c │ ├── client_shared.h │ ├── lib │ │ └── libmosquitto.so │ ├── mosquitto.h │ ├── pub_client.c │ └── sub_client.c ├── README.MD ├── easy_mqos.cpp ├── easy_mqos.h ├── inc │ ├── cJSON.h │ ├── ekf.h.bak │ ├── kalman.h │ ├── osp_common.h │ ├── osp_syslog.h │ ├── rtquaternion.h │ ├── sensor_msg.h │ └── simple_fusion.h ├── main.cpp └── src │ ├── cJSON.c │ ├── ekf.cpp.bak │ ├── init_ekf.cpp.bak │ ├── kalman.cpp │ ├── osp_syslog.c │ ├── rtquaternion.cpp │ └── simple_fusion.cpp ├── easymqOs_opticalFlow_gl9306 ├── Makefile ├── Mqtt │ ├── CMakeLists.txt │ ├── Makefile │ ├── client_pub_sub.h │ ├── client_shared.c │ ├── client_shared.h │ ├── lib │ │ └── libmosquitto.so │ ├── mosquitto.h │ ├── pub_client.c │ └── sub_client.c ├── README.MD ├── easy_mqos ├── easy_mqos.cpp ├── easy_mqos.h ├── inc │ ├── Uart_comm.h │ ├── cJSON.h │ ├── odometry.h │ ├── opticalflow_control.h │ ├── osp_common.h │ ├── osp_syslog.h │ ├── rtquaternion.h │ └── serial.h ├── main.cpp └── src │ ├── Uart_comm.c │ ├── cJSON.c │ ├── odometry.cpp │ ├── opticalflow_control.cpp │ ├── osp_syslog.c │ └── rtquaternion.cpp ├── easymqos_waypoint_save └── README.MD ├── img ├── 1.png ├── 640.png ├── 640img.png ├── 640windows.png ├── 712my1.png ├── 712my2.png ├── dianjiqudognmban.png ├── opirobot_kt.png ├── readme.md ├── robot.png ├── 中值滤波.png └── 微信截图_20230712173505.png ├── orangepizero2 ├── easymqOs_oledssd1306 │ ├── LICENSE │ ├── Makefile │ ├── Mqtt │ │ ├── CMakeLists.txt │ │ ├── Makefile │ │ ├── client_pub_sub.h │ │ ├── client_shared.c │ │ ├── client_shared.d │ │ ├── client_shared.h │ │ ├── client_shared.o │ │ ├── mosquitto.h │ │ ├── pub_client.c │ │ ├── pub_client.d │ │ ├── pub_client.o │ │ ├── sub_client.c │ │ ├── sub_client.d │ │ └── sub_client.o │ ├── easy_mqos.cpp │ ├── easy_mqos.h │ ├── inc │ │ ├── BMM150.h │ │ ├── bmm150_defs.h │ │ ├── bmp.h │ │ ├── cJSON.h │ │ ├── oled_common.h │ │ ├── oled_interface.h │ │ ├── oledfont.h │ │ ├── osp_common.h │ │ └── osp_syslog.h │ ├── main.cpp │ └── src │ │ ├── BMM150.c │ │ ├── cJSON.c │ │ ├── oled.c │ │ └── osp_syslog.c └── readme.md ├── python ├── 1.png ├── FastestDet.onnx ├── README.MD ├── coco.names ├── collect_image.py ├── receive_mqtt.py └── video_detect.py ├── pytorch └── neural_network_avoidance │ ├── README.MD │ └── runAvodance_mqtt_arch.py └── web ├── README.MD ├── baidumap ├── README.MD ├── car.png ├── car2.png ├── greenball.png ├── j.png ├── map_car_new.html ├── pic.png ├── redball.png └── waypoint.png ├── compass ├── compass.html ├── hammer.min.js ├── raphael.js └── raphael.min.js ├── js ├── README.MD ├── jquery.min.js ├── mqttws31.js └── paho-mqtt.js ├── tractorymap ├── README.MD ├── index.html ├── index_camer_map.html ├── index_camera.html ├── index_indoor.html └── outside_camera.html ├── twist └── twist.html └── 微信截图_20230608102444.png /easymqOs_AStar_planning/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_AStar_planning/Makefile -------------------------------------------------------------------------------- /easymqOs_AStar_planning/Mqtt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${mosquitto_SOURCE_DIR}/lib 2 | ${STDBOOL_H_PATH} ${STDINT_H_PATH}) 3 | link_directories(${mosquitto_BINARY_DIR}/lib) 4 | 5 | set(shared_src client_shared.c client_shared.h) 6 | 7 | if (${WITH_SRV} STREQUAL ON) 8 | add_definitions("-DWITH_SRV") 9 | endif (${WITH_SRV} STREQUAL ON) 10 | 11 | add_executable(mosquitto_pub pub_client.c ${shared_src}) 12 | add_executable(mosquitto_sub sub_client.c ${shared_src}) 13 | 14 | target_link_libraries(mosquitto_pub libmosquitto) 15 | target_link_libraries(mosquitto_sub libmosquitto) 16 | 17 | install(TARGETS mosquitto_pub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 18 | install(TARGETS mosquitto_sub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 19 | -------------------------------------------------------------------------------- /easymqOs_AStar_planning/Mqtt/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CLIENT_LDFLAGS += -L./Mqtt/lib -lmosquitto -I. 5 | .PHONY: all install uninstall reallyclean clean 6 | 7 | all : mosquitto_pub mosquitto_sub 8 | 9 | mosquitto_pub : pub_client.o client_shared.o 10 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 11 | 12 | mosquitto_sub : sub_client.o client_shared.o 13 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 14 | 15 | pub_client.o : pub_client.c libmosquitto.so 16 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 17 | 18 | sub_client.o : sub_client.c libmosquitto.so 19 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 20 | 21 | client_shared.o : client_shared.c client_shared.h 22 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 23 | 24 | 25 | 26 | install : all 27 | $(INSTALL) -d ${DESTDIR}$(prefix)/bin 28 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_pub ${DESTDIR}${prefix}/bin/mosquitto_pub 29 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_sub ${DESTDIR}${prefix}/bin/mosquitto_sub 30 | 31 | uninstall : 32 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_pub 33 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_sub 34 | 35 | reallyclean : clean 36 | 37 | clean : 38 | -rm -f *.o mosquitto_pub mosquitto_sub 39 | -------------------------------------------------------------------------------- /easymqOs_AStar_planning/Mqtt/client_pub_sub.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIENT_PUB_SUB_H 2 | #define CLIENT_PUB_SUB_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | //extern int mainSub(int argc, char * argv [ ]); 8 | extern int mainSub(struct mosq_config *cfgon , char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 9 | extern int mainPub(struct mosq_config *cfgon, char *devid); 10 | extern int publish_message(unsigned int msglength,char *msg); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /easymqOs_AStar_planning/Mqtt/client_shared.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Roger Light 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License v1.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | http://www.eclipse.org/legal/epl-v10.html 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | Contributors: 14 | Roger Light - initial implementation and documentation. 15 | */ 16 | 17 | #ifndef _CLIENT_CONFIG_H 18 | #define _CLIENT_CONFIG_H 19 | 20 | #include 21 | 22 | /* pub_client.c modes */ 23 | #define MSGMODE_NONE 0 24 | #define MSGMODE_CMD 1 25 | #define MSGMODE_STDIN_LINE 2 26 | #define MSGMODE_STDIN_FILE 3 27 | #define MSGMODE_FILE 4 28 | #define MSGMODE_NULL 5 29 | 30 | #define CLIENT_PUB 1 31 | #define CLIENT_SUB 2 32 | 33 | struct mosq_config { 34 | char *id; 35 | char *id_prefix; 36 | int protocol_version; 37 | int keepalive; 38 | char *host; 39 | int port; 40 | int qos; 41 | bool retain; 42 | int pub_mode; /* pub */ 43 | char *file_input; /* pub */ 44 | char *message; /* pub */ 45 | long msglen; /* pub */ 46 | char *topic; /* pub */ 47 | char *bind_address; 48 | #ifdef WITH_SRV 49 | bool use_srv; 50 | #endif 51 | bool debug; 52 | bool quiet; 53 | unsigned int max_inflight; 54 | char *username; 55 | char *password; 56 | char *will_topic; 57 | char *will_payload; 58 | long will_payloadlen; 59 | int will_qos; 60 | bool will_retain; 61 | #ifdef WITH_TLS 62 | char *cafile; 63 | char *capath; 64 | char *certfile; 65 | char *keyfile; 66 | char *ciphers; 67 | bool insecure; 68 | char *tls_version; 69 | # ifdef WITH_TLS_PSK 70 | char *psk; 71 | char *psk_identity; 72 | # endif 73 | #endif 74 | bool clean_session; /* sub */ 75 | char **topics; /* sub */ 76 | int topic_count; /* sub */ 77 | bool no_retain; /* sub */ 78 | char **filter_outs; /* sub */ 79 | int filter_out_count; /* sub */ 80 | bool verbose; /* sub */ 81 | bool eol; /* sub */ 82 | int msg_count; /* sub */ 83 | #ifdef WITH_SOCKS 84 | char *socks5_host; 85 | int socks5_port; 86 | char *socks5_username; 87 | char *socks5_password; 88 | #endif 89 | }; 90 | 91 | int client_config_load(struct mosq_config *config, int pub_or_sub, int argc, char *argv[]); 92 | void client_config_cleanup(struct mosq_config *cfg); 93 | int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg); 94 | int client_id_generate(struct mosq_config *cfg, const char *id_base); 95 | int client_connect(struct mosquitto *mosq, struct mosq_config *cfg); 96 | //int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, char *argv[]); 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /easymqOs_AStar_planning/Mqtt/lib/libmosquitto.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_AStar_planning/Mqtt/lib/libmosquitto.so -------------------------------------------------------------------------------- /easymqOs_AStar_planning/astar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_AStar_planning/astar.jpg -------------------------------------------------------------------------------- /easymqOs_AStar_planning/easy_mqos.h: -------------------------------------------------------------------------------- 1 | #ifndef EASY_MQOS_H 2 | #define EASY_MQOS_H 3 | 4 | #include 5 | #include 6 | #include "Mqtt/client_shared.h" 7 | #include "Mqtt/mosquitto.h" 8 | using namespace std; 9 | class easymqos 10 | { 11 | 12 | public: 13 | easymqos(); 14 | easymqos(int pub_or_sub ); 15 | ~easymqos(); 16 | 17 | //初始化系统 18 | bool Init_Sub(vector _topic); 19 | bool Start_Sub(char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 20 | bool Init_Pub(char* _topic); 21 | bool Set_config_Pub(); 22 | bool Set_broker(char* host); 23 | unsigned int publish_messages(unsigned int len,string message); 24 | 25 | public: 26 | vector _topicStr; 27 | // struct mosq_config *subscribeCfg; 28 | // struct mosq_config *publicCfg; 29 | struct mosq_config *cfg; 30 | int _topicCnt_sub; 31 | 32 | }; 33 | 34 | 35 | 36 | 37 | #endif -------------------------------------------------------------------------------- /easymqOs_AStar_planning/inc/astar.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASTAR_H 2 | #define _ASTAR_H 3 | 4 | //起始点定义 5 | extern int start_point_x;//在这改动图像和二维数组的关系 6 | extern int start_point_y ; 7 | //目标点定义 8 | extern int goal_point_x; 9 | extern int goal_point_y; 10 | extern char start_find; 11 | extern void *findPathAstar_task(void*); 12 | extern void path_public_callback(std::vector msg); 13 | #endif -------------------------------------------------------------------------------- /easymqOs_AStar_planning/map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_AStar_planning/map.png -------------------------------------------------------------------------------- /easymqOs_AStar_planning_indoor22/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_AStar_planning_indoor22/Makefile -------------------------------------------------------------------------------- /easymqOs_AStar_planning_indoor22/Mqtt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${mosquitto_SOURCE_DIR}/lib 2 | ${STDBOOL_H_PATH} ${STDINT_H_PATH}) 3 | link_directories(${mosquitto_BINARY_DIR}/lib) 4 | 5 | set(shared_src client_shared.c client_shared.h) 6 | 7 | if (${WITH_SRV} STREQUAL ON) 8 | add_definitions("-DWITH_SRV") 9 | endif (${WITH_SRV} STREQUAL ON) 10 | 11 | add_executable(mosquitto_pub pub_client.c ${shared_src}) 12 | add_executable(mosquitto_sub sub_client.c ${shared_src}) 13 | 14 | target_link_libraries(mosquitto_pub libmosquitto) 15 | target_link_libraries(mosquitto_sub libmosquitto) 16 | 17 | install(TARGETS mosquitto_pub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 18 | install(TARGETS mosquitto_sub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 19 | -------------------------------------------------------------------------------- /easymqOs_AStar_planning_indoor22/Mqtt/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CLIENT_LDFLAGS += -L./Mqtt/lib -lmosquitto -I. 5 | .PHONY: all install uninstall reallyclean clean 6 | 7 | all : mosquitto_pub mosquitto_sub 8 | 9 | mosquitto_pub : pub_client.o client_shared.o 10 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 11 | 12 | mosquitto_sub : sub_client.o client_shared.o 13 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 14 | 15 | pub_client.o : pub_client.c libmosquitto.so 16 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 17 | 18 | sub_client.o : sub_client.c libmosquitto.so 19 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 20 | 21 | client_shared.o : client_shared.c client_shared.h 22 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 23 | 24 | 25 | 26 | install : all 27 | $(INSTALL) -d ${DESTDIR}$(prefix)/bin 28 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_pub ${DESTDIR}${prefix}/bin/mosquitto_pub 29 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_sub ${DESTDIR}${prefix}/bin/mosquitto_sub 30 | 31 | uninstall : 32 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_pub 33 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_sub 34 | 35 | reallyclean : clean 36 | 37 | clean : 38 | -rm -f *.o mosquitto_pub mosquitto_sub 39 | -------------------------------------------------------------------------------- /easymqOs_AStar_planning_indoor22/Mqtt/client_pub_sub.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIENT_PUB_SUB_H 2 | #define CLIENT_PUB_SUB_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | //extern int mainSub(int argc, char * argv [ ]); 8 | extern int mainSub(struct mosq_config *cfgon , char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 9 | extern int mainPub(struct mosq_config *cfgon, char *devid); 10 | extern int publish_message(unsigned int msglength,char *msg); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /easymqOs_AStar_planning_indoor22/Mqtt/client_shared.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Roger Light 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License v1.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | http://www.eclipse.org/legal/epl-v10.html 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | Contributors: 14 | Roger Light - initial implementation and documentation. 15 | */ 16 | 17 | #ifndef _CLIENT_CONFIG_H 18 | #define _CLIENT_CONFIG_H 19 | 20 | #include 21 | 22 | /* pub_client.c modes */ 23 | #define MSGMODE_NONE 0 24 | #define MSGMODE_CMD 1 25 | #define MSGMODE_STDIN_LINE 2 26 | #define MSGMODE_STDIN_FILE 3 27 | #define MSGMODE_FILE 4 28 | #define MSGMODE_NULL 5 29 | 30 | #define CLIENT_PUB 1 31 | #define CLIENT_SUB 2 32 | 33 | struct mosq_config { 34 | char *id; 35 | char *id_prefix; 36 | int protocol_version; 37 | int keepalive; 38 | char *host; 39 | int port; 40 | int qos; 41 | bool retain; 42 | int pub_mode; /* pub */ 43 | char *file_input; /* pub */ 44 | char *message; /* pub */ 45 | long msglen; /* pub */ 46 | char *topic; /* pub */ 47 | char *bind_address; 48 | #ifdef WITH_SRV 49 | bool use_srv; 50 | #endif 51 | bool debug; 52 | bool quiet; 53 | unsigned int max_inflight; 54 | char *username; 55 | char *password; 56 | char *will_topic; 57 | char *will_payload; 58 | long will_payloadlen; 59 | int will_qos; 60 | bool will_retain; 61 | #ifdef WITH_TLS 62 | char *cafile; 63 | char *capath; 64 | char *certfile; 65 | char *keyfile; 66 | char *ciphers; 67 | bool insecure; 68 | char *tls_version; 69 | # ifdef WITH_TLS_PSK 70 | char *psk; 71 | char *psk_identity; 72 | # endif 73 | #endif 74 | bool clean_session; /* sub */ 75 | char **topics; /* sub */ 76 | int topic_count; /* sub */ 77 | bool no_retain; /* sub */ 78 | char **filter_outs; /* sub */ 79 | int filter_out_count; /* sub */ 80 | bool verbose; /* sub */ 81 | bool eol; /* sub */ 82 | int msg_count; /* sub */ 83 | #ifdef WITH_SOCKS 84 | char *socks5_host; 85 | int socks5_port; 86 | char *socks5_username; 87 | char *socks5_password; 88 | #endif 89 | }; 90 | 91 | int client_config_load(struct mosq_config *config, int pub_or_sub, int argc, char *argv[]); 92 | void client_config_cleanup(struct mosq_config *cfg); 93 | int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg); 94 | int client_id_generate(struct mosq_config *cfg, const char *id_base); 95 | int client_connect(struct mosquitto *mosq, struct mosq_config *cfg); 96 | //int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, char *argv[]); 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /easymqOs_AStar_planning_indoor22/astar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_AStar_planning_indoor22/astar.jpg -------------------------------------------------------------------------------- /easymqOs_AStar_planning_indoor22/easy_mqos.h: -------------------------------------------------------------------------------- 1 | #ifndef EASY_MQOS_H 2 | #define EASY_MQOS_H 3 | 4 | #include 5 | #include 6 | #include "Mqtt/client_shared.h" 7 | #include "Mqtt/mosquitto.h" 8 | using namespace std; 9 | class easymqos 10 | { 11 | 12 | public: 13 | easymqos(); 14 | easymqos(int pub_or_sub ); 15 | ~easymqos(); 16 | 17 | //初始化系统 18 | bool Init_Sub(vector _topic); 19 | bool Start_Sub(char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 20 | bool Init_Pub(char* _topic); 21 | bool Set_config_Pub(); 22 | bool Set_broker(char* host); 23 | unsigned int publish_messages(unsigned int len,string message); 24 | 25 | public: 26 | vector _topicStr; 27 | // struct mosq_config *subscribeCfg; 28 | // struct mosq_config *publicCfg; 29 | struct mosq_config *cfg; 30 | int _topicCnt_sub; 31 | 32 | }; 33 | 34 | 35 | 36 | 37 | #endif -------------------------------------------------------------------------------- /easymqOs_AStar_planning_indoor22/inc/astar.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASTAR_H 2 | #define _ASTAR_H 3 | 4 | //起始点定义 5 | extern int start_point_x;//在这改动图像和二维数组的关系 6 | extern int start_point_y ; 7 | //目标点定义 8 | extern int goal_point_x; 9 | extern int goal_point_y; 10 | extern char start_find; 11 | extern void *findPathAstar_task(void*); 12 | extern void path_public_callback(std::vector msg); 13 | #endif -------------------------------------------------------------------------------- /easymqOs_AStar_planning_indoor22/map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_AStar_planning_indoor22/map.png -------------------------------------------------------------------------------- /easymqOs_AStar_planning_indoor22/word.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_AStar_planning_indoor22/word.png -------------------------------------------------------------------------------- /easymqOs_AStar_planning_indoor22/中值滤波.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_AStar_planning_indoor22/中值滤波.png -------------------------------------------------------------------------------- /easymqOs_AStar_planning_indoor22/微信截图_20230712150030.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_AStar_planning_indoor22/微信截图_20230712150030.png -------------------------------------------------------------------------------- /easymqOs_AStar_planning_indoor22/微信截图_20230712150148.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_AStar_planning_indoor22/微信截图_20230712150148.png -------------------------------------------------------------------------------- /easymqOs_AStar_planning_indoor22/微信截图_20230712173505.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_AStar_planning_indoor22/微信截图_20230712173505.png -------------------------------------------------------------------------------- /easymqOs_AStar_planning_indoor22/微信截图_20230712174127.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_AStar_planning_indoor22/微信截图_20230712174127.png -------------------------------------------------------------------------------- /easymqOs_AStar_planning_indoor22/微信截图_20230715124303.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_AStar_planning_indoor22/微信截图_20230715124303.png -------------------------------------------------------------------------------- /easymqOs_IMU_node/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_IMU_node/Makefile -------------------------------------------------------------------------------- /easymqOs_IMU_node/Mqtt/client_pub_sub.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIENT_PUB_SUB_H 2 | #define CLIENT_PUB_SUB_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | //extern int mainSub(int argc, char * argv [ ]); 8 | extern int mainSub(struct mosq_config *cfgon , char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 9 | extern int mainPub(struct mosq_config *cfgon, char *devid); 10 | extern int publish_message(unsigned int msglength,char *msg); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/Mqtt/client_shared.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Roger Light 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License v1.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | http://www.eclipse.org/legal/epl-v10.html 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | Contributors: 14 | Roger Light - initial implementation and documentation. 15 | */ 16 | 17 | #ifndef _CLIENT_CONFIG_H 18 | #define _CLIENT_CONFIG_H 19 | 20 | #include 21 | 22 | /* pub_client.c modes */ 23 | #define MSGMODE_NONE 0 24 | #define MSGMODE_CMD 1 25 | #define MSGMODE_STDIN_LINE 2 26 | #define MSGMODE_STDIN_FILE 3 27 | #define MSGMODE_FILE 4 28 | #define MSGMODE_NULL 5 29 | 30 | #define CLIENT_PUB 1 31 | #define CLIENT_SUB 2 32 | 33 | struct mosq_config { 34 | char *id; 35 | char *id_prefix; 36 | int protocol_version; 37 | int keepalive; 38 | char *host; 39 | int port; 40 | int qos; 41 | bool retain; 42 | int pub_mode; /* pub */ 43 | char *file_input; /* pub */ 44 | char *message; /* pub */ 45 | long msglen; /* pub */ 46 | char *topic; /* pub */ 47 | char *bind_address; 48 | #ifdef WITH_SRV 49 | bool use_srv; 50 | #endif 51 | bool debug; 52 | bool quiet; 53 | unsigned int max_inflight; 54 | char *username; 55 | char *password; 56 | char *will_topic; 57 | char *will_payload; 58 | long will_payloadlen; 59 | int will_qos; 60 | bool will_retain; 61 | #ifdef WITH_TLS 62 | char *cafile; 63 | char *capath; 64 | char *certfile; 65 | char *keyfile; 66 | char *ciphers; 67 | bool insecure; 68 | char *tls_version; 69 | # ifdef WITH_TLS_PSK 70 | char *psk; 71 | char *psk_identity; 72 | # endif 73 | #endif 74 | bool clean_session; /* sub */ 75 | char **topics; /* sub */ 76 | int topic_count; /* sub */ 77 | bool no_retain; /* sub */ 78 | char **filter_outs; /* sub */ 79 | int filter_out_count; /* sub */ 80 | bool verbose; /* sub */ 81 | bool eol; /* sub */ 82 | int msg_count; /* sub */ 83 | #ifdef WITH_SOCKS 84 | char *socks5_host; 85 | int socks5_port; 86 | char *socks5_username; 87 | char *socks5_password; 88 | #endif 89 | }; 90 | 91 | int client_config_load(struct mosq_config *config, int pub_or_sub, int argc, char *argv[]); 92 | void client_config_cleanup(struct mosq_config *cfg); 93 | int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg); 94 | int client_id_generate(struct mosq_config *cfg, const char *id_base); 95 | int client_connect(struct mosquitto *mosq, struct mosq_config *cfg); 96 | //int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, char *argv[]); 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/Mqtt/lib/README.MD: -------------------------------------------------------------------------------- 1 | in this path you need a mosquitto lib libmosquitto.so ,or soft link . 2 | 本路径下需要添加对应环境的的 mosquitto 的库,libmosquitto.so。或者创建软链接。 3 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/README.MD: -------------------------------------------------------------------------------- 1 | IMU TOPIC NODE 2 | # easyMQOS imu  node 3 | git clone this code 4 | cd easymqOs_IMU_node 5 | make 6 | ./imu_node_pub 7 | 8 | 9 | 下载本代码,然后执行make 编译,执行程序。 10 | 在生成的RTIMULIB.ini中找到iic的端口号 并修改或者从校准程序获取rtimulib.ini 讲ini 文件拷贝到该路径下。 11 | 12 | 该程序的执行效果如 13 | https://zhuanlan.zhihu.com/p/584855452 14 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/RTIMULib/IMUDrivers/README.MD: -------------------------------------------------------------------------------- 1 | all imu sensors 2 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/RTIMULib/IMUDrivers/RTHumidity.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // This file is part of RTIMULib 4 | // 5 | // Copyright (c) 2014-2015, richards-tech, LLC 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to use, 10 | // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 11 | // Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 18 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 19 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | 25 | #include "RTHumidity.h" 26 | 27 | #include "RTHumidityHTS221.h" 28 | #include "RTHumidityHTU21D.h" 29 | 30 | RTHumidity *RTHumidity::createHumidity(RTIMUSettings *settings) 31 | { 32 | switch (settings->m_humidityType) { 33 | case RTHUMIDITY_TYPE_HTS221: 34 | return new RTHumidityHTS221(settings); 35 | 36 | case RTHUMIDITY_TYPE_HTU21D: 37 | return new RTHumidityHTU21D(settings); 38 | 39 | case RTHUMIDITY_TYPE_AUTODISCOVER: 40 | if (settings->discoverHumidity(settings->m_humidityType, settings->m_I2CHumidityAddress)) { 41 | settings->saveSettings(); 42 | return RTHumidity::createHumidity(settings); 43 | } 44 | return NULL; 45 | 46 | case RTHUMIDITY_TYPE_NULL: 47 | return NULL; 48 | 49 | default: 50 | return NULL; 51 | } 52 | } 53 | 54 | 55 | RTHumidity::RTHumidity(RTIMUSettings *settings) 56 | { 57 | m_settings = settings; 58 | } 59 | 60 | RTHumidity::~RTHumidity() 61 | { 62 | } 63 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/RTIMULib/IMUDrivers/RTHumidity.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // This file is part of RTIMULib 4 | // 5 | // Copyright (c) 2014-2015, richards-tech, LLC 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to use, 10 | // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 11 | // Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 18 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 19 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #ifndef _RTHUMIDITY_H 25 | #define _RTHUMIDITY_H 26 | 27 | #include "RTIMUSettings.h" 28 | #include "RTIMULibDefs.h" 29 | #include "RTHumidityDefs.h" 30 | 31 | class RTHumidity 32 | { 33 | public: 34 | // Humidity sensor objects should always be created with the following call 35 | 36 | static RTHumidity *createHumidity(RTIMUSettings *settings); 37 | 38 | // Constructor/destructor 39 | 40 | RTHumidity(RTIMUSettings *settings); 41 | virtual ~RTHumidity(); 42 | 43 | // These functions must be provided by sub classes 44 | 45 | virtual const char *humidityName() = 0; // the name of the humidity sensor 46 | virtual int humidityType() = 0; // the type code of the humidity sensor 47 | virtual bool humidityInit() = 0; // set up the humidity sensor 48 | virtual bool humidityRead(RTIMU_DATA& data) = 0; // get latest value 49 | 50 | protected: 51 | RTIMUSettings *m_settings; // the settings object pointer 52 | 53 | }; 54 | 55 | #endif // _RTHUMIDITY_H 56 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/RTIMULib/IMUDrivers/RTHumidityHTS221.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // This file is part of RTIMULib 4 | // 5 | // Copyright (c) 2014-2015, richards-tech, LLC 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to use, 10 | // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 11 | // Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 18 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 19 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #ifndef _RTHUMIDITYHTS221_H_ 25 | #define _RTHUMIDITYHTS221_H_ 26 | 27 | #include "RTHumidity.h" 28 | 29 | class RTIMUSettings; 30 | 31 | class RTHumidityHTS221 : public RTHumidity 32 | { 33 | public: 34 | RTHumidityHTS221(RTIMUSettings *settings); 35 | ~RTHumidityHTS221(); 36 | 37 | virtual const char *humidityName() { return "HTS221"; } 38 | virtual int humidityType() { return RTHUMIDITY_TYPE_HTS221; } 39 | virtual bool humidityInit(); 40 | virtual bool humidityRead(RTIMU_DATA& data); 41 | 42 | private: 43 | unsigned char m_humidityAddr; // I2C address 44 | 45 | RTFLOAT m_humidity; // the current humidity 46 | RTFLOAT m_temperature; // the current temperature 47 | RTFLOAT m_temperature_m; // temperature calibration slope 48 | RTFLOAT m_temperature_c; // temperature calibration y intercept 49 | RTFLOAT m_humidity_m; // humidity calibration slope 50 | RTFLOAT m_humidity_c; // humidity calibration y intercept 51 | bool m_humidityValid; 52 | bool m_temperatureValid; 53 | 54 | }; 55 | 56 | #endif // _RTHUMIDITYHTS221_H_ 57 | 58 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/RTIMULib/IMUDrivers/RTHumidityHTU21D.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // This file is part of RTIMULib 4 | // 5 | // Copyright (c) 2014-2015, richards-tech, LLC 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to use, 10 | // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 11 | // Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 18 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 19 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #ifndef _RTHUMIDITYHTU21D_H_ 25 | #define _RTHUMIDITYHTU21D_H_ 26 | 27 | #include "RTHumidity.h" 28 | 29 | class RTIMUSettings; 30 | 31 | class RTHumidityHTU21D : public RTHumidity 32 | { 33 | public: 34 | RTHumidityHTU21D(RTIMUSettings *settings); 35 | ~RTHumidityHTU21D(); 36 | 37 | virtual const char *humidityName() { return "HTU21D"; } 38 | virtual int humidityType() { return RTHUMIDITY_TYPE_HTU21D; } 39 | virtual bool humidityInit(); 40 | virtual bool humidityRead(RTIMU_DATA& data); 41 | 42 | private: 43 | bool processBackground(); 44 | 45 | unsigned char m_humidityAddr; // I2C address 46 | 47 | int m_state; 48 | uint64_t m_startTime; 49 | RTFLOAT m_humidity; // the current humidity 50 | RTFLOAT m_temperature; // the current temperature 51 | bool m_humidityValid; 52 | bool m_temperatureValid; 53 | 54 | }; 55 | 56 | #endif // _RTHUMIDITYHTU21D_H_ 57 | 58 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/RTIMULib/IMUDrivers/RTIMUBNO055.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // This file is part of RTIMULib 4 | // 5 | // Copyright (c) 2014-2015, richards-tech, LLC 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to use, 10 | // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 11 | // Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 18 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 19 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | 25 | #ifndef _RTIMUBNO055_H 26 | #define _RTIMUBNO055_H 27 | 28 | #include "RTIMU.h" 29 | 30 | class RTIMUBNO055 : public RTIMU 31 | { 32 | public: 33 | RTIMUBNO055(RTIMUSettings *settings); 34 | ~RTIMUBNO055(); 35 | 36 | virtual const char *IMUName() { return "BNO055"; } 37 | virtual int IMUType() { return RTIMU_TYPE_BNO055; } 38 | virtual bool IMUInit(); 39 | virtual int IMUGetPollInterval(); 40 | virtual bool IMURead(); 41 | 42 | private: 43 | unsigned char m_slaveAddr; // I2C address of BNO055 44 | 45 | uint64_t m_lastReadTime; 46 | }; 47 | 48 | #endif // _RTIMUBNO055_H 49 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/RTIMULib/IMUDrivers/RTIMUNull.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // This file is part of RTIMULib 4 | // 5 | // Copyright (c) 2014-2015, richards-tech, LLC 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to use, 10 | // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 11 | // Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 18 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 19 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #include "RTIMUNull.h" 25 | #include "RTIMUSettings.h" 26 | 27 | RTIMUNull::RTIMUNull(RTIMUSettings *settings) : RTIMU(settings) 28 | { 29 | } 30 | 31 | RTIMUNull::~RTIMUNull() 32 | { 33 | } 34 | 35 | bool RTIMUNull::IMUInit() 36 | { 37 | return true; 38 | } 39 | 40 | int RTIMUNull::IMUGetPollInterval() 41 | { 42 | return (100); // just a dummy value really 43 | } 44 | 45 | bool RTIMUNull::IMURead() 46 | { 47 | updateFusion(); 48 | return true; 49 | } 50 | 51 | void RTIMUNull::setIMUData(const RTIMU_DATA& data) 52 | { 53 | m_imuData = data; 54 | } 55 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/RTIMULib/IMUDrivers/RTIMUNull.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // This file is part of RTIMULib 4 | // 5 | // Copyright (c) 2014-2015, richards-tech, LLC 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to use, 10 | // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 11 | // Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 18 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 19 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #ifndef _RTIMUNULL_H 25 | #define _RTIMUNULL_H 26 | 27 | // IMUNull is a dummy IMU that assumes sensor data is coming from elsewhere, 28 | // for example, across a network. 29 | // 30 | // Call IMUInit in the normal way. Then for every update, call setIMUData and then IMURead 31 | // to kick the kalman filter. 32 | 33 | #include "RTIMU.h" 34 | 35 | class RTIMUSettings; 36 | 37 | class RTIMUNull : public RTIMU 38 | { 39 | public: 40 | RTIMUNull(RTIMUSettings *settings); 41 | ~RTIMUNull(); 42 | 43 | // The timestamp parameter is assumed to be from RTMath::currentUSecsSinceEpoch() 44 | 45 | void setIMUData(const RTIMU_DATA& data); 46 | 47 | virtual const char *IMUName() { return "Null IMU"; } 48 | virtual int IMUType() { return RTIMU_TYPE_NULL; } 49 | virtual bool IMUInit(); 50 | virtual int IMUGetPollInterval(); 51 | virtual bool IMURead(); 52 | virtual bool IMUGyroBiasValid() { return true; } 53 | 54 | private: 55 | uint64_t m_timestamp; 56 | }; 57 | 58 | #endif // _RTIMUNULL_H 59 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/RTIMULib/IMUDrivers/RTPressure.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // This file is part of RTIMULib 4 | // 5 | // Copyright (c) 2014-2015, richards-tech, LLC 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to use, 10 | // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 11 | // Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 18 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 19 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | 25 | #include "RTPressure.h" 26 | 27 | #include "RTPressureBMP180.h" 28 | #include "RTPressureLPS25H.h" 29 | #include "RTPressureMS5611.h" 30 | #include "RTPressureMS5637.h" 31 | 32 | RTPressure *RTPressure::createPressure(RTIMUSettings *settings) 33 | { 34 | switch (settings->m_pressureType) { 35 | case RTPRESSURE_TYPE_BMP180: 36 | return new RTPressureBMP180(settings); 37 | 38 | case RTPRESSURE_TYPE_LPS25H: 39 | return new RTPressureLPS25H(settings); 40 | 41 | case RTPRESSURE_TYPE_MS5611: 42 | return new RTPressureMS5611(settings); 43 | 44 | case RTPRESSURE_TYPE_MS5637: 45 | return new RTPressureMS5637(settings); 46 | 47 | case RTPRESSURE_TYPE_AUTODISCOVER: 48 | if (settings->discoverPressure(settings->m_pressureType, settings->m_I2CPressureAddress)) { 49 | settings->saveSettings(); 50 | return RTPressure::createPressure(settings); 51 | } 52 | return NULL; 53 | 54 | case RTPRESSURE_TYPE_NULL: 55 | return NULL; 56 | 57 | default: 58 | return NULL; 59 | } 60 | } 61 | 62 | 63 | RTPressure::RTPressure(RTIMUSettings *settings) 64 | { 65 | m_settings = settings; 66 | } 67 | 68 | RTPressure::~RTPressure() 69 | { 70 | } 71 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/RTIMULib/IMUDrivers/RTPressure.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // This file is part of RTIMULib 4 | // 5 | // Copyright (c) 2014-2015, richards-tech, LLC 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to use, 10 | // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 11 | // Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 18 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 19 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #ifndef _RTPRESSURE_H 25 | #define _RTPRESSURE_H 26 | 27 | #include "RTIMUSettings.h" 28 | #include "RTIMULibDefs.h" 29 | #include "RTPressureDefs.h" 30 | 31 | class RTPressure 32 | { 33 | public: 34 | // Pressure sensor objects should always be created with the following call 35 | 36 | static RTPressure *createPressure(RTIMUSettings *settings); 37 | 38 | // Constructor/destructor 39 | 40 | RTPressure(RTIMUSettings *settings); 41 | virtual ~RTPressure(); 42 | 43 | // These functions must be provided by sub classes 44 | 45 | virtual const char *pressureName() = 0; // the name of the pressure sensor 46 | virtual int pressureType() = 0; // the type code of the pressure sensor 47 | virtual bool pressureInit() = 0; // set up the pressure sensor 48 | virtual bool pressureRead(RTIMU_DATA& data) = 0; // get latest value 49 | 50 | protected: 51 | RTIMUSettings *m_settings; // the settings object pointer 52 | 53 | }; 54 | 55 | #endif // _RTPRESSURE_H 56 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/RTIMULib/IMUDrivers/RTPressureLPS25H.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // This file is part of RTIMULib 4 | // 5 | // Copyright (c) 2014-2015, richards-tech, LLC 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to use, 10 | // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 11 | // Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 18 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 19 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | #ifndef _RTPRESSURELPS25H_H_ 25 | #define _RTPRESSURELPS25H_H_ 26 | 27 | #include "RTPressure.h" 28 | 29 | class RTIMUSettings; 30 | 31 | class RTPressureLPS25H : public RTPressure 32 | { 33 | public: 34 | RTPressureLPS25H(RTIMUSettings *settings); 35 | ~RTPressureLPS25H(); 36 | 37 | virtual const char *pressureName() { return "LPS25H"; } 38 | virtual int pressureType() { return RTPRESSURE_TYPE_LPS25H; } 39 | virtual bool pressureInit(); 40 | virtual bool pressureRead(RTIMU_DATA& data); 41 | 42 | private: 43 | unsigned char m_pressureAddr; // I2C address 44 | 45 | RTFLOAT m_pressure; // the current pressure 46 | RTFLOAT m_temperature; // the current temperature 47 | bool m_pressureValid; 48 | bool m_temperatureValid; 49 | 50 | }; 51 | 52 | #endif // _RTPRESSURELPS25H_H_ 53 | 54 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/RTIMULib/RTFusionRTQF.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // This file is part of RTIMULib 4 | // 5 | // Copyright (c) 2014-2015, richards-tech, LLC 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to use, 10 | // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 11 | // Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 18 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 19 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | 25 | #ifndef _RTFUSIONRTQF_H 26 | #define _RTFUSIONRTQF_H 27 | 28 | #include "RTFusion.h" 29 | 30 | class RTFusionRTQF : public RTFusion 31 | { 32 | public: 33 | RTFusionRTQF(); 34 | ~RTFusionRTQF(); 35 | 36 | // fusionType returns the type code of the fusion algorithm 37 | 38 | virtual int fusionType() { return RTFUSION_TYPE_RTQF; } 39 | 40 | // reset() resets the state but keeps any setting changes (such as enables) 41 | 42 | void reset(); 43 | 44 | // newIMUData() should be called for subsequent updates 45 | // deltaTime is in units of seconds 46 | 47 | void newIMUData(RTIMU_DATA& data, const RTIMUSettings *settings); 48 | 49 | private: 50 | void predict(); 51 | void update(); 52 | 53 | RTVector3 m_gyro; // unbiased gyro data 54 | RTFLOAT m_timeDelta; // time between predictions 55 | 56 | RTQuaternion m_stateQ; // quaternion state vector 57 | RTQuaternion m_stateQError; // difference between stateQ and measuredQ 58 | 59 | int m_sampleNumber; 60 | }; 61 | 62 | #endif // _RTFUSIONRTQF_H 63 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/RTIMULib/RTIMULIB LICENSE: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // This file is part of RTIMULib 4 | // 5 | // Copyright (c) 2014-2015, richards-tech, LLC 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to use, 10 | // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 11 | // Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 18 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 19 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | // The MPU-9250 and SPI driver code is based on code generously supplied by 25 | // staslock@gmail.com (www.clickdrive.io) 26 | 27 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/RTIMULib/RTIMULib.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // 3 | // This file is part of RTIMULib 4 | // 5 | // Copyright (c) 2014-2015, richards-tech, LLC 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to use, 10 | // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 11 | // Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 18 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 19 | // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | 25 | #ifndef _RTIMULIB_H 26 | #define _RTIMULIB_H 27 | 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | 34 | #include "RTIMULibDefs.h" 35 | 36 | #include "RTMath.h" 37 | 38 | #include "RTFusion.h" 39 | #include "RTFusionKalman4.h" 40 | 41 | #include "RTIMUHal.h" 42 | #include "IMUDrivers/RTIMU.h" 43 | #include "IMUDrivers/RTIMUNull.h" 44 | #include "IMUDrivers/RTIMUMPU9150.h" 45 | #include "IMUDrivers/RTIMUGD20HM303D.h" 46 | #include "IMUDrivers/RTIMUGD20M303DLHC.h" 47 | #include "IMUDrivers/RTIMULSM9DS0.h" 48 | 49 | #include "IMUDrivers/RTPressure.h" 50 | #include "IMUDrivers/RTPressureBMP180.h" 51 | #include "IMUDrivers/RTPressureLPS25H.h" 52 | #include "IMUDrivers/RTPressureMS5611.h" 53 | 54 | #include "IMUDrivers/RTHumidity.h" 55 | #include "IMUDrivers/RTHumidityHTS221.h" 56 | 57 | #include "RTIMUSettings.h" 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | #endif // _RTIMULIB_H 64 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/easy_mqos.h: -------------------------------------------------------------------------------- 1 | #ifndef EASY_MQOS_H 2 | #define EASY_MQOS_H 3 | 4 | #include 5 | #include 6 | #include "Mqtt/client_shared.h" 7 | #include "Mqtt/mosquitto.h" 8 | using namespace std; 9 | class easymqos 10 | { 11 | 12 | public: 13 | easymqos(); 14 | easymqos(int pub_or_sub ); 15 | ~easymqos(); 16 | 17 | //初始化系统 18 | bool Init_Sub(vector _topic); 19 | bool Start_Sub(); 20 | bool Init_Pub(char* _topic); 21 | bool Set_config_Pub(); 22 | bool Set_broker(char* host); 23 | unsigned int publish_messages(unsigned int len,string message); 24 | 25 | public: 26 | vector _topicStr; 27 | // struct mosq_config *subscribeCfg; 28 | // struct mosq_config *publicCfg; 29 | struct mosq_config *cfg; 30 | int _topicCnt_sub; 31 | 32 | }; 33 | 34 | 35 | 36 | 37 | #endif -------------------------------------------------------------------------------- /easymqOs_IMU_node/inc/imu.h: -------------------------------------------------------------------------------- 1 | #ifndef IMU_H 2 | #define IMU_H 3 | 4 | #include 5 | 6 | #include 7 | using namespace std; 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | 13 | typedef struct Quaternion 14 | { 15 | 16 | double x; 17 | double y; 18 | double z; 19 | double w; 20 | }; 21 | typedef struct Vector3 22 | { 23 | 24 | double x; 25 | double y; 26 | double z; 27 | }; 28 | typedef struct sensors_msg_imu 29 | { 30 | /* data */ 31 | 32 | unsigned int seq ; 33 | time_t stamp_ss ; // 时间戳 34 | time_t stamp_ms ; // 时间戳 35 | Quaternion orientation ; // 姿态 36 | double orientation_covariance[9] ;// 姿态协方差 37 | Vector3 angular_velocity ; // 角速度 38 | double angular_velocity_covariance[9]; // 角速度协方差 39 | Vector3 linear_acceleration ; // 线加速度 40 | double linear_acceleration_covariance[9] ; // 线加速度协方差 41 | Vector3 mag ; // 角度 ROS中没有 单独加的 42 | }__attribute__((packed)); 43 | 44 | extern void IMU_Task(void(*pfunc)(sensors_msg_imu)); 45 | extern long long getmillis(); 46 | extern float heading ; 47 | extern float rollAngle ; 48 | extern float pitchAngle ; 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif 54 | 55 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/inc/kalman.h: -------------------------------------------------------------------------------- 1 | class Kalman 2 | { 3 | private: 4 | double q; //process noise covariance 5 | double r; //measurement noise covariance 6 | double x; //value 7 | double p; //estimation error covariance 8 | double k; //kalman gain 9 | 10 | public: 11 | Kalman(double _q, double _r, double _p, double _initial_value); 12 | void update(double measurement); 13 | double GetValue() {return x;} 14 | void reset(double _q, double _r, double _p, double _initial_value); 15 | }; 16 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/inc/method_parse.h: -------------------------------------------------------------------------------- 1 | #ifndef METHOD_PARSE_H 2 | #define METHOD_PARSE_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | extern void save_waypoint(); 8 | extern void clear_waypoint(); 9 | extern void push_waypoint(double lon ,double lat); 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/src/kalman.cpp: -------------------------------------------------------------------------------- 1 | #include "kalman.h" 2 | 3 | Kalman::Kalman(double _q, double _r, double _p, double _initial_value) 4 | { 5 | q = _q; 6 | r = _r; 7 | p = _p; 8 | x = _initial_value; 9 | } 10 | 11 | void Kalman::update(double measurement) 12 | { 13 | //prediction update 14 | //omit x = x 15 | this->p = this->p + this->q; 16 | 17 | //measurement update 18 | this->k = this->p / (this->p + this->r); 19 | this->x = this->x + this->k * (measurement - this->x); 20 | this->p = (1 - this->k) * this->p; 21 | } 22 | 23 | void Kalman::reset(double _q, double _r, double _p, double _initial_value) 24 | { 25 | q = _q; 26 | r = _r; 27 | p = _p; 28 | x = _initial_value; 29 | } 30 | -------------------------------------------------------------------------------- /easymqOs_IMU_node/src/method_parse.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_IMU_node/src/method_parse.cpp -------------------------------------------------------------------------------- /easymqOs_base_OdomControl/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_base_OdomControl/Makefile -------------------------------------------------------------------------------- /easymqOs_base_OdomControl/Mqtt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${mosquitto_SOURCE_DIR}/lib 2 | ${STDBOOL_H_PATH} ${STDINT_H_PATH}) 3 | link_directories(${mosquitto_BINARY_DIR}/lib) 4 | 5 | set(shared_src client_shared.c client_shared.h) 6 | 7 | if (${WITH_SRV} STREQUAL ON) 8 | add_definitions("-DWITH_SRV") 9 | endif (${WITH_SRV} STREQUAL ON) 10 | 11 | add_executable(mosquitto_pub pub_client.c ${shared_src}) 12 | add_executable(mosquitto_sub sub_client.c ${shared_src}) 13 | 14 | target_link_libraries(mosquitto_pub libmosquitto) 15 | target_link_libraries(mosquitto_sub libmosquitto) 16 | 17 | install(TARGETS mosquitto_pub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 18 | install(TARGETS mosquitto_sub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 19 | -------------------------------------------------------------------------------- /easymqOs_base_OdomControl/Mqtt/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CLIENT_LDFLAGS += -L./Mqtt/lib -lmosquitto -I. 5 | .PHONY: all install uninstall reallyclean clean 6 | 7 | all : mosquitto_pub mosquitto_sub 8 | 9 | mosquitto_pub : pub_client.o client_shared.o 10 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 11 | 12 | mosquitto_sub : sub_client.o client_shared.o 13 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 14 | 15 | pub_client.o : pub_client.c libmosquitto.so 16 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 17 | 18 | sub_client.o : sub_client.c libmosquitto.so 19 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 20 | 21 | client_shared.o : client_shared.c client_shared.h 22 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 23 | 24 | 25 | 26 | install : all 27 | $(INSTALL) -d ${DESTDIR}$(prefix)/bin 28 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_pub ${DESTDIR}${prefix}/bin/mosquitto_pub 29 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_sub ${DESTDIR}${prefix}/bin/mosquitto_sub 30 | 31 | uninstall : 32 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_pub 33 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_sub 34 | 35 | reallyclean : clean 36 | 37 | clean : 38 | -rm -f *.o mosquitto_pub mosquitto_sub 39 | -------------------------------------------------------------------------------- /easymqOs_base_OdomControl/Mqtt/README.MD: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /easymqOs_base_OdomControl/Mqtt/client_pub_sub.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIENT_PUB_SUB_H 2 | #define CLIENT_PUB_SUB_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | //extern int mainSub(int argc, char * argv [ ]); 8 | extern int mainSub(struct mosq_config *cfgon , char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 9 | extern int mainPub(struct mosq_config *cfgon, char *devid); 10 | extern int publish_message(unsigned int msglength,char *msg); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /easymqOs_base_OdomControl/Mqtt/client_shared.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Roger Light 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License v1.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | http://www.eclipse.org/legal/epl-v10.html 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | Contributors: 14 | Roger Light - initial implementation and documentation. 15 | */ 16 | 17 | #ifndef _CLIENT_CONFIG_H 18 | #define _CLIENT_CONFIG_H 19 | 20 | #include 21 | 22 | /* pub_client.c modes */ 23 | #define MSGMODE_NONE 0 24 | #define MSGMODE_CMD 1 25 | #define MSGMODE_STDIN_LINE 2 26 | #define MSGMODE_STDIN_FILE 3 27 | #define MSGMODE_FILE 4 28 | #define MSGMODE_NULL 5 29 | 30 | #define CLIENT_PUB 1 31 | #define CLIENT_SUB 2 32 | 33 | struct mosq_config { 34 | char *id; 35 | char *id_prefix; 36 | int protocol_version; 37 | int keepalive; 38 | char *host; 39 | int port; 40 | int qos; 41 | bool retain; 42 | int pub_mode; /* pub */ 43 | char *file_input; /* pub */ 44 | char *message; /* pub */ 45 | long msglen; /* pub */ 46 | char *topic; /* pub */ 47 | char *bind_address; 48 | #ifdef WITH_SRV 49 | bool use_srv; 50 | #endif 51 | bool debug; 52 | bool quiet; 53 | unsigned int max_inflight; 54 | char *username; 55 | char *password; 56 | char *will_topic; 57 | char *will_payload; 58 | long will_payloadlen; 59 | int will_qos; 60 | bool will_retain; 61 | #ifdef WITH_TLS 62 | char *cafile; 63 | char *capath; 64 | char *certfile; 65 | char *keyfile; 66 | char *ciphers; 67 | bool insecure; 68 | char *tls_version; 69 | # ifdef WITH_TLS_PSK 70 | char *psk; 71 | char *psk_identity; 72 | # endif 73 | #endif 74 | bool clean_session; /* sub */ 75 | char **topics; /* sub */ 76 | int topic_count; /* sub */ 77 | bool no_retain; /* sub */ 78 | char **filter_outs; /* sub */ 79 | int filter_out_count; /* sub */ 80 | bool verbose; /* sub */ 81 | bool eol; /* sub */ 82 | int msg_count; /* sub */ 83 | #ifdef WITH_SOCKS 84 | char *socks5_host; 85 | int socks5_port; 86 | char *socks5_username; 87 | char *socks5_password; 88 | #endif 89 | }; 90 | 91 | int client_config_load(struct mosq_config *config, int pub_or_sub, int argc, char *argv[]); 92 | void client_config_cleanup(struct mosq_config *cfg); 93 | int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg); 94 | int client_id_generate(struct mosq_config *cfg, const char *id_base); 95 | int client_connect(struct mosquitto *mosq, struct mosq_config *cfg); 96 | //int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, char *argv[]); 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /easymqOs_base_OdomControl/Mqtt/lib/libmosquitto.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_base_OdomControl/Mqtt/lib/libmosquitto.so -------------------------------------------------------------------------------- /easymqOs_base_OdomControl/README.MD: -------------------------------------------------------------------------------- 1 | ### 和底盘使用串口通信 2 | ### 通信协议 3 | 发送至底盘的协议 4 | 5 | /************************************ 6 | * 串口数据发送格式 16 字节 7 | * head head len linear_v_x linear_v_y angular_v CRC 8 | * 0xff 0xff 15 float float float u8 9 | 10 | 从底盘接收的数据格式 11 | 12 | /********************************************************** 13 | * 串口接收数据格式共11字节 14 | * head head left encoder right encoder CRC 15 | * 0xaa 0xaa float float u8 16 | * ********************************************************/ 17 | 18 | 将IMU 节点下的MQTT 文件复制到本节点下的Mqtt下 19 | 20 | -------------------------------------------------------------------------------- /easymqOs_base_OdomControl/easy_mqos.h: -------------------------------------------------------------------------------- 1 | #ifndef EASY_MQOS_H 2 | #define EASY_MQOS_H 3 | 4 | #include 5 | #include 6 | #include "Mqtt/client_shared.h" 7 | #include "Mqtt/mosquitto.h" 8 | using namespace std; 9 | class easymqos 10 | { 11 | 12 | public: 13 | easymqos(); 14 | easymqos(int pub_or_sub ); 15 | ~easymqos(); 16 | 17 | //初始化系统 18 | bool Init_Sub(vector _topic); 19 | bool Start_Sub(char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 20 | bool Init_Pub(char* _topic); 21 | bool Set_config_Pub(); 22 | bool Set_broker(char* host); 23 | unsigned int publish_messages(unsigned int len,string message); 24 | 25 | public: 26 | vector _topicStr; 27 | // struct mosq_config *subscribeCfg; 28 | // struct mosq_config *publicCfg; 29 | struct mosq_config *cfg; 30 | int _topicCnt_sub; 31 | 32 | }; 33 | 34 | 35 | 36 | 37 | #endif -------------------------------------------------------------------------------- /easymqOs_base_OdomControl/inc/README.MD: -------------------------------------------------------------------------------- 1 | d 2 | -------------------------------------------------------------------------------- /easymqOs_base_OdomControl/inc/Uart_comm.h: -------------------------------------------------------------------------------- 1 | #ifndef UART_COMM_H 2 | #define UART_COMM_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | #include "sys/socket.h" 7 | #include "netinet/in.h" 8 | 9 | #include "string.h" 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | 25 | 26 | extern speed_t getBaudrate(int baudrate); 27 | extern int OpenDev(char *Dev,int baudrate); 28 | extern int OpenDev_insulation(char *Dev,int baudrate); 29 | extern void GetCrC(unsigned char *CmmBuf, unsigned char Len); 30 | 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /easymqOs_base_OdomControl/inc/odometry.h: -------------------------------------------------------------------------------- 1 | #ifndef ODOMETRY_H 2 | #define ODOMETRY_H 3 | 4 | 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #include 11 | typedef struct Quaternion 12 | { 13 | 14 | double x; 15 | double y; 16 | double z; 17 | double w; 18 | }; 19 | typedef struct Vector3 20 | { 21 | 22 | double x; 23 | double y; 24 | double z; 25 | }; 26 | typedef struct sensors_msg_odom 27 | { 28 | /* data */ 29 | 30 | unsigned int seq ; 31 | time_t stamp_ss ; // 时间戳 32 | time_t stamp_ms ; // 时间戳 33 | Quaternion orientation ; // 姿态 34 | Vector3 angular_velocity ; // 角速度 35 | Vector3 linear_velocity ; // 线速度 36 | Vector3 position ; // 37 | int left_encoders; 38 | int right_encoders; 39 | 40 | }__attribute__((packed)); 41 | 42 | typedef struct 43 | { 44 | float LeftSpeed; 45 | float RightSpeed; 46 | unsigned int LeftPusle; 47 | unsigned int RightPusle; 48 | float leftdistance;//��ʻ�ľ��� ��λm 49 | float Rightdistance; 50 | }wheelInf; 51 | extern wheelInf wheelParam; 52 | extern float wheel_interval ;// 53 | extern float position_x; 54 | extern float position_y; 55 | extern float oriention; 56 | extern float velocity_linear; 57 | extern float velocity_angular; 58 | extern float velocity_linear_x; 59 | extern float velocity_linear_y; 60 | extern float velocity_linear_l; 61 | extern float velocity_linear_r; 62 | extern void odometry(float right,float left); 63 | extern void odometry_simple(float right,float left); 64 | extern long long getsecond(); 65 | extern long long getmiilsecond(); 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | #endif -------------------------------------------------------------------------------- /easymqOs_base_OdomControl/inc/rtquaternion.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _RTQUATERNION_H_ 3 | #define _RTQUATERNION_H_ 4 | #include "odometry.h" 5 | #include 6 | typedef float RTFLOAT; 7 | class RTQuaternion 8 | { 9 | public: 10 | RTQuaternion(); 11 | RTQuaternion(RTFLOAT scalar, RTFLOAT x, RTFLOAT y, RTFLOAT z); 12 | 13 | 14 | 15 | void normalize(); 16 | void toEuler(Vector3 vec); 17 | void fromEuler(Vector3 vec); 18 | RTQuaternion conjugate() const; 19 | void toAngleVector(RTFLOAT& angle, Vector3 vec); 20 | void fromAngleVector(const RTFLOAT& angle, const Vector3 vec); 21 | 22 | void zero(); 23 | const char *display(); 24 | 25 | inline RTFLOAT scalar() const { return m_data[0]; } 26 | inline RTFLOAT x() const { return m_data[1]; } 27 | inline RTFLOAT y() const { return m_data[2]; } 28 | inline RTFLOAT z() const { return m_data[3]; } 29 | inline RTFLOAT data(const int i) const { return m_data[i]; } 30 | 31 | inline void setScalar(const RTFLOAT val) { m_data[0] = val; } 32 | inline void setX(const RTFLOAT val) { m_data[1] = val; } 33 | inline void setY(const RTFLOAT val) { m_data[2] = val; } 34 | inline void setZ(const RTFLOAT val) { m_data[3] = val; } 35 | inline void setData(const int i, RTFLOAT val) { m_data[i] = val; } 36 | inline void fromArray(RTFLOAT *val) { memcpy(m_data, val, 4 * sizeof(RTFLOAT)); } 37 | inline void toArray(RTFLOAT *val) const { memcpy(val, m_data, 4 * sizeof(RTFLOAT)); } 38 | 39 | private: 40 | RTFLOAT m_data[4]; 41 | }; 42 | 43 | 44 | #endif -------------------------------------------------------------------------------- /easymqOs_base_OdomControl/inc/serial.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_base_OdomControl/inc/serial.h -------------------------------------------------------------------------------- /easymqOs_base_OdomControl/inc/stm32_control.h: -------------------------------------------------------------------------------- 1 | #ifndef STM32_CONTROL_H 2 | #define STM32_CONTROL_H 3 | 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #include "odometry.h" 10 | 11 | typedef struct { 12 | char valid; 13 | char X_V; 14 | char Y_V; 15 | 16 | }CVFEED; 17 | extern float velspeed ; 18 | extern float angspeed ; 19 | extern CVFEED cv_res; 20 | extern unsigned int positionx; 21 | extern int odom_task(void(*pfunc)(sensors_msg_odom )); 22 | extern void cmd_vel_callback(const char * cmd_vel); 23 | extern void cmd_send(const char cmd_v,int speed); 24 | extern void cmd_send2(float vspeed,float aspeed); 25 | 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /easymqOs_base_OdomControl/src/README.MD: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /easymqOs_base_OdomControl/src/Uart_comm.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_base_OdomControl/src/Uart_comm.c -------------------------------------------------------------------------------- /easymqOs_collect_datas/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Haidar Jamal 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /easymqOs_collect_datas/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_collect_datas/Makefile -------------------------------------------------------------------------------- /easymqOs_collect_datas/Mqtt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${mosquitto_SOURCE_DIR}/lib 2 | ${STDBOOL_H_PATH} ${STDINT_H_PATH}) 3 | link_directories(${mosquitto_BINARY_DIR}/lib) 4 | 5 | set(shared_src client_shared.c client_shared.h) 6 | 7 | if (${WITH_SRV} STREQUAL ON) 8 | add_definitions("-DWITH_SRV") 9 | endif (${WITH_SRV} STREQUAL ON) 10 | 11 | add_executable(mosquitto_pub pub_client.c ${shared_src}) 12 | add_executable(mosquitto_sub sub_client.c ${shared_src}) 13 | 14 | target_link_libraries(mosquitto_pub libmosquitto) 15 | target_link_libraries(mosquitto_sub libmosquitto) 16 | 17 | install(TARGETS mosquitto_pub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 18 | install(TARGETS mosquitto_sub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 19 | -------------------------------------------------------------------------------- /easymqOs_collect_datas/Mqtt/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CLIENT_LDFLAGS += -L./Mqtt/lib -lmosquitto -I. 5 | .PHONY: all install uninstall reallyclean clean 6 | 7 | all : mosquitto_pub mosquitto_sub 8 | 9 | mosquitto_pub : pub_client.o client_shared.o 10 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 11 | 12 | mosquitto_sub : sub_client.o client_shared.o 13 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 14 | 15 | pub_client.o : pub_client.c libmosquitto.so 16 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 17 | 18 | sub_client.o : sub_client.c libmosquitto.so 19 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 20 | 21 | client_shared.o : client_shared.c client_shared.h 22 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 23 | 24 | 25 | 26 | install : all 27 | $(INSTALL) -d ${DESTDIR}$(prefix)/bin 28 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_pub ${DESTDIR}${prefix}/bin/mosquitto_pub 29 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_sub ${DESTDIR}${prefix}/bin/mosquitto_sub 30 | 31 | uninstall : 32 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_pub 33 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_sub 34 | 35 | reallyclean : clean 36 | 37 | clean : 38 | -rm -f *.o mosquitto_pub mosquitto_sub 39 | -------------------------------------------------------------------------------- /easymqOs_collect_datas/Mqtt/client_pub_sub.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIENT_PUB_SUB_H 2 | #define CLIENT_PUB_SUB_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | //extern int mainSub(int argc, char * argv [ ]); 8 | extern int mainSub(struct mosq_config *cfgon , char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 9 | extern int mainPub(struct mosq_config *cfgon, char *devid); 10 | extern int publish_message(unsigned int msglength,char *msg); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /easymqOs_collect_datas/Mqtt/client_shared.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Roger Light 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License v1.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | http://www.eclipse.org/legal/epl-v10.html 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | Contributors: 14 | Roger Light - initial implementation and documentation. 15 | */ 16 | 17 | #ifndef _CLIENT_CONFIG_H 18 | #define _CLIENT_CONFIG_H 19 | 20 | #include 21 | 22 | /* pub_client.c modes */ 23 | #define MSGMODE_NONE 0 24 | #define MSGMODE_CMD 1 25 | #define MSGMODE_STDIN_LINE 2 26 | #define MSGMODE_STDIN_FILE 3 27 | #define MSGMODE_FILE 4 28 | #define MSGMODE_NULL 5 29 | 30 | #define CLIENT_PUB 1 31 | #define CLIENT_SUB 2 32 | 33 | struct mosq_config { 34 | char *id; 35 | char *id_prefix; 36 | int protocol_version; 37 | int keepalive; 38 | char *host; 39 | int port; 40 | int qos; 41 | bool retain; 42 | int pub_mode; /* pub */ 43 | char *file_input; /* pub */ 44 | char *message; /* pub */ 45 | long msglen; /* pub */ 46 | char *topic; /* pub */ 47 | char *bind_address; 48 | #ifdef WITH_SRV 49 | bool use_srv; 50 | #endif 51 | bool debug; 52 | bool quiet; 53 | unsigned int max_inflight; 54 | char *username; 55 | char *password; 56 | char *will_topic; 57 | char *will_payload; 58 | long will_payloadlen; 59 | int will_qos; 60 | bool will_retain; 61 | #ifdef WITH_TLS 62 | char *cafile; 63 | char *capath; 64 | char *certfile; 65 | char *keyfile; 66 | char *ciphers; 67 | bool insecure; 68 | char *tls_version; 69 | # ifdef WITH_TLS_PSK 70 | char *psk; 71 | char *psk_identity; 72 | # endif 73 | #endif 74 | bool clean_session; /* sub */ 75 | char **topics; /* sub */ 76 | int topic_count; /* sub */ 77 | bool no_retain; /* sub */ 78 | char **filter_outs; /* sub */ 79 | int filter_out_count; /* sub */ 80 | bool verbose; /* sub */ 81 | bool eol; /* sub */ 82 | int msg_count; /* sub */ 83 | #ifdef WITH_SOCKS 84 | char *socks5_host; 85 | int socks5_port; 86 | char *socks5_username; 87 | char *socks5_password; 88 | #endif 89 | }; 90 | 91 | int client_config_load(struct mosq_config *config, int pub_or_sub, int argc, char *argv[]); 92 | void client_config_cleanup(struct mosq_config *cfg); 93 | int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg); 94 | int client_id_generate(struct mosq_config *cfg, const char *id_base); 95 | int client_connect(struct mosquitto *mosq, struct mosq_config *cfg); 96 | //int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, char *argv[]); 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /easymqOs_collect_datas/Mqtt/lib/libmosquitto.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_collect_datas/Mqtt/lib/libmosquitto.so -------------------------------------------------------------------------------- /easymqOs_collect_datas/README.MD: -------------------------------------------------------------------------------- 1 | # easymqOs_collect_datas 2 | 主要用于收集里程计位移 雷达数据 并保存成文本 3 | -------------------------------------------------------------------------------- /easymqOs_collect_datas/easy_mqos.h: -------------------------------------------------------------------------------- 1 | #ifndef EASY_MQOS_H 2 | #define EASY_MQOS_H 3 | 4 | #include 5 | #include 6 | #include "Mqtt/client_shared.h" 7 | #include "Mqtt/mosquitto.h" 8 | using namespace std; 9 | class easymqos 10 | { 11 | 12 | public: 13 | easymqos(); 14 | easymqos(int pub_or_sub ); 15 | ~easymqos(); 16 | 17 | //初始化系统 18 | bool Init_Sub(vector _topic); 19 | bool Start_Sub(char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 20 | bool Init_Pub(char* _topic); 21 | bool Set_config_Pub(); 22 | bool Set_broker(char* host); 23 | unsigned int publish_messages(unsigned int len,string message); 24 | 25 | public: 26 | vector _topicStr; 27 | // struct mosq_config *subscribeCfg; 28 | // struct mosq_config *publicCfg; 29 | struct mosq_config *cfg; 30 | int _topicCnt_sub; 31 | 32 | }; 33 | 34 | 35 | 36 | 37 | #endif -------------------------------------------------------------------------------- /easymqOs_collect_datas/inc/kalman.h: -------------------------------------------------------------------------------- 1 | class Kalman 2 | { 3 | private: 4 | double q; //process noise covariance 5 | double r; //measurement noise covariance 6 | double x; //value 7 | double p; //estimation error covariance 8 | double k; //kalman gain 9 | 10 | public: 11 | Kalman(double _q, double _r, double _p, double _initial_value); 12 | void update(double measurement); 13 | void update_2(double measurement); 14 | void update(double r_measurement,double measurement); 15 | void update_avrage(double r_measurement,double measurement); 16 | 17 | double GetValue() {return x;} 18 | void reset(double _q, double _r, double _p, double _initial_value); 19 | }; 20 | -------------------------------------------------------------------------------- /easymqOs_collect_datas/inc/rtquaternion.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _RTQUATERNION_H_ 3 | #define _RTQUATERNION_H_ 4 | #include "sensor_msg.h" 5 | #include 6 | typedef float RTFLOAT; 7 | class RTQuaternion 8 | { 9 | public: 10 | RTQuaternion(); 11 | RTQuaternion(RTFLOAT scalar, RTFLOAT x, RTFLOAT y, RTFLOAT z); 12 | 13 | 14 | 15 | void normalize(); 16 | void toEuler(Vector3 *vec); 17 | void fromEuler(Vector3 vec); 18 | RTQuaternion conjugate() const; 19 | void toAngleVector(RTFLOAT& angle, Vector3 vec); 20 | void fromAngleVector(const RTFLOAT& angle, const Vector3 vec); 21 | 22 | void zero(); 23 | const char *display(); 24 | 25 | inline RTFLOAT scalar() const { return m_data[0]; } 26 | inline RTFLOAT x() const { return m_data[1]; } 27 | inline RTFLOAT y() const { return m_data[2]; } 28 | inline RTFLOAT z() const { return m_data[3]; } 29 | inline RTFLOAT data(const int i) const { return m_data[i]; } 30 | 31 | inline void setScalar(const RTFLOAT val) { m_data[0] = val; } 32 | inline void setX(const RTFLOAT val) { m_data[1] = val; } 33 | inline void setY(const RTFLOAT val) { m_data[2] = val; } 34 | inline void setZ(const RTFLOAT val) { m_data[3] = val; } 35 | inline void setData(const int i, RTFLOAT val) { m_data[i] = val; } 36 | inline void fromArray(RTFLOAT *val) { memcpy(m_data, val, 4 * sizeof(RTFLOAT)); } 37 | inline void toArray(RTFLOAT *val) const { memcpy(val, m_data, 4 * sizeof(RTFLOAT)); } 38 | 39 | private: 40 | RTFLOAT m_data[4]; 41 | }; 42 | 43 | 44 | #endif -------------------------------------------------------------------------------- /easymqOs_collect_datas/inc/sensor_msg.h: -------------------------------------------------------------------------------- 1 | #ifndef _SENSOR_MSG_H 2 | #define _SENSOR_MSG_H 3 | 4 | 5 | #include 6 | #include 7 | using namespace std; 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | 13 | typedef struct Quaternion 14 | { 15 | 16 | double x; 17 | double y; 18 | double z; 19 | double w; 20 | }; 21 | typedef struct Vector3 22 | { 23 | 24 | double x; 25 | double y; 26 | double z; 27 | }; 28 | typedef struct sensors_msg_imu 29 | { 30 | /* data */ 31 | 32 | unsigned int seq ; 33 | time_t stamp_ss ; // 时间戳 34 | time_t stamp_ms ; // 时间戳 35 | Quaternion orientation ; // 姿态 36 | double orientation_covariance[9] ;// 姿态协方差 37 | Vector3 angular_velocity ; // 角速度 38 | double angular_velocity_covariance[9]; // 角速度协方差 39 | Vector3 linear_acceleration ; // 线加速度 40 | double linear_acceleration_covariance[9] ; // 线加速度协方差 41 | Vector3 mag ; // 角度 ROS中没有 单独加的 42 | }__attribute__((packed)); 43 | 44 | typedef struct sensors_msg_odom 45 | { 46 | /* data */ 47 | 48 | unsigned int seq ; 49 | time_t stamp_ss ; // 时间戳 50 | time_t stamp_ms ; // 时间戳 51 | Quaternion orientation ; // 姿态 52 | Vector3 angular_velocity ; // 角速度 53 | Vector3 linear_velocity ; // 线速度 54 | Vector3 position ; // 55 | int left_encoders; 56 | int right_encoders; 57 | }__attribute__((packed)); 58 | 59 | 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | #endif -------------------------------------------------------------------------------- /easymqOs_collect_datas/src/kalman.cpp: -------------------------------------------------------------------------------- 1 | #include "kalman.h" 2 | 3 | Kalman::Kalman(double _q, double _r, double _p, double _initial_value) 4 | { 5 | q = _q; 6 | r = _r; 7 | p = _p; 8 | x = _initial_value; 9 | } 10 | 11 | void Kalman::update(double measurement) 12 | { 13 | //prediction update 14 | //omit x = x 15 | this->p = this->p + this->q; 16 | 17 | //measurement update 18 | this->k = this->p / (this->p + this->r); 19 | this->x = this->x + this->k * (measurement - this->x); 20 | this->p = (1 - this->k) * this->p; 21 | } 22 | void Kalman::update_2(double measurement) 23 | { 24 | //prediction update 25 | this->x = this->x+ measurement; 26 | //omit x = x 27 | this->p = this->p + this->q; 28 | 29 | //measurement update 30 | this->k = this->p / (this->p + this->r); 31 | this->x = this->x + this->k * (measurement - this->x); 32 | this->p = (1 - this->k) * this->p; 33 | } 34 | void Kalman::update(double r_measurement,double measurement) 35 | { 36 | //prediction update 37 | //omit x = x 38 | this->p = this->p + this->q; 39 | 40 | //measurement update 41 | this->k = this->p / (this->p + this->r); 42 | this->x = measurement + this->k * (r_measurement -measurement ); 43 | this->p = (1 - this->k) * this->p; 44 | } 45 | 46 | void Kalman::update_avrage(double r_measurement,double measurement) 47 | { 48 | //prediction update 49 | 50 | this->x = (r_measurement + measurement )/2; 51 | 52 | } 53 | void Kalman::reset(double _q, double _r, double _p, double _initial_value) 54 | { 55 | q = _q; 56 | r = _r; 57 | p = _p; 58 | x = _initial_value; 59 | } 60 | -------------------------------------------------------------------------------- /easymqOs_detectDistance_3sonars/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Haidar Jamal 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /easymqOs_detectDistance_3sonars/Mqtt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${mosquitto_SOURCE_DIR}/lib 2 | ${STDBOOL_H_PATH} ${STDINT_H_PATH}) 3 | link_directories(${mosquitto_BINARY_DIR}/lib) 4 | 5 | set(shared_src client_shared.c client_shared.h) 6 | 7 | if (${WITH_SRV} STREQUAL ON) 8 | add_definitions("-DWITH_SRV") 9 | endif (${WITH_SRV} STREQUAL ON) 10 | 11 | add_executable(mosquitto_pub pub_client.c ${shared_src}) 12 | add_executable(mosquitto_sub sub_client.c ${shared_src}) 13 | 14 | target_link_libraries(mosquitto_pub libmosquitto) 15 | target_link_libraries(mosquitto_sub libmosquitto) 16 | 17 | install(TARGETS mosquitto_pub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 18 | install(TARGETS mosquitto_sub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 19 | -------------------------------------------------------------------------------- /easymqOs_detectDistance_3sonars/Mqtt/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CLIENT_LDFLAGS += -L./Mqtt/lib -lmosquitto -I. 5 | .PHONY: all install uninstall reallyclean clean 6 | 7 | all : mosquitto_pub mosquitto_sub 8 | 9 | mosquitto_pub : pub_client.o client_shared.o 10 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 11 | 12 | mosquitto_sub : sub_client.o client_shared.o 13 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 14 | 15 | pub_client.o : pub_client.c libmosquitto.so 16 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 17 | 18 | sub_client.o : sub_client.c libmosquitto.so 19 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 20 | 21 | client_shared.o : client_shared.c client_shared.h 22 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 23 | 24 | 25 | 26 | install : all 27 | $(INSTALL) -d ${DESTDIR}$(prefix)/bin 28 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_pub ${DESTDIR}${prefix}/bin/mosquitto_pub 29 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_sub ${DESTDIR}${prefix}/bin/mosquitto_sub 30 | 31 | uninstall : 32 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_pub 33 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_sub 34 | 35 | reallyclean : clean 36 | 37 | clean : 38 | -rm -f *.o mosquitto_pub mosquitto_sub 39 | -------------------------------------------------------------------------------- /easymqOs_detectDistance_3sonars/Mqtt/client_pub_sub.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIENT_PUB_SUB_H 2 | #define CLIENT_PUB_SUB_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | //extern int mainSub(int argc, char * argv [ ]); 8 | extern int mainSub(struct mosq_config *cfgon , char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 9 | extern int mainPub(struct mosq_config *cfgon, char *devid); 10 | extern int publish_message(unsigned int msglength,char *msg); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /easymqOs_detectDistance_3sonars/Mqtt/client_shared.d: -------------------------------------------------------------------------------- 1 | Mqtt/client_shared.o: Mqtt/client_shared.c Mqtt/mosquitto.h \ 2 | Mqtt/client_shared.h 3 | -------------------------------------------------------------------------------- /easymqOs_detectDistance_3sonars/Mqtt/client_shared.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_detectDistance_3sonars/Mqtt/client_shared.o -------------------------------------------------------------------------------- /easymqOs_detectDistance_3sonars/Mqtt/pub_client.d: -------------------------------------------------------------------------------- 1 | Mqtt/pub_client.o: Mqtt/pub_client.c Mqtt/mosquitto.h \ 2 | Mqtt/client_shared.h Mqtt/client_pub_sub.h 3 | -------------------------------------------------------------------------------- /easymqOs_detectDistance_3sonars/Mqtt/pub_client.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_detectDistance_3sonars/Mqtt/pub_client.o -------------------------------------------------------------------------------- /easymqOs_detectDistance_3sonars/Mqtt/sub_client.d: -------------------------------------------------------------------------------- 1 | Mqtt/sub_client.o: Mqtt/sub_client.c Mqtt/mosquitto.h \ 2 | Mqtt/client_shared.h Mqtt/client_pub_sub.h 3 | -------------------------------------------------------------------------------- /easymqOs_detectDistance_3sonars/Mqtt/sub_client.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_detectDistance_3sonars/Mqtt/sub_client.o -------------------------------------------------------------------------------- /easymqOs_detectDistance_3sonars/easy_mqos.h: -------------------------------------------------------------------------------- 1 | #ifndef EASY_MQOS_H 2 | #define EASY_MQOS_H 3 | 4 | #include 5 | #include 6 | #include "Mqtt/client_shared.h" 7 | #include "Mqtt/mosquitto.h" 8 | using namespace std; 9 | class easymqos 10 | { 11 | 12 | public: 13 | easymqos(); 14 | easymqos(int pub_or_sub ); 15 | ~easymqos(); 16 | 17 | //初始化系统 18 | bool Init_Sub(vector _topic); 19 | bool Start_Sub(char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 20 | bool Init_Pub(char* _topic); 21 | bool Set_config_Pub(); 22 | bool Set_broker(char* host); 23 | unsigned int publish_messages(unsigned int len,string message); 24 | 25 | public: 26 | vector _topicStr; 27 | // struct mosq_config *subscribeCfg; 28 | // struct mosq_config *publicCfg; 29 | struct mosq_config *cfg; 30 | int _topicCnt_sub; 31 | 32 | }; 33 | 34 | 35 | 36 | 37 | #endif -------------------------------------------------------------------------------- /easymqOs_detectDistance_3sonars/inc/sonars.h: -------------------------------------------------------------------------------- 1 | #ifndef SONARS_H 2 | #define SONARS_H 3 | 4 | 5 | extern void sonars_task(void (*func)(char*)); 6 | #endif -------------------------------------------------------------------------------- /easymqOs_detectDistance_vl53/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Haidar Jamal 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /easymqOs_detectDistance_vl53/Mqtt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${mosquitto_SOURCE_DIR}/lib 2 | ${STDBOOL_H_PATH} ${STDINT_H_PATH}) 3 | link_directories(${mosquitto_BINARY_DIR}/lib) 4 | 5 | set(shared_src client_shared.c client_shared.h) 6 | 7 | if (${WITH_SRV} STREQUAL ON) 8 | add_definitions("-DWITH_SRV") 9 | endif (${WITH_SRV} STREQUAL ON) 10 | 11 | add_executable(mosquitto_pub pub_client.c ${shared_src}) 12 | add_executable(mosquitto_sub sub_client.c ${shared_src}) 13 | 14 | target_link_libraries(mosquitto_pub libmosquitto) 15 | target_link_libraries(mosquitto_sub libmosquitto) 16 | 17 | install(TARGETS mosquitto_pub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 18 | install(TARGETS mosquitto_sub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 19 | -------------------------------------------------------------------------------- /easymqOs_detectDistance_vl53/Mqtt/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CLIENT_LDFLAGS += -L./Mqtt/lib -lmosquitto -I. 5 | .PHONY: all install uninstall reallyclean clean 6 | 7 | all : mosquitto_pub mosquitto_sub 8 | 9 | mosquitto_pub : pub_client.o client_shared.o 10 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 11 | 12 | mosquitto_sub : sub_client.o client_shared.o 13 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 14 | 15 | pub_client.o : pub_client.c libmosquitto.so 16 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 17 | 18 | sub_client.o : sub_client.c libmosquitto.so 19 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 20 | 21 | client_shared.o : client_shared.c client_shared.h 22 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 23 | 24 | 25 | 26 | install : all 27 | $(INSTALL) -d ${DESTDIR}$(prefix)/bin 28 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_pub ${DESTDIR}${prefix}/bin/mosquitto_pub 29 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_sub ${DESTDIR}${prefix}/bin/mosquitto_sub 30 | 31 | uninstall : 32 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_pub 33 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_sub 34 | 35 | reallyclean : clean 36 | 37 | clean : 38 | -rm -f *.o mosquitto_pub mosquitto_sub 39 | -------------------------------------------------------------------------------- /easymqOs_detectDistance_vl53/Mqtt/client_pub_sub.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIENT_PUB_SUB_H 2 | #define CLIENT_PUB_SUB_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | //extern int mainSub(int argc, char * argv [ ]); 8 | extern int mainSub(struct mosq_config *cfgon , char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 9 | extern int mainPub(struct mosq_config *cfgon, char *devid); 10 | extern int publish_message(unsigned int msglength,char *msg); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /easymqOs_detectDistance_vl53/Mqtt/client_shared.d: -------------------------------------------------------------------------------- 1 | Mqtt/client_shared.o: Mqtt/client_shared.c Mqtt/mosquitto.h \ 2 | Mqtt/client_shared.h 3 | -------------------------------------------------------------------------------- /easymqOs_detectDistance_vl53/Mqtt/client_shared.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Roger Light 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License v1.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | http://www.eclipse.org/legal/epl-v10.html 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | Contributors: 14 | Roger Light - initial implementation and documentation. 15 | */ 16 | 17 | #ifndef _CLIENT_CONFIG_H 18 | #define _CLIENT_CONFIG_H 19 | 20 | #include 21 | 22 | /* pub_client.c modes */ 23 | #define MSGMODE_NONE 0 24 | #define MSGMODE_CMD 1 25 | #define MSGMODE_STDIN_LINE 2 26 | #define MSGMODE_STDIN_FILE 3 27 | #define MSGMODE_FILE 4 28 | #define MSGMODE_NULL 5 29 | 30 | #define CLIENT_PUB 1 31 | #define CLIENT_SUB 2 32 | 33 | struct mosq_config { 34 | char *id; 35 | char *id_prefix; 36 | int protocol_version; 37 | int keepalive; 38 | char *host; 39 | int port; 40 | int qos; 41 | bool retain; 42 | int pub_mode; /* pub */ 43 | char *file_input; /* pub */ 44 | char *message; /* pub */ 45 | long msglen; /* pub */ 46 | char *topic; /* pub */ 47 | char *bind_address; 48 | #ifdef WITH_SRV 49 | bool use_srv; 50 | #endif 51 | bool debug; 52 | bool quiet; 53 | unsigned int max_inflight; 54 | char *username; 55 | char *password; 56 | char *will_topic; 57 | char *will_payload; 58 | long will_payloadlen; 59 | int will_qos; 60 | bool will_retain; 61 | #ifdef WITH_TLS 62 | char *cafile; 63 | char *capath; 64 | char *certfile; 65 | char *keyfile; 66 | char *ciphers; 67 | bool insecure; 68 | char *tls_version; 69 | # ifdef WITH_TLS_PSK 70 | char *psk; 71 | char *psk_identity; 72 | # endif 73 | #endif 74 | bool clean_session; /* sub */ 75 | char **topics; /* sub */ 76 | int topic_count; /* sub */ 77 | bool no_retain; /* sub */ 78 | char **filter_outs; /* sub */ 79 | int filter_out_count; /* sub */ 80 | bool verbose; /* sub */ 81 | bool eol; /* sub */ 82 | int msg_count; /* sub */ 83 | #ifdef WITH_SOCKS 84 | char *socks5_host; 85 | int socks5_port; 86 | char *socks5_username; 87 | char *socks5_password; 88 | #endif 89 | }; 90 | 91 | int client_config_load(struct mosq_config *config, int pub_or_sub, int argc, char *argv[]); 92 | void client_config_cleanup(struct mosq_config *cfg); 93 | int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg); 94 | int client_id_generate(struct mosq_config *cfg, const char *id_base); 95 | int client_connect(struct mosquitto *mosq, struct mosq_config *cfg); 96 | //int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, char *argv[]); 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /easymqOs_detectDistance_vl53/Mqtt/client_shared.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_detectDistance_vl53/Mqtt/client_shared.o -------------------------------------------------------------------------------- /easymqOs_detectDistance_vl53/Mqtt/pub_client.d: -------------------------------------------------------------------------------- 1 | Mqtt/pub_client.o: Mqtt/pub_client.c Mqtt/mosquitto.h \ 2 | Mqtt/client_shared.h Mqtt/client_pub_sub.h 3 | -------------------------------------------------------------------------------- /easymqOs_detectDistance_vl53/Mqtt/pub_client.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_detectDistance_vl53/Mqtt/pub_client.o -------------------------------------------------------------------------------- /easymqOs_detectDistance_vl53/Mqtt/sub_client.d: -------------------------------------------------------------------------------- 1 | Mqtt/sub_client.o: Mqtt/sub_client.c Mqtt/mosquitto.h \ 2 | Mqtt/client_shared.h Mqtt/client_pub_sub.h 3 | -------------------------------------------------------------------------------- /easymqOs_detectDistance_vl53/Mqtt/sub_client.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_detectDistance_vl53/Mqtt/sub_client.o -------------------------------------------------------------------------------- /easymqOs_detectDistance_vl53/easy_mqos.h: -------------------------------------------------------------------------------- 1 | #ifndef EASY_MQOS_H 2 | #define EASY_MQOS_H 3 | 4 | #include 5 | #include 6 | #include "Mqtt/client_shared.h" 7 | #include "Mqtt/mosquitto.h" 8 | using namespace std; 9 | class easymqos 10 | { 11 | 12 | public: 13 | easymqos(); 14 | easymqos(int pub_or_sub ); 15 | ~easymqos(); 16 | 17 | //初始化系统 18 | bool Init_Sub(vector _topic); 19 | bool Start_Sub(char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 20 | bool Init_Pub(char* _topic); 21 | bool Set_config_Pub(); 22 | bool Set_broker(char* host); 23 | unsigned int publish_messages(unsigned int len,string message); 24 | 25 | public: 26 | vector _topicStr; 27 | // struct mosq_config *subscribeCfg; 28 | // struct mosq_config *publicCfg; 29 | struct mosq_config *cfg; 30 | int _topicCnt_sub; 31 | 32 | }; 33 | 34 | 35 | 36 | 37 | #endif -------------------------------------------------------------------------------- /easymqOs_detectDistance_vl53/inc/VL53_interface.h: -------------------------------------------------------------------------------- 1 | #ifndef _VL53_INTERFACE_h 2 | #define _VL53_INTERFACE_h 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | int main_1(); 8 | int main_2(); 9 | int main_3(); 10 | extern void vl53_task(void (*func)(char*)); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | #endif -------------------------------------------------------------------------------- /easymqOs_detectDistance_vl53/微信截图_20230424141606.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_detectDistance_vl53/微信截图_20230424141606.png -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_gpsKalmanfilter/Makefile -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/Mqtt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${mosquitto_SOURCE_DIR}/lib 2 | ${STDBOOL_H_PATH} ${STDINT_H_PATH}) 3 | link_directories(${mosquitto_BINARY_DIR}/lib) 4 | 5 | set(shared_src client_shared.c client_shared.h) 6 | 7 | if (${WITH_SRV} STREQUAL ON) 8 | add_definitions("-DWITH_SRV") 9 | endif (${WITH_SRV} STREQUAL ON) 10 | 11 | add_executable(mosquitto_pub pub_client.c ${shared_src}) 12 | add_executable(mosquitto_sub sub_client.c ${shared_src}) 13 | 14 | target_link_libraries(mosquitto_pub libmosquitto) 15 | target_link_libraries(mosquitto_sub libmosquitto) 16 | 17 | install(TARGETS mosquitto_pub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 18 | install(TARGETS mosquitto_sub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 19 | -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/Mqtt/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CLIENT_LDFLAGS += -L./Mqtt/lib -lmosquitto -I. 5 | .PHONY: all install uninstall reallyclean clean 6 | 7 | all : mosquitto_pub mosquitto_sub 8 | 9 | mosquitto_pub : pub_client.o client_shared.o 10 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 11 | 12 | mosquitto_sub : sub_client.o client_shared.o 13 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 14 | 15 | pub_client.o : pub_client.c libmosquitto.so 16 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 17 | 18 | sub_client.o : sub_client.c libmosquitto.so 19 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 20 | 21 | client_shared.o : client_shared.c client_shared.h 22 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 23 | 24 | 25 | 26 | install : all 27 | $(INSTALL) -d ${DESTDIR}$(prefix)/bin 28 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_pub ${DESTDIR}${prefix}/bin/mosquitto_pub 29 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_sub ${DESTDIR}${prefix}/bin/mosquitto_sub 30 | 31 | uninstall : 32 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_pub 33 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_sub 34 | 35 | reallyclean : clean 36 | 37 | clean : 38 | -rm -f *.o mosquitto_pub mosquitto_sub 39 | -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/Mqtt/client_pub_sub.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIENT_PUB_SUB_H 2 | #define CLIENT_PUB_SUB_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | //extern int mainSub(int argc, char * argv [ ]); 8 | extern int mainSub(struct mosq_config *cfgon , char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 9 | extern int mainPub(struct mosq_config *cfgon, char *devid); 10 | extern int publish_message(unsigned int msglength,char *msg); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/Mqtt/client_shared.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Roger Light 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License v1.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | http://www.eclipse.org/legal/epl-v10.html 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | Contributors: 14 | Roger Light - initial implementation and documentation. 15 | */ 16 | 17 | #ifndef _CLIENT_CONFIG_H 18 | #define _CLIENT_CONFIG_H 19 | 20 | #include 21 | 22 | /* pub_client.c modes */ 23 | #define MSGMODE_NONE 0 24 | #define MSGMODE_CMD 1 25 | #define MSGMODE_STDIN_LINE 2 26 | #define MSGMODE_STDIN_FILE 3 27 | #define MSGMODE_FILE 4 28 | #define MSGMODE_NULL 5 29 | 30 | #define CLIENT_PUB 1 31 | #define CLIENT_SUB 2 32 | 33 | struct mosq_config { 34 | char *id; 35 | char *id_prefix; 36 | int protocol_version; 37 | int keepalive; 38 | char *host; 39 | int port; 40 | int qos; 41 | bool retain; 42 | int pub_mode; /* pub */ 43 | char *file_input; /* pub */ 44 | char *message; /* pub */ 45 | long msglen; /* pub */ 46 | char *topic; /* pub */ 47 | char *bind_address; 48 | #ifdef WITH_SRV 49 | bool use_srv; 50 | #endif 51 | bool debug; 52 | bool quiet; 53 | unsigned int max_inflight; 54 | char *username; 55 | char *password; 56 | char *will_topic; 57 | char *will_payload; 58 | long will_payloadlen; 59 | int will_qos; 60 | bool will_retain; 61 | #ifdef WITH_TLS 62 | char *cafile; 63 | char *capath; 64 | char *certfile; 65 | char *keyfile; 66 | char *ciphers; 67 | bool insecure; 68 | char *tls_version; 69 | # ifdef WITH_TLS_PSK 70 | char *psk; 71 | char *psk_identity; 72 | # endif 73 | #endif 74 | bool clean_session; /* sub */ 75 | char **topics; /* sub */ 76 | int topic_count; /* sub */ 77 | bool no_retain; /* sub */ 78 | char **filter_outs; /* sub */ 79 | int filter_out_count; /* sub */ 80 | bool verbose; /* sub */ 81 | bool eol; /* sub */ 82 | int msg_count; /* sub */ 83 | #ifdef WITH_SOCKS 84 | char *socks5_host; 85 | int socks5_port; 86 | char *socks5_username; 87 | char *socks5_password; 88 | #endif 89 | }; 90 | 91 | int client_config_load(struct mosq_config *config, int pub_or_sub, int argc, char *argv[]); 92 | void client_config_cleanup(struct mosq_config *cfg); 93 | int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg); 94 | int client_id_generate(struct mosq_config *cfg, const char *id_base); 95 | int client_connect(struct mosquitto *mosq, struct mosq_config *cfg); 96 | //int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, char *argv[]); 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/Mqtt/lib/libmosquitto.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_gpsKalmanfilter/Mqtt/lib/libmosquitto.so -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/README.MD: -------------------------------------------------------------------------------- 1 | # gps kalman filter 滤波精度可以定位 去除漂移 2 | 3 | 使用串口和gps ublox m8n解析nmea0813的数据 4 | 5 | 使用本程序可以搭建户外的定位小车 6 | 7 | -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/data/plot.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import scipy as sp 3 | import matplotlib.pyplot as plt 4 | # plot the gps data 5 | def loadData(flieName): 6 | inFile = open(flieName, 'r') 7 | 8 | x = [] 9 | y = [] 10 | cnt = 1; 11 | for line in inFile: 12 | cnt = cnt+1 13 | pair = line.split() 14 | x.append(pair[0]) 15 | y.append(pair[1]) 16 | if cnt==100: 17 | break 18 | 19 | x = map(float,x) 20 | y = map(float,y) 21 | return (x, y) 22 | 23 | (x,y) = loadData('raw_data.txt') 24 | (u,v) = loadData('filtered_data.txt') 25 | 26 | 27 | 28 | 29 | plt.figure(figsize=(8, 4)) 30 | plt.scatter(np.linspace(1,len(x),len(x)),[(a-118) for a in x],label="$lon data$", color="blue"); 31 | plt.scatter(np.linspace(1,len(u),len(u)),[(a-118.09) for a in x], label="$lonf data$", color="red") 32 | plt.legend() 33 | plt.show() 34 | 35 | # plt.plot(u,v, label="$filtered data$", color="red", linewidth=2) 36 | # plt.scatter(x,y,label="$raw data$", color="blue"); 37 | 38 | # plt.xlabel("lon(deg)") 39 | # plt.ylabel("lat(deg)") 40 | # plt.title("lat-lon plot") 41 | 42 | # plt.legend() 43 | # plt.show() 44 | 45 | 46 | -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/easy_mqos.h: -------------------------------------------------------------------------------- 1 | #ifndef EASY_MQOS_H 2 | #define EASY_MQOS_H 3 | 4 | #include 5 | #include 6 | #include "Mqtt/client_shared.h" 7 | #include "Mqtt/mosquitto.h" 8 | using namespace std; 9 | class easymqos 10 | { 11 | 12 | public: 13 | easymqos(); 14 | easymqos(int pub_or_sub ); 15 | ~easymqos(); 16 | 17 | //初始化系统 18 | bool Init_Sub(vector _topic); 19 | bool Start_Sub(); 20 | bool Init_Pub(char* _topic); 21 | bool Set_config_Pub(); 22 | bool Set_broker(char* host); 23 | unsigned int publish_messages(unsigned int len,string message); 24 | 25 | public: 26 | vector _topicStr; 27 | // struct mosq_config *subscribeCfg; 28 | // struct mosq_config *publicCfg; 29 | struct mosq_config *cfg; 30 | int _topicCnt_sub; 31 | 32 | }; 33 | 34 | 35 | 36 | 37 | #endif -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/gps_srcs/d: -------------------------------------------------------------------------------- 1 | d 2 | -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/gps_srcs/gps_apply.h: -------------------------------------------------------------------------------- 1 | /* To use these functions: 2 | 3 | 1. Start with a KalmanFilter created by alloc_filter_velocity2d. 4 | 2. At fixed intervals, call update_velocity2d with the lat/long. 5 | 3. At any time, to get an estimate for the current position, 6 | use the functions: get_lat_long 7 | */ 8 | 9 | #ifndef __GPS_H__ 10 | #define __GPS_H__ 11 | 12 | #include 13 | #include "gps_kalman.h" 14 | #include "coordinate_sys.h" 15 | 16 | 17 | // recommended useage 18 | void gps_init(double noise); 19 | void gps_update(double lat, double lon, double seconds_since_last_timestep); 20 | void gps_read(double* lat, double* lon); 21 | double get_distance(double LatFrom, double LonFrom, double LatTo, double LonTo); 22 | 23 | 24 | // see https://en.wikipedia.org/wiki/Earth_radius#Mean_radius 25 | extern const double PI; 26 | extern const double EARTH; 27 | 28 | /* Create a GPS filter that only tracks two dimensions of position and 29 | velocity. 30 | The inherent assumption is that changes in velocity are randomly 31 | distributed around 0. 32 | Noise is a parameter you can use to alter the expected noise. 33 | 1.0 is the original, and the higher it is, the more a path will be 34 | "smoothed". 35 | Free with free_filter after using. */ 36 | KalmanFilter alloc_filter_velocity2d(double noise); 37 | 38 | /* Set the seconds per timestep in the velocity2d model. */ 39 | void set_seconds_per_timestep(KalmanFilter f, 40 | double seconds_per_timestep); 41 | 42 | /* Update the velocity2d model with new gps data. */ 43 | void update_velocity2d(KalmanFilter f, double lat, double lon, 44 | double seconds_since_last_update); 45 | 46 | 47 | /* Extract a lat long from a velocity2d Kalman filter. */ 48 | void get_lat_long(KalmanFilter f, double* lat, double* lon); 49 | 50 | /* Extract velocity with lat-long-per-second units from a velocity2d 51 | Kalman filter. */ 52 | void get_velocity(KalmanFilter f, double* delta_lat, double* delta_lon); 53 | 54 | /* Extract a bearing from a velocity2d Kalman filter. 55 | 0 = north, 90 = east, 180 = south, 270 = west */ 56 | double get_bearing(double LatFrom, double LonFrom, double LatTo, double LonTo); 57 | 58 | ///* Convert a lat, long, delta lat, and delta long into mph.*/ 59 | //double calculate_mph(double lat, double lon, 60 | // double delta_lat, double delta_lon); 61 | // 62 | ///* Extract speed in miles per hour from a velocity2d Kalman filter. */ 63 | //double get_mph(KalmanFilter f); 64 | 65 | double get_distance(double LatFrom, double LonFrom, double LatTo, double LonTo); 66 | extern Location myGps_filter(double Lat, double Lon,float gpsSpeed,float gpsBearing,float imuHeading,float *fusion_heading); 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/gps_srcs/gps_main.h: -------------------------------------------------------------------------------- 1 | #ifndef GPS_MAIN_H 2 | #define GPS_MAIN_H 3 | 4 | 5 | #include "coordinate_sys.h" 6 | 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | extern 12 | void *GpsThread(void *); 13 | 14 | 15 | extern 16 | int gps_task(void(*pfunc)(Location ,float,float)); 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/gps_srcs/gpsparser.h: -------------------------------------------------------------------------------- 1 | #ifndef __PARSEGPS_H__ 2 | #define __PARSEGPS_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | bool gpsparser(char* data, double* lon, double* lat, double* HDOP, int* numSV); 10 | 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/gps_srcs/matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef __MATRIX_H__ 2 | #define __MATRIX_H__ 3 | 4 | typedef struct { 5 | /* Dimensions */ 6 | int rows; 7 | int cols; 8 | 9 | /* Contents of the matrix */ 10 | double** data; 11 | } Matrix; 12 | 13 | /* Allocate memory for a new matrix. 14 | Zeros out the matrix. 15 | Assert-fails if we are out of memory. 16 | */ 17 | Matrix alloc_matrix(int rows, int cols); 18 | 19 | /* Free memory for a matrix. */ 20 | void free_matrix(Matrix m); 21 | 22 | /* Set values of a matrix, row by row. */ 23 | void set_matrix(Matrix m, ...); 24 | 25 | /* Turn m into an identity matrix. */ 26 | void set_identity_matrix(Matrix m); 27 | 28 | /* Copy a matrix. */ 29 | void copy_matrix(Matrix source, Matrix destination); 30 | 31 | /* Pretty-print a matrix. */ 32 | void print_matrix(Matrix m); 33 | 34 | /* Add matrices a and b and put the result in c. */ 35 | void add_matrix(Matrix a, Matrix b, Matrix c); 36 | 37 | /* Subtract matrices a and b and put the result in c. */ 38 | void subtract_matrix(Matrix a, Matrix b, Matrix c); 39 | 40 | /* Subtract from the identity matrix in place. */ 41 | void subtract_from_identity_matrix(Matrix a); 42 | 43 | /* Multiply matrices a and b and put the result in c. */ 44 | void multiply_matrix(Matrix a, Matrix b, Matrix c); 45 | 46 | /* Multiply matrix a by b-transpose and put the result in c. */ 47 | void multiply_by_transpose_matrix(Matrix a, Matrix b, Matrix c); 48 | 49 | /* Transpose input and put the result in output. */ 50 | void transpose_matrix(Matrix input, Matrix output); 51 | 52 | /* Whether two matrices are approximately equal. */ 53 | int equal_matrix(Matrix a, Matrix b, double tolerance); 54 | 55 | /* Multiply a matrix by a scalar. */ 56 | void scale_matrix(Matrix m, double scalar); 57 | 58 | /* Swap rows r1 and r2 of a matrix. 59 | This is one of the three "elementary row operations". */ 60 | void swap_rows(Matrix m, int r1, int r2); 61 | 62 | /* Multiply row r of a matrix by a scalar. 63 | This is one of the three "elementary row operations". */ 64 | void scale_row(Matrix m, int r, double scalar); 65 | 66 | /* Add a multiple of row r2 to row r1. 67 | Also known as a "shear" operation. 68 | This is one of the three "elementary row operations". */ 69 | void shear_row(Matrix m, int r1, int r2, double scalar); 70 | 71 | /* Invert a square matrix. 72 | Returns whether the matrix is invertible. 73 | input is mutated as well by this routine. */ 74 | int destructive_invert_matrix(Matrix input, Matrix output); 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/inc/README.MD: -------------------------------------------------------------------------------- 1 | d 2 | -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/inc/Uart_comm.h: -------------------------------------------------------------------------------- 1 | #ifndef UART_COMM_H 2 | #define UART_COMM_H 3 | 4 | #include "sys/socket.h" 5 | #include "netinet/in.h" 6 | 7 | #include "string.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | 23 | 24 | extern speed_t getBaudrate(int baudrate); 25 | extern int OpenDev(char *Dev,int baudrate); 26 | extern int OpenDev_insulation(char *Dev,int baudrate); 27 | extern void GetCrC(unsigned char *CmmBuf, unsigned char Len); 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/inc/coordinate_sys.h: -------------------------------------------------------------------------------- 1 | #ifndef _COORDINATE_SYS_H 2 | #define _COORDINATE_SYS_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | 9 | 10 | 11 | 12 | #include 13 | #include "stdio.h" 14 | #include 15 | typedef struct { 16 | double lng; 17 | double lat; 18 | } Location; 19 | extern double degree_minute2dec_degrees(double deg); 20 | 21 | extern Location transformFromWGSToGCJ(Location wgLoc); 22 | extern Location transformFromGCJToWGS(Location gcLoc); 23 | extern Location bd_encrypt(Location gcLoc); 24 | extern Location bd_decrypt(Location bdLoc); 25 | extern Location WGS84tobaidu(double longti,double lati); 26 | 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/inc/geocoords.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #define PI 3.14159265 4 | 5 | class GeoCoordinate 6 | { 7 | public: 8 | double latitude; 9 | double longitude; 10 | 11 | GeoCoordinate() {}; 12 | GeoCoordinate(const char *_latitude, const char *_longitude) { latitude = atof(_latitude); longitude = atof(_longitude); } 13 | GeoCoordinate(double _latitude, double _longitude) {latitude = _latitude * PI / 180; longitude = _longitude * PI / 180; } 14 | }; 15 | 16 | 17 | double getBearing(GeoCoordinate startCoord, GeoCoordinate endCoord); 18 | double getDistance(GeoCoordinate startCoord, GeoCoordinate endCoord); 19 | -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/inc/method_parse.h: -------------------------------------------------------------------------------- 1 | #ifndef METHOD_PARSE_H 2 | #define METHOD_PARSE_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | extern void save_waypoint(); 8 | extern void clear_waypoint(); 9 | extern void push_waypoint(double lon ,double lat); 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/inc/serial.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_gpsKalmanfilter/inc/serial.h -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/src/README.MD: -------------------------------------------------------------------------------- 1 | d 2 | -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/src/geocoords.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "geocoords.h" 3 | 4 | 5 | 6 | /* 7 | class GeoCoordinate 8 | { 9 | };*/ 10 | 11 | double getBearing(GeoCoordinate startCoord, GeoCoordinate endCoord) 12 | { 13 | double y = sin(endCoord.longitude - startCoord.longitude) * cos(endCoord.latitude); 14 | double x = cos(startCoord.latitude) * sin(endCoord.latitude) - sin(startCoord.latitude) * cos(endCoord.latitude) * cos(endCoord.longitude - startCoord.longitude); 15 | double bearingRadians = atan2(y, x); 16 | double bearingDegrees = bearingRadians * (180 / PI); 17 | bearingDegrees = fmod(bearingDegrees + 360, 360); 18 | 19 | return bearingDegrees; 20 | } 21 | 22 | double getDistance(GeoCoordinate startCoord, GeoCoordinate endCoord) 23 | { 24 | double distance = acos(sin(startCoord.latitude) * sin(endCoord.latitude) + cos(startCoord.latitude) * cos(endCoord.latitude) * cos(endCoord.longitude - startCoord.longitude) ) * 6371; 25 | 26 | return distance; 27 | } 28 | -------------------------------------------------------------------------------- /easymqOs_gpsKalmanfilter/src/method_parse.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_gpsKalmanfilter/src/method_parse.cpp -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/LidarDemo/README.MD: -------------------------------------------------------------------------------- 1 | LidarDemo 2 | -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/LidarDemo/RPLidar.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_lidarA1_node/LidarDemo/RPLidar.h -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/LidarDemo/inc/README.MD: -------------------------------------------------------------------------------- 1 | headers 2 | -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/LidarDemo/inc/rplidar_protocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, RoboPeak 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 19 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 22 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 23 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 24 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 25 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | * 27 | */ 28 | /* 29 | * RoboPeak LIDAR System 30 | * Data Packet IO protocol definition for RP-LIDAR 31 | * 32 | * Copyright 2009 - 2014 RoboPeak Team 33 | * http://www.robopeak.com 34 | * 35 | */ 36 | 37 | 38 | #pragma once 39 | 40 | // RP-Lidar Input Packets 41 | 42 | #define RPLIDAR_CMD_SYNC_BYTE 0xA5 43 | #define RPLIDAR_CMDFLAG_HAS_PAYLOAD 0x80 44 | 45 | 46 | #define RPLIDAR_ANS_SYNC_BYTE1 0xA5 47 | #define RPLIDAR_ANS_SYNC_BYTE2 0x5A 48 | 49 | #define RPLIDAR_ANS_PKTFLAG_LOOP 0x1 50 | 51 | 52 | #if defined(_WIN32) 53 | #pragma pack(1) 54 | #endif 55 | 56 | typedef struct _rplidar_cmd_packet_t { 57 | _u8 syncByte; //must be RPLIDAR_CMD_SYNC_BYTE 58 | _u8 cmd_flag; 59 | _u8 size; 60 | _u8 data[0]; 61 | } __attribute__((packed)) rplidar_cmd_packet_t; 62 | 63 | 64 | typedef struct _rplidar_ans_header_t { 65 | _u8 syncByte1; // must be RPLIDAR_ANS_SYNC_BYTE1 66 | _u8 syncByte2; // must be RPLIDAR_ANS_SYNC_BYTE2 67 | _u32 size:30; 68 | _u32 subType:2; 69 | _u8 type; 70 | } __attribute__((packed)) rplidar_ans_header_t; 71 | 72 | #if defined(_WIN32) 73 | #pragma pack() 74 | #endif 75 | -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/LidarDemo/makefile: -------------------------------------------------------------------------------- 1 | g++ main.cpp RPLidar.cpp hardwareserial.cpp -I. -o test -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_lidarA1_node/Makefile -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/Mqtt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${mosquitto_SOURCE_DIR}/lib 2 | ${STDBOOL_H_PATH} ${STDINT_H_PATH}) 3 | link_directories(${mosquitto_BINARY_DIR}/lib) 4 | 5 | set(shared_src client_shared.c client_shared.h) 6 | 7 | if (${WITH_SRV} STREQUAL ON) 8 | add_definitions("-DWITH_SRV") 9 | endif (${WITH_SRV} STREQUAL ON) 10 | 11 | add_executable(mosquitto_pub pub_client.c ${shared_src}) 12 | add_executable(mosquitto_sub sub_client.c ${shared_src}) 13 | 14 | target_link_libraries(mosquitto_pub libmosquitto) 15 | target_link_libraries(mosquitto_sub libmosquitto) 16 | 17 | install(TARGETS mosquitto_pub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 18 | install(TARGETS mosquitto_sub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 19 | -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/Mqtt/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CLIENT_LDFLAGS += -L./Mqtt/lib -lmosquitto -I. 5 | .PHONY: all install uninstall reallyclean clean 6 | 7 | all : mosquitto_pub mosquitto_sub 8 | 9 | mosquitto_pub : pub_client.o client_shared.o 10 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 11 | 12 | mosquitto_sub : sub_client.o client_shared.o 13 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 14 | 15 | pub_client.o : pub_client.c libmosquitto.so 16 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 17 | 18 | sub_client.o : sub_client.c libmosquitto.so 19 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 20 | 21 | client_shared.o : client_shared.c client_shared.h 22 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 23 | 24 | 25 | 26 | install : all 27 | $(INSTALL) -d ${DESTDIR}$(prefix)/bin 28 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_pub ${DESTDIR}${prefix}/bin/mosquitto_pub 29 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_sub ${DESTDIR}${prefix}/bin/mosquitto_sub 30 | 31 | uninstall : 32 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_pub 33 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_sub 34 | 35 | reallyclean : clean 36 | 37 | clean : 38 | -rm -f *.o mosquitto_pub mosquitto_sub 39 | -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/Mqtt/README.MD: -------------------------------------------------------------------------------- 1 | need copy to here from imu node 2 | -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/Mqtt/client_pub_sub.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIENT_PUB_SUB_H 2 | #define CLIENT_PUB_SUB_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | //extern int mainSub(int argc, char * argv [ ]); 8 | extern int mainSub(struct mosq_config *cfgon , char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 9 | extern int mainPub(struct mosq_config *cfgon, char *devid); 10 | extern int publish_message(unsigned int msglength,char *msg); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/Mqtt/client_shared.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Roger Light 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License v1.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | http://www.eclipse.org/legal/epl-v10.html 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | Contributors: 14 | Roger Light - initial implementation and documentation. 15 | */ 16 | 17 | #ifndef _CLIENT_CONFIG_H 18 | #define _CLIENT_CONFIG_H 19 | 20 | #include 21 | 22 | /* pub_client.c modes */ 23 | #define MSGMODE_NONE 0 24 | #define MSGMODE_CMD 1 25 | #define MSGMODE_STDIN_LINE 2 26 | #define MSGMODE_STDIN_FILE 3 27 | #define MSGMODE_FILE 4 28 | #define MSGMODE_NULL 5 29 | 30 | #define CLIENT_PUB 1 31 | #define CLIENT_SUB 2 32 | 33 | struct mosq_config { 34 | char *id; 35 | char *id_prefix; 36 | int protocol_version; 37 | int keepalive; 38 | char *host; 39 | int port; 40 | int qos; 41 | bool retain; 42 | int pub_mode; /* pub */ 43 | char *file_input; /* pub */ 44 | char *message; /* pub */ 45 | long msglen; /* pub */ 46 | char *topic; /* pub */ 47 | char *bind_address; 48 | #ifdef WITH_SRV 49 | bool use_srv; 50 | #endif 51 | bool debug; 52 | bool quiet; 53 | unsigned int max_inflight; 54 | char *username; 55 | char *password; 56 | char *will_topic; 57 | char *will_payload; 58 | long will_payloadlen; 59 | int will_qos; 60 | bool will_retain; 61 | #ifdef WITH_TLS 62 | char *cafile; 63 | char *capath; 64 | char *certfile; 65 | char *keyfile; 66 | char *ciphers; 67 | bool insecure; 68 | char *tls_version; 69 | # ifdef WITH_TLS_PSK 70 | char *psk; 71 | char *psk_identity; 72 | # endif 73 | #endif 74 | bool clean_session; /* sub */ 75 | char **topics; /* sub */ 76 | int topic_count; /* sub */ 77 | bool no_retain; /* sub */ 78 | char **filter_outs; /* sub */ 79 | int filter_out_count; /* sub */ 80 | bool verbose; /* sub */ 81 | bool eol; /* sub */ 82 | int msg_count; /* sub */ 83 | #ifdef WITH_SOCKS 84 | char *socks5_host; 85 | int socks5_port; 86 | char *socks5_username; 87 | char *socks5_password; 88 | #endif 89 | }; 90 | 91 | int client_config_load(struct mosq_config *config, int pub_or_sub, int argc, char *argv[]); 92 | void client_config_cleanup(struct mosq_config *cfg); 93 | int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg); 94 | int client_id_generate(struct mosq_config *cfg, const char *id_base); 95 | int client_connect(struct mosquitto *mosq, struct mosq_config *cfg); 96 | //int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, char *argv[]); 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/Mqtt/lib/libmosquitto.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_lidarA1_node/Mqtt/lib/libmosquitto.so -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/README.MD: -------------------------------------------------------------------------------- 1 | slamtech lidar A1 2 | 将IMU 节点下的MQTT 文件复制到本节点下的Mqtt下 3 | -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/easy_mqos.h: -------------------------------------------------------------------------------- 1 | #ifndef EASY_MQOS_H 2 | #define EASY_MQOS_H 3 | 4 | #include 5 | #include 6 | #include "Mqtt/client_shared.h" 7 | #include "Mqtt/mosquitto.h" 8 | using namespace std; 9 | class easymqos 10 | { 11 | 12 | public: 13 | easymqos(); 14 | easymqos(int pub_or_sub ); 15 | ~easymqos(); 16 | 17 | //初始化系统 18 | bool Init_Sub(vector _topic); 19 | bool Start_Sub(); 20 | bool Init_Pub(char* _topic); 21 | bool Set_config_Pub(); 22 | bool Set_broker(char* host); 23 | unsigned int publish_messages(unsigned int len,string message); 24 | 25 | public: 26 | vector _topicStr; 27 | // struct mosq_config *subscribeCfg; 28 | // struct mosq_config *publicCfg; 29 | struct mosq_config *cfg; 30 | int _topicCnt_sub; 31 | 32 | }; 33 | 34 | 35 | 36 | 37 | #endif -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/inc/README.MD: -------------------------------------------------------------------------------- 1 | include headers 2 | -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/inc/getlidars.h: -------------------------------------------------------------------------------- 1 | #ifndef GEtLIDAR_h 2 | #define GEtLIDAR_h 3 | 4 | 5 | 6 | 7 | 8 | // #ifdef __cplusplus 9 | // extern "C" { 10 | // #endif 11 | 12 | 13 | 14 | 15 | typedef struct 16 | { 17 | unsigned short dis[360]; 18 | unsigned long timeStamp; 19 | }lidar_t; 20 | extern char fixing ; 21 | 22 | extern void lidar_task(void(*pfunc)(lidar_t)); 23 | // #ifdef __cplusplus 24 | // } 25 | // #endif 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/inc/method_parse.h: -------------------------------------------------------------------------------- 1 | #ifndef METHOD_PARSE_H 2 | #define METHOD_PARSE_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | extern void save_waypoint(); 8 | extern void clear_waypoint(); 9 | extern void push_waypoint(double lon ,double lat); 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/main.cpp: -------------------------------------------------------------------------------- 1 | #include "easy_mqos.h" 2 | #include "Mqtt/client_shared.h" 3 | #include 4 | #include 5 | #include 6 | 7 | #include "Mqtt/client_pub_sub.h" 8 | #include "Mqtt/mosquitto.h" 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | 21 | /*pthread*/ 22 | #include "sys/ipc.h" 23 | #include "sys/msg.h" 24 | #include "pthread.h" 25 | #include 26 | #include 27 | #include "method_parse.h" 28 | #include "cJSON.h" 29 | 30 | #include "getlidars.h" 31 | using namespace std; 32 | 33 | void lidar_callback(lidar_t _msg) 34 | { 35 | 36 | char tmp_buf[0xff]={0}; 37 | char topic_buf[0xff]={0}; 38 | char value_buf[4096]={0}; 39 | char send_buf[4096]={0}; 40 | 41 | //memcpy(topic_buf,"/state/gps",sizeof("/state/gps")); 42 | // for(int i=0;i<360;i++) 43 | //printf("degree:%d:dis:%d \n",i,_msg.dis[i]); 44 | // printf("############### \n"); 45 | // printf("degeree display :%d ,%d \n",(int)ceil(anga) ,(unsigned short)round(distance)); 46 | memcpy(value_buf,&_msg.timeStamp,4); 47 | memcpy(value_buf+4,_msg.dis,360*sizeof(unsigned short)); 48 | 49 | //sprintf(topic_buf,"%s/state/gps",chargename); 50 | 51 | #if defined MQTT_REMOTE_SERVER 52 | sprintf(send_buf,"mosquitto_pub -h www.woyilian.com -t %s -m \"%s\"",topic_buf,value_buf); 53 | #elif defined MQTT_TERMINAL_SERVER 54 | sprintf(send_buf,"mosquitto_pub -t %s -m \"%s\"",topic_buf,value_buf); 55 | #endif 56 | 57 | 58 | //system(send_buf); 59 | 60 | publish_message(4+360*sizeof(unsigned short),(char*)value_buf); 61 | 62 | return ; 63 | } 64 | /******************************************************************************* 65 | * function name : main 66 | * description : main function for 67 | * param[in] : none 68 | * param[out] : none 69 | * return : 0-success,-1-fail 70 | *******************************************************************************/ 71 | int main (int argc, char ** argv) 72 | { 73 | 74 | easymqos *e_demo = new easymqos(CLIENT_PUB); 75 | 76 | e_demo->Init_Pub("/sensors/lidar_node_pub"); 77 | e_demo->Set_broker("127.0.0.1"); 78 | e_demo->Set_config_Pub(); 79 | 80 | lidar_task(lidar_callback);//启动任务并设置回调函数 81 | 82 | return 0; 83 | } -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/src/README.MD: -------------------------------------------------------------------------------- 1 | s 2 | -------------------------------------------------------------------------------- /easymqOs_lidarA1_node/src/method_parse.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_lidarA1_node/src/method_parse.cpp -------------------------------------------------------------------------------- /easymqOs_lidardelta2_node/LidarDemo/include/CCountDown.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************** 2 | File name: CCountDown.h 3 | Author: Kimbo 4 | Version: V1.6.0 5 | Date: 2016-7-12 6 | Description: Count down class 7 | Others: None 8 | 9 | History: 10 | 1. Date: 11 | Author: 12 | Modification: 13 | ***********************************************************************************/ 14 | 15 | #ifndef EVEREST_LIDAR_CCOUNTDOWN_H_ 16 | #define EVEREST_LIDAR_CCOUNTDOWN_H_ 17 | 18 | /******************************* Current libs includes ****************************/ 19 | #include "CTime.h" 20 | 21 | /********************************** System includes *******************************/ 22 | #include 23 | 24 | 25 | namespace everest 26 | { 27 | namespace hwdrivers 28 | { 29 | class CCountDown 30 | { 31 | public: 32 | /* Constructor */ 33 | CCountDown(); 34 | 35 | /* Constructor */ 36 | CCountDown(double time_ms); 37 | 38 | /* Destructor */ 39 | ~CCountDown(); 40 | 41 | /* Set time */ 42 | void setTime(double time_ms); 43 | 44 | /* Is end */ 45 | bool isEnd() const; 46 | 47 | /* Get left time, unit is ms */ 48 | double getLeftTime() const; 49 | 50 | /* Get left time, unit is ms */ 51 | double getLeftMsTime() const { return getLeftTime() * 1000.0;} 52 | 53 | /* Get Input time */ 54 | double getInputTime() const { return m_time_ms;} 55 | 56 | private: 57 | TTimeStamp m_end_time; 58 | bool m_end_flag; 59 | double m_time_ms; 60 | }; 61 | } 62 | } 63 | 64 | #endif 65 | 66 | 67 | -------------------------------------------------------------------------------- /easymqOs_lidardelta2_node/LidarDemo/include/CTime.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************** 2 | File name: CTime.h 3 | Author: Kimbo 4 | Version: V1.5.0 5 | Date: 2016-4-25 6 | Description: Time class 7 | Others: None 8 | 9 | History: 10 | 1. Date: 11 | Author: 12 | Modification: 13 | ***********************************************************************************/ 14 | 15 | #ifndef EVEREST_LIDAR_CTIME_H_ 16 | #define EVEREST_LIDAR_CTIME_H_ 17 | 18 | 19 | /********************************** System includes *******************************/ 20 | #include 21 | #include 22 | 23 | #define INVALID_TIMESTAMP (0) 24 | 25 | namespace everest 26 | { 27 | namespace hwdrivers 28 | { 29 | typedef uint64_t TTimeStamp; 30 | struct TTimeParts 31 | { 32 | uint16_t year; /** The year */ 33 | uint8_t month; /** Month (1-12) */ 34 | uint8_t day; /** Day (1-31) */ 35 | uint8_t hour; /** Hour (0-23) */ 36 | uint8_t minute; /** Minute (0-59) */ 37 | double second; /** Seconds (0.0000-59.9999) */ 38 | uint8_t day_of_week; /** Day of week (1:Sunday, 7:Saturday) */ 39 | int daylight_saving; 40 | }; 41 | 42 | class CTime 43 | { 44 | public: 45 | /* Constructor */ 46 | CTime(); 47 | 48 | /* Destructor */ 49 | ~CTime(); 50 | 51 | /* Add time */ 52 | static TTimeStamp addTime(TTimeStamp time, double time_ms); 53 | 54 | /* Get real time */ 55 | static TTimeStamp getRealTime(); 56 | 57 | /* Transfer time to string */ 58 | static std::string timeToString(TTimeStamp &time); 59 | 60 | /* Get cpu time */ 61 | static TTimeStamp getCpuTime(); 62 | 63 | /* Time_t to stamp */ 64 | static TTimeStamp time_tToTimestamp(const time_t &t); 65 | 66 | /* Get time difference, unit is s */ 67 | static double timeDifference( const TTimeStamp &t1, const TTimeStamp &t2 ); 68 | 69 | /* Get time string */ 70 | static std::string getTimeString(); 71 | 72 | /* Timestamp to parts */ 73 | static void timestampToParts( TTimeStamp t, TTimeParts &p , bool localTime); 74 | 75 | /* timestamp to time_t */ 76 | static double timestampTotime_t( const TTimeStamp &t ); 77 | 78 | private: 79 | }; 80 | } 81 | } 82 | 83 | #endif 84 | 85 | 86 | -------------------------------------------------------------------------------- /easymqOs_lidardelta2_node/LidarDemo/include/typedef.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __TYPEDEF_H__ 3 | #define __TYPEDEF_H__ 4 | 5 | #include 6 | 7 | 8 | typedef int8_t s8; 9 | typedef uint8_t u8; 10 | 11 | typedef int16_t s16; 12 | typedef uint16_t u16; 13 | 14 | typedef int32_t s32; 15 | typedef uint32_t u32; 16 | 17 | typedef int64_t s64; 18 | typedef uint64_t u64; 19 | 20 | enum TYPEBOOL 21 | { 22 | FALSE = 0, TRUE = !FALSE 23 | }; 24 | 25 | #define HWREG(x) (*((volatile unsigned long *)(x))) 26 | #define HWREGS(x) (*((volatile signed long *)(x))) 27 | #define HSREG(x) (*((volatile unsigned short *)(x))) 28 | #define HBREG(x) (*((volatile unsigned char *)(x))) 29 | 30 | #define U8_MAX ((u8)255) 31 | #define S8_MAX ((s8)127) 32 | #define S8_MIN ((s8)-128) 33 | #define U16_MAX ((u16)65535u) 34 | #define S16_MAX ((s16)32767) 35 | #define S16_MIN ((s16)-32768) 36 | #define U32_MAX ((u32)4294967295uL) 37 | #define S32_MAX ((s32)2147483647) 38 | #define S32_MIN ((s32)-2147483648) 39 | 40 | #endif //__TYPEDEF_H__ 41 | -------------------------------------------------------------------------------- /easymqOs_lidardelta2_node/Mqtt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${mosquitto_SOURCE_DIR}/lib 2 | ${STDBOOL_H_PATH} ${STDINT_H_PATH}) 3 | link_directories(${mosquitto_BINARY_DIR}/lib) 4 | 5 | set(shared_src client_shared.c client_shared.h) 6 | 7 | if (${WITH_SRV} STREQUAL ON) 8 | add_definitions("-DWITH_SRV") 9 | endif (${WITH_SRV} STREQUAL ON) 10 | 11 | add_executable(mosquitto_pub pub_client.c ${shared_src}) 12 | add_executable(mosquitto_sub sub_client.c ${shared_src}) 13 | 14 | target_link_libraries(mosquitto_pub libmosquitto) 15 | target_link_libraries(mosquitto_sub libmosquitto) 16 | 17 | install(TARGETS mosquitto_pub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 18 | install(TARGETS mosquitto_sub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 19 | -------------------------------------------------------------------------------- /easymqOs_lidardelta2_node/Mqtt/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CLIENT_LDFLAGS += -L./Mqtt/lib -lmosquitto -I. 5 | .PHONY: all install uninstall reallyclean clean 6 | 7 | all : mosquitto_pub mosquitto_sub 8 | 9 | mosquitto_pub : pub_client.o client_shared.o 10 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 11 | 12 | mosquitto_sub : sub_client.o client_shared.o 13 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 14 | 15 | pub_client.o : pub_client.c libmosquitto.so 16 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 17 | 18 | sub_client.o : sub_client.c libmosquitto.so 19 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 20 | 21 | client_shared.o : client_shared.c client_shared.h 22 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 23 | 24 | 25 | 26 | install : all 27 | $(INSTALL) -d ${DESTDIR}$(prefix)/bin 28 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_pub ${DESTDIR}${prefix}/bin/mosquitto_pub 29 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_sub ${DESTDIR}${prefix}/bin/mosquitto_sub 30 | 31 | uninstall : 32 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_pub 33 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_sub 34 | 35 | reallyclean : clean 36 | 37 | clean : 38 | -rm -f *.o mosquitto_pub mosquitto_sub 39 | -------------------------------------------------------------------------------- /easymqOs_lidardelta2_node/Mqtt/client_pub_sub.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIENT_PUB_SUB_H 2 | #define CLIENT_PUB_SUB_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | //extern int mainSub(int argc, char * argv [ ]); 8 | extern int mainSub(struct mosq_config *cfgon , char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 9 | extern int mainPub(struct mosq_config *cfgon, char *devid); 10 | extern int publish_message(unsigned int msglength,char *msg); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /easymqOs_lidardelta2_node/Mqtt/client_shared.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Roger Light 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License v1.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | http://www.eclipse.org/legal/epl-v10.html 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | Contributors: 14 | Roger Light - initial implementation and documentation. 15 | */ 16 | 17 | #ifndef _CLIENT_CONFIG_H 18 | #define _CLIENT_CONFIG_H 19 | 20 | #include 21 | 22 | /* pub_client.c modes */ 23 | #define MSGMODE_NONE 0 24 | #define MSGMODE_CMD 1 25 | #define MSGMODE_STDIN_LINE 2 26 | #define MSGMODE_STDIN_FILE 3 27 | #define MSGMODE_FILE 4 28 | #define MSGMODE_NULL 5 29 | 30 | #define CLIENT_PUB 1 31 | #define CLIENT_SUB 2 32 | 33 | struct mosq_config { 34 | char *id; 35 | char *id_prefix; 36 | int protocol_version; 37 | int keepalive; 38 | char *host; 39 | int port; 40 | int qos; 41 | bool retain; 42 | int pub_mode; /* pub */ 43 | char *file_input; /* pub */ 44 | char *message; /* pub */ 45 | long msglen; /* pub */ 46 | char *topic; /* pub */ 47 | char *bind_address; 48 | #ifdef WITH_SRV 49 | bool use_srv; 50 | #endif 51 | bool debug; 52 | bool quiet; 53 | unsigned int max_inflight; 54 | char *username; 55 | char *password; 56 | char *will_topic; 57 | char *will_payload; 58 | long will_payloadlen; 59 | int will_qos; 60 | bool will_retain; 61 | #ifdef WITH_TLS 62 | char *cafile; 63 | char *capath; 64 | char *certfile; 65 | char *keyfile; 66 | char *ciphers; 67 | bool insecure; 68 | char *tls_version; 69 | # ifdef WITH_TLS_PSK 70 | char *psk; 71 | char *psk_identity; 72 | # endif 73 | #endif 74 | bool clean_session; /* sub */ 75 | char **topics; /* sub */ 76 | int topic_count; /* sub */ 77 | bool no_retain; /* sub */ 78 | char **filter_outs; /* sub */ 79 | int filter_out_count; /* sub */ 80 | bool verbose; /* sub */ 81 | bool eol; /* sub */ 82 | int msg_count; /* sub */ 83 | #ifdef WITH_SOCKS 84 | char *socks5_host; 85 | int socks5_port; 86 | char *socks5_username; 87 | char *socks5_password; 88 | #endif 89 | }; 90 | 91 | int client_config_load(struct mosq_config *config, int pub_or_sub, int argc, char *argv[]); 92 | void client_config_cleanup(struct mosq_config *cfg); 93 | int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg); 94 | int client_id_generate(struct mosq_config *cfg, const char *id_base); 95 | int client_connect(struct mosquitto *mosq, struct mosq_config *cfg); 96 | //int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, char *argv[]); 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /easymqOs_lidardelta2_node/easy_mqos.h: -------------------------------------------------------------------------------- 1 | #ifndef EASY_MQOS_H 2 | #define EASY_MQOS_H 3 | 4 | #include 5 | #include 6 | #include "Mqtt/client_shared.h" 7 | #include "Mqtt/mosquitto.h" 8 | using namespace std; 9 | class easymqos 10 | { 11 | 12 | public: 13 | easymqos(); 14 | easymqos(int pub_or_sub ); 15 | ~easymqos(); 16 | 17 | //初始化系统 18 | bool Init_Sub(vector _topic); 19 | bool Start_Sub(); 20 | bool Init_Pub(char* _topic); 21 | bool Set_config_Pub(); 22 | bool Set_broker(char* host); 23 | unsigned int publish_messages(unsigned int len,string message); 24 | 25 | public: 26 | vector _topicStr; 27 | // struct mosq_config *subscribeCfg; 28 | // struct mosq_config *publicCfg; 29 | struct mosq_config *cfg; 30 | int _topicCnt_sub; 31 | 32 | }; 33 | 34 | 35 | 36 | 37 | #endif -------------------------------------------------------------------------------- /easymqOs_lidardelta2_node/inc/getlidars.h: -------------------------------------------------------------------------------- 1 | #ifndef GEtLIDAR_h 2 | #define GEtLIDAR_h 3 | 4 | 5 | 6 | 7 | 8 | // #ifdef __cplusplus 9 | // extern "C" { 10 | // #endif 11 | 12 | 13 | 14 | 15 | typedef struct 16 | { 17 | unsigned short dis[360]; 18 | unsigned long timeStamp; 19 | }lidar_t; 20 | extern char fixing ; 21 | 22 | extern void lidar_task(void(*pfunc)(lidar_t)); 23 | // #ifdef __cplusplus 24 | // } 25 | // #endif 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /easymqOs_lidardelta2_node/inc/method_parse.h: -------------------------------------------------------------------------------- 1 | #ifndef METHOD_PARSE_H 2 | #define METHOD_PARSE_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | extern void save_waypoint(); 8 | extern void clear_waypoint(); 9 | extern void push_waypoint(double lon ,double lat); 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /easymqOs_lidardelta2_node/main.cpp: -------------------------------------------------------------------------------- 1 | #include "easy_mqos.h" 2 | #include "Mqtt/client_shared.h" 3 | #include 4 | #include 5 | #include 6 | 7 | #include "Mqtt/client_pub_sub.h" 8 | #include "Mqtt/mosquitto.h" 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | 21 | /*pthread*/ 22 | #include "sys/ipc.h" 23 | #include "sys/msg.h" 24 | #include "pthread.h" 25 | #include 26 | #include 27 | #include "method_parse.h" 28 | #include "cJSON.h" 29 | 30 | #include "getlidars.h" 31 | using namespace std; 32 | 33 | void lidar_callback(lidar_t _msg) 34 | { 35 | 36 | char tmp_buf[0xff]={0}; 37 | char topic_buf[0xff]={0}; 38 | char value_buf[4096]={0}; 39 | char send_buf[4096]={0}; 40 | 41 | //memcpy(topic_buf,"/state/gps",sizeof("/state/gps")); 42 | // for(int i=0;i<360;i++) 43 | //printf("degree:%d:dis:%d \n",i,_msg.dis[i]); 44 | // printf("############### \n"); 45 | // printf("degeree display :%d ,%d \n",(int)ceil(anga) ,(unsigned short)round(distance)); 46 | memcpy(value_buf,&_msg.timeStamp,4); 47 | memcpy(value_buf+4,_msg.dis,360*sizeof(unsigned short)); 48 | 49 | //sprintf(topic_buf,"%s/state/gps",chargename); 50 | 51 | #if defined MQTT_REMOTE_SERVER 52 | sprintf(send_buf,"mosquitto_pub -h www.woyilian.com -t %s -m \"%s\"",topic_buf,value_buf); 53 | #elif defined MQTT_TERMINAL_SERVER 54 | sprintf(send_buf,"mosquitto_pub -t %s -m \"%s\"",topic_buf,value_buf); 55 | #endif 56 | 57 | 58 | //system(send_buf); 59 | 60 | publish_message(4+360*sizeof(unsigned short),(char*)value_buf); 61 | 62 | return ; 63 | } 64 | /******************************************************************************* 65 | * function name : main 66 | * description : main function for 67 | * param[in] : none 68 | * param[out] : none 69 | * return : 0-success,-1-fail 70 | *******************************************************************************/ 71 | int main (int argc, char ** argv) 72 | { 73 | 74 | easymqos *e_demo = new easymqos(CLIENT_PUB); 75 | 76 | e_demo->Init_Pub("/sensors/lidar_node_pub"); 77 | e_demo->Set_broker("127.0.0.1"); 78 | e_demo->Set_config_Pub(); 79 | 80 | lidar_task(lidar_callback);//启动任务并设置回调函数 81 | 82 | return 0; 83 | } -------------------------------------------------------------------------------- /easymqOs_lidardelta2_node/readme.MD: -------------------------------------------------------------------------------- 1 | Delta 2 激光雷达 2 | 支持发布,本程序中距离单位为mm 3 | degeree display :4 ,300 4 | distance from lidar :300.750000 5 | degeree display :5 ,301 6 | distance from lidar :298.250000 7 | degeree display :6 ,298 8 | distance from lidar :0.000000 9 | distance from lidar :0.000000 10 | distance from lidar :0.000000 11 | distance from lidar :0.000000 12 | distance from lidar :0.000000 13 | distance from lidar :0.000000 14 | distance from lidar :0.000000 15 | distance from lidar :458.500000 16 | degeree display :15 ,459 17 | 。。。。 18 | degeree display :358 ,240 19 | distance from lidar :241.000000 20 | degeree display :359 ,241 21 | -------------------------------------------------------------------------------- /easymqOs_lidardelta2_node/sn.txt: -------------------------------------------------------------------------------- 1 | 1645508320985870 2 | -------------------------------------------------------------------------------- /easymqOs_lidardelta2_node/src/method_parse.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_lidardelta2_node/src/method_parse.cpp -------------------------------------------------------------------------------- /easymqOs_navigation/Mqtt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${mosquitto_SOURCE_DIR}/lib 2 | ${STDBOOL_H_PATH} ${STDINT_H_PATH}) 3 | link_directories(${mosquitto_BINARY_DIR}/lib) 4 | 5 | set(shared_src client_shared.c client_shared.h) 6 | 7 | if (${WITH_SRV} STREQUAL ON) 8 | add_definitions("-DWITH_SRV") 9 | endif (${WITH_SRV} STREQUAL ON) 10 | 11 | add_executable(mosquitto_pub pub_client.c ${shared_src}) 12 | add_executable(mosquitto_sub sub_client.c ${shared_src}) 13 | 14 | target_link_libraries(mosquitto_pub libmosquitto) 15 | target_link_libraries(mosquitto_sub libmosquitto) 16 | 17 | install(TARGETS mosquitto_pub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 18 | install(TARGETS mosquitto_sub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 19 | -------------------------------------------------------------------------------- /easymqOs_navigation/Mqtt/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CLIENT_LDFLAGS += -L./Mqtt/lib -lmosquitto -I. 5 | .PHONY: all install uninstall reallyclean clean 6 | 7 | all : mosquitto_pub mosquitto_sub 8 | 9 | mosquitto_pub : pub_client.o client_shared.o 10 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 11 | 12 | mosquitto_sub : sub_client.o client_shared.o 13 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 14 | 15 | pub_client.o : pub_client.c libmosquitto.so 16 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 17 | 18 | sub_client.o : sub_client.c libmosquitto.so 19 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 20 | 21 | client_shared.o : client_shared.c client_shared.h 22 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 23 | 24 | 25 | 26 | install : all 27 | $(INSTALL) -d ${DESTDIR}$(prefix)/bin 28 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_pub ${DESTDIR}${prefix}/bin/mosquitto_pub 29 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_sub ${DESTDIR}${prefix}/bin/mosquitto_sub 30 | 31 | uninstall : 32 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_pub 33 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_sub 34 | 35 | reallyclean : clean 36 | 37 | clean : 38 | -rm -f *.o mosquitto_pub mosquitto_sub 39 | -------------------------------------------------------------------------------- /easymqOs_navigation/Mqtt/client_pub_sub.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIENT_PUB_SUB_H 2 | #define CLIENT_PUB_SUB_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | //extern int mainSub(int argc, char * argv [ ]); 8 | extern int mainSub(struct mosq_config *cfgon , char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 9 | extern int mainPub(struct mosq_config *cfgon, char *devid); 10 | extern int publish_message(unsigned int msglength,char *msg); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /easymqOs_navigation/Mqtt/client_shared.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Roger Light 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License v1.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | http://www.eclipse.org/legal/epl-v10.html 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | Contributors: 14 | Roger Light - initial implementation and documentation. 15 | */ 16 | 17 | #ifndef _CLIENT_CONFIG_H 18 | #define _CLIENT_CONFIG_H 19 | 20 | #include 21 | 22 | /* pub_client.c modes */ 23 | #define MSGMODE_NONE 0 24 | #define MSGMODE_CMD 1 25 | #define MSGMODE_STDIN_LINE 2 26 | #define MSGMODE_STDIN_FILE 3 27 | #define MSGMODE_FILE 4 28 | #define MSGMODE_NULL 5 29 | 30 | #define CLIENT_PUB 1 31 | #define CLIENT_SUB 2 32 | 33 | struct mosq_config { 34 | char *id; 35 | char *id_prefix; 36 | int protocol_version; 37 | int keepalive; 38 | char *host; 39 | int port; 40 | int qos; 41 | bool retain; 42 | int pub_mode; /* pub */ 43 | char *file_input; /* pub */ 44 | char *message; /* pub */ 45 | long msglen; /* pub */ 46 | char *topic; /* pub */ 47 | char *bind_address; 48 | #ifdef WITH_SRV 49 | bool use_srv; 50 | #endif 51 | bool debug; 52 | bool quiet; 53 | unsigned int max_inflight; 54 | char *username; 55 | char *password; 56 | char *will_topic; 57 | char *will_payload; 58 | long will_payloadlen; 59 | int will_qos; 60 | bool will_retain; 61 | #ifdef WITH_TLS 62 | char *cafile; 63 | char *capath; 64 | char *certfile; 65 | char *keyfile; 66 | char *ciphers; 67 | bool insecure; 68 | char *tls_version; 69 | # ifdef WITH_TLS_PSK 70 | char *psk; 71 | char *psk_identity; 72 | # endif 73 | #endif 74 | bool clean_session; /* sub */ 75 | char **topics; /* sub */ 76 | int topic_count; /* sub */ 77 | bool no_retain; /* sub */ 78 | char **filter_outs; /* sub */ 79 | int filter_out_count; /* sub */ 80 | bool verbose; /* sub */ 81 | bool eol; /* sub */ 82 | int msg_count; /* sub */ 83 | #ifdef WITH_SOCKS 84 | char *socks5_host; 85 | int socks5_port; 86 | char *socks5_username; 87 | char *socks5_password; 88 | #endif 89 | }; 90 | 91 | int client_config_load(struct mosq_config *config, int pub_or_sub, int argc, char *argv[]); 92 | void client_config_cleanup(struct mosq_config *cfg); 93 | int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg); 94 | int client_id_generate(struct mosq_config *cfg, const char *id_base); 95 | int client_connect(struct mosquitto *mosq, struct mosq_config *cfg); 96 | //int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, char *argv[]); 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /easymqOs_navigation/easy_mqos.h: -------------------------------------------------------------------------------- 1 | #ifndef EASY_MQOS_H 2 | #define EASY_MQOS_H 3 | 4 | #include 5 | #include 6 | #include "Mqtt/client_shared.h" 7 | #include "Mqtt/mosquitto.h" 8 | using namespace std; 9 | class easymqos 10 | { 11 | 12 | public: 13 | easymqos(); 14 | easymqos(int pub_or_sub ); 15 | ~easymqos(); 16 | 17 | //初始化系统 18 | bool Init_Sub(vector _topic); 19 | bool Start_Sub(char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 20 | bool Init_Pub(char* _topic); 21 | bool Set_config_Pub(); 22 | bool Set_broker(char* host); 23 | unsigned int publish_messages(unsigned int len,string message); 24 | 25 | public: 26 | vector _topicStr; 27 | // struct mosq_config *subscribeCfg; 28 | // struct mosq_config *publicCfg; 29 | struct mosq_config *cfg; 30 | int _topicCnt_sub; 31 | 32 | }; 33 | 34 | 35 | 36 | 37 | #endif -------------------------------------------------------------------------------- /easymqOs_navigation/inc/kalman.h: -------------------------------------------------------------------------------- 1 | class Kalman 2 | { 3 | private: 4 | double q; //process noise covariance 5 | double r; //measurement noise covariance 6 | double x; //value 7 | double p; //estimation error covariance 8 | double k; //kalman gain 9 | 10 | public: 11 | Kalman(double _q, double _r, double _p, double _initial_value); 12 | void update(double measurement); 13 | void update_2(double measurement); 14 | void update(double r_measurement,double measurement); 15 | void update_avrage(double r_measurement,double measurement); 16 | 17 | double GetValue() {return x;} 18 | void reset(double _q, double _r, double _p, double _initial_value); 19 | }; 20 | -------------------------------------------------------------------------------- /easymqOs_navigation/inc/mydwa.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include 4 | #include 5 | 6 | using namespace cv; 7 | struct State { 8 | float x_; 9 | float y_; 10 | float theta_; 11 | float v_; 12 | float w_; 13 | }; 14 | 15 | struct Control { 16 | float v_; 17 | float w_; 18 | }; 19 | 20 | using Traj = std::vector; 21 | using Obstacle = std::vector;; 22 | class mydwa { 23 | public: 24 | mydwa(); 25 | 26 | // bool stepOnceToGoal(std::vector* best_trajectry, State* cur_state,Obstacle *cur_obs); 27 | int update_obstacle(Obstacle obs); 28 | void update_robot_and_goal(float x,float y,float theta,Point goal); 29 | State motion(State x, Control u); 30 | Traj calc_final_cost(Control& u); 31 | 32 | // int state_error_check(float head_d); 33 | Point goal_;//目标点 34 | Obstacle obs_;//障碍物 35 | State cur_x_;//机器人的状态 36 | private: 37 | 38 | 39 | Traj calc_trajectory(State x, float v, float w); 40 | float calc_obstacle_cost(Traj traj); 41 | float calc_degree_cost(Traj traj); 42 | 43 | 44 | 45 | 46 | float _vMin;//线速度 47 | float _vMax; 48 | //角速度 49 | float _wMin; 50 | float _wMax; 51 | 52 | }; 53 | -------------------------------------------------------------------------------- /easymqOs_navigation/inc/rtquaternion.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _RTQUATERNION_H_ 3 | #define _RTQUATERNION_H_ 4 | #include "sensor_msg.h" 5 | #include 6 | typedef float RTFLOAT; 7 | class RTQuaternion 8 | { 9 | public: 10 | RTQuaternion(); 11 | RTQuaternion(RTFLOAT scalar, RTFLOAT x, RTFLOAT y, RTFLOAT z); 12 | 13 | 14 | 15 | void normalize(); 16 | void toEuler(Vector3 *vec); 17 | void fromEuler(Vector3 vec); 18 | RTQuaternion conjugate() const; 19 | void toAngleVector(RTFLOAT& angle, Vector3 vec); 20 | void fromAngleVector(const RTFLOAT& angle, const Vector3 vec); 21 | 22 | void zero(); 23 | const char *display(); 24 | 25 | inline RTFLOAT scalar() const { return m_data[0]; } 26 | inline RTFLOAT x() const { return m_data[1]; } 27 | inline RTFLOAT y() const { return m_data[2]; } 28 | inline RTFLOAT z() const { return m_data[3]; } 29 | inline RTFLOAT data(const int i) const { return m_data[i]; } 30 | 31 | inline void setScalar(const RTFLOAT val) { m_data[0] = val; } 32 | inline void setX(const RTFLOAT val) { m_data[1] = val; } 33 | inline void setY(const RTFLOAT val) { m_data[2] = val; } 34 | inline void setZ(const RTFLOAT val) { m_data[3] = val; } 35 | inline void setData(const int i, RTFLOAT val) { m_data[i] = val; } 36 | inline void fromArray(RTFLOAT *val) { memcpy(m_data, val, 4 * sizeof(RTFLOAT)); } 37 | inline void toArray(RTFLOAT *val) const { memcpy(val, m_data, 4 * sizeof(RTFLOAT)); } 38 | 39 | private: 40 | RTFLOAT m_data[4]; 41 | }; 42 | 43 | 44 | #endif -------------------------------------------------------------------------------- /easymqOs_navigation/inc/sensor_msg.h: -------------------------------------------------------------------------------- 1 | #ifndef _SENSOR_MSG_H 2 | #define _SENSOR_MSG_H 3 | 4 | 5 | #include 6 | #include 7 | using namespace std; 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | 13 | typedef struct Quaternion 14 | { 15 | 16 | double x; 17 | double y; 18 | double z; 19 | double w; 20 | }; 21 | typedef struct Vector3 22 | { 23 | 24 | double x; 25 | double y; 26 | double z; 27 | }; 28 | typedef struct sensors_msg_imu 29 | { 30 | /* data */ 31 | 32 | unsigned int seq ; 33 | time_t stamp_ss ; // 时间戳 34 | time_t stamp_ms ; // 时间戳 35 | Quaternion orientation ; // 姿态 36 | double orientation_covariance[9] ;// 姿态协方差 37 | Vector3 angular_velocity ; // 角速度 38 | double angular_velocity_covariance[9]; // 角速度协方差 39 | Vector3 linear_acceleration ; // 线加速度 40 | double linear_acceleration_covariance[9] ; // 线加速度协方差 41 | Vector3 mag ; // 角度 ROS中没有 单独加的 42 | }__attribute__((packed)); 43 | 44 | typedef struct sensors_msg_odom 45 | { 46 | /* data */ 47 | 48 | unsigned int seq ; 49 | time_t stamp_ss ; // 时间戳 50 | time_t stamp_ms ; // 时间戳 51 | Quaternion orientation ; // 姿态 52 | Vector3 angular_velocity ; // 角速度 53 | Vector3 linear_velocity ; // 线速度 54 | Vector3 position ; // 55 | int left_encoders; 56 | int right_encoders; 57 | }__attribute__((packed)); 58 | 59 | 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | #endif -------------------------------------------------------------------------------- /easymqOs_navigation/inc/simple_navigation.h: -------------------------------------------------------------------------------- 1 | #ifndef __EKF_FUSION_H 2 | #define __EKF_FUISION_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include "sensor_msg.h" 9 | #include "rtquaternion.h" 10 | #include 11 | #include 12 | using namespace std; 13 | using namespace cv; 14 | 15 | void imu_callback(sensors_msg_imu msg); 16 | void imu_callback_085(sensors_msg_imu msg); 17 | void encoders_callback( int l_encodes, int r_encodes); 18 | // encoders callback 19 | void odom_callback(sensors_msg_odom msg); 20 | int navigation_task(void(*pfunc)(sensors_msg_odom )); 21 | void *data_CollectTask (void *); 22 | 23 | void public_map_raw_datas(int len, char *buf); 24 | void public_map_traj(vector traj,Point p,int ang); 25 | extern unsigned short lidar_dis[361]; 26 | extern char navigation_run; 27 | extern vector wayPoints; 28 | extern Vector3 _gPosition ; 29 | #endif 30 | -------------------------------------------------------------------------------- /easymqOs_navigation/src/dwa2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_navigation/src/dwa2.jpg -------------------------------------------------------------------------------- /easymqOs_navigation/src/kalman.cpp: -------------------------------------------------------------------------------- 1 | #include "kalman.h" 2 | 3 | Kalman::Kalman(double _q, double _r, double _p, double _initial_value) 4 | { 5 | q = _q; 6 | r = _r; 7 | p = _p; 8 | x = _initial_value; 9 | } 10 | 11 | void Kalman::update(double measurement) 12 | { 13 | //prediction update 14 | //omit x = x 15 | this->p = this->p + this->q; 16 | 17 | //measurement update 18 | this->k = this->p / (this->p + this->r); 19 | this->x = this->x + this->k * (measurement - this->x); 20 | this->p = (1 - this->k) * this->p; 21 | } 22 | void Kalman::update_2(double measurement) 23 | { 24 | //prediction update 25 | this->x = this->x+ measurement; 26 | //omit x = x 27 | this->p = this->p + this->q; 28 | 29 | //measurement update 30 | this->k = this->p / (this->p + this->r); 31 | this->x = this->x + this->k * (measurement - this->x); 32 | this->p = (1 - this->k) * this->p; 33 | } 34 | void Kalman::update(double r_measurement,double measurement) 35 | { 36 | //prediction update 37 | //omit x = x 38 | this->p = this->p + this->q; 39 | 40 | //measurement update 41 | this->k = this->p / (this->p + this->r); 42 | this->x = measurement + this->k * (r_measurement -measurement ); 43 | this->p = (1 - this->k) * this->p; 44 | } 45 | 46 | void Kalman::update_avrage(double r_measurement,double measurement) 47 | { 48 | //prediction update 49 | 50 | this->x = (r_measurement + measurement )/2; 51 | 52 | } 53 | void Kalman::reset(double _q, double _r, double _p, double _initial_value) 54 | { 55 | q = _q; 56 | r = _r; 57 | p = _p; 58 | x = _initial_value; 59 | } 60 | -------------------------------------------------------------------------------- /easymqOs_navigation/word.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_navigation/word.png -------------------------------------------------------------------------------- /easymqOs_odom_imu_fusion/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_odom_imu_fusion/Makefile -------------------------------------------------------------------------------- /easymqOs_odom_imu_fusion/Mqtt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${mosquitto_SOURCE_DIR}/lib 2 | ${STDBOOL_H_PATH} ${STDINT_H_PATH}) 3 | link_directories(${mosquitto_BINARY_DIR}/lib) 4 | 5 | set(shared_src client_shared.c client_shared.h) 6 | 7 | if (${WITH_SRV} STREQUAL ON) 8 | add_definitions("-DWITH_SRV") 9 | endif (${WITH_SRV} STREQUAL ON) 10 | 11 | add_executable(mosquitto_pub pub_client.c ${shared_src}) 12 | add_executable(mosquitto_sub sub_client.c ${shared_src}) 13 | 14 | target_link_libraries(mosquitto_pub libmosquitto) 15 | target_link_libraries(mosquitto_sub libmosquitto) 16 | 17 | install(TARGETS mosquitto_pub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 18 | install(TARGETS mosquitto_sub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 19 | -------------------------------------------------------------------------------- /easymqOs_odom_imu_fusion/Mqtt/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CLIENT_LDFLAGS += -L./Mqtt/lib -lmosquitto -I. 5 | .PHONY: all install uninstall reallyclean clean 6 | 7 | all : mosquitto_pub mosquitto_sub 8 | 9 | mosquitto_pub : pub_client.o client_shared.o 10 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 11 | 12 | mosquitto_sub : sub_client.o client_shared.o 13 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 14 | 15 | pub_client.o : pub_client.c libmosquitto.so 16 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 17 | 18 | sub_client.o : sub_client.c libmosquitto.so 19 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 20 | 21 | client_shared.o : client_shared.c client_shared.h 22 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 23 | 24 | 25 | 26 | install : all 27 | $(INSTALL) -d ${DESTDIR}$(prefix)/bin 28 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_pub ${DESTDIR}${prefix}/bin/mosquitto_pub 29 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_sub ${DESTDIR}${prefix}/bin/mosquitto_sub 30 | 31 | uninstall : 32 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_pub 33 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_sub 34 | 35 | reallyclean : clean 36 | 37 | clean : 38 | -rm -f *.o mosquitto_pub mosquitto_sub 39 | -------------------------------------------------------------------------------- /easymqOs_odom_imu_fusion/Mqtt/client_pub_sub.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIENT_PUB_SUB_H 2 | #define CLIENT_PUB_SUB_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | //extern int mainSub(int argc, char * argv [ ]); 8 | extern int mainSub(struct mosq_config *cfgon , char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 9 | extern int mainPub(struct mosq_config *cfgon, char *devid); 10 | extern int publish_message(unsigned int msglength,char *msg); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /easymqOs_odom_imu_fusion/Mqtt/client_shared.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Roger Light 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License v1.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | http://www.eclipse.org/legal/epl-v10.html 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | Contributors: 14 | Roger Light - initial implementation and documentation. 15 | */ 16 | 17 | #ifndef _CLIENT_CONFIG_H 18 | #define _CLIENT_CONFIG_H 19 | 20 | #include 21 | 22 | /* pub_client.c modes */ 23 | #define MSGMODE_NONE 0 24 | #define MSGMODE_CMD 1 25 | #define MSGMODE_STDIN_LINE 2 26 | #define MSGMODE_STDIN_FILE 3 27 | #define MSGMODE_FILE 4 28 | #define MSGMODE_NULL 5 29 | 30 | #define CLIENT_PUB 1 31 | #define CLIENT_SUB 2 32 | 33 | struct mosq_config { 34 | char *id; 35 | char *id_prefix; 36 | int protocol_version; 37 | int keepalive; 38 | char *host; 39 | int port; 40 | int qos; 41 | bool retain; 42 | int pub_mode; /* pub */ 43 | char *file_input; /* pub */ 44 | char *message; /* pub */ 45 | long msglen; /* pub */ 46 | char *topic; /* pub */ 47 | char *bind_address; 48 | #ifdef WITH_SRV 49 | bool use_srv; 50 | #endif 51 | bool debug; 52 | bool quiet; 53 | unsigned int max_inflight; 54 | char *username; 55 | char *password; 56 | char *will_topic; 57 | char *will_payload; 58 | long will_payloadlen; 59 | int will_qos; 60 | bool will_retain; 61 | #ifdef WITH_TLS 62 | char *cafile; 63 | char *capath; 64 | char *certfile; 65 | char *keyfile; 66 | char *ciphers; 67 | bool insecure; 68 | char *tls_version; 69 | # ifdef WITH_TLS_PSK 70 | char *psk; 71 | char *psk_identity; 72 | # endif 73 | #endif 74 | bool clean_session; /* sub */ 75 | char **topics; /* sub */ 76 | int topic_count; /* sub */ 77 | bool no_retain; /* sub */ 78 | char **filter_outs; /* sub */ 79 | int filter_out_count; /* sub */ 80 | bool verbose; /* sub */ 81 | bool eol; /* sub */ 82 | int msg_count; /* sub */ 83 | #ifdef WITH_SOCKS 84 | char *socks5_host; 85 | int socks5_port; 86 | char *socks5_username; 87 | char *socks5_password; 88 | #endif 89 | }; 90 | 91 | int client_config_load(struct mosq_config *config, int pub_or_sub, int argc, char *argv[]); 92 | void client_config_cleanup(struct mosq_config *cfg); 93 | int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg); 94 | int client_id_generate(struct mosq_config *cfg, const char *id_base); 95 | int client_connect(struct mosquitto *mosq, struct mosq_config *cfg); 96 | //int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, char *argv[]); 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /easymqOs_odom_imu_fusion/Mqtt/lib/libmosquitto.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_odom_imu_fusion/Mqtt/lib/libmosquitto.so -------------------------------------------------------------------------------- /easymqOs_odom_imu_fusion/README.MD: -------------------------------------------------------------------------------- 1 | # odom and imu simple fusion 2 | ### 只要是航向角和里程计的融合 订阅外部传感器关于航向角的融合 3 | ### 读出imu的陀螺仪角度 4 | ### 读出光流传感器的角度 和位移 5 | ### 读出左右轮子的编码计数换算的角度和位移 6 | 等等 7 | -------------------------------------------------------------------------------- /easymqOs_odom_imu_fusion/easy_mqos.h: -------------------------------------------------------------------------------- 1 | #ifndef EASY_MQOS_H 2 | #define EASY_MQOS_H 3 | 4 | #include 5 | #include 6 | #include "Mqtt/client_shared.h" 7 | #include "Mqtt/mosquitto.h" 8 | using namespace std; 9 | class easymqos 10 | { 11 | 12 | public: 13 | easymqos(); 14 | easymqos(int pub_or_sub ); 15 | ~easymqos(); 16 | 17 | //初始化系统 18 | bool Init_Sub(vector _topic); 19 | bool Start_Sub(char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 20 | bool Init_Pub(char* _topic); 21 | bool Set_config_Pub(); 22 | bool Set_broker(char* host); 23 | unsigned int publish_messages(unsigned int len,string message); 24 | 25 | public: 26 | vector _topicStr; 27 | // struct mosq_config *subscribeCfg; 28 | // struct mosq_config *publicCfg; 29 | struct mosq_config *cfg; 30 | int _topicCnt_sub; 31 | 32 | }; 33 | 34 | 35 | 36 | 37 | #endif -------------------------------------------------------------------------------- /easymqOs_odom_imu_fusion/inc/kalman.h: -------------------------------------------------------------------------------- 1 | class Kalman 2 | { 3 | private: 4 | double q; //process noise covariance 5 | double r; //measurement noise covariance 6 | double x; //value 7 | double p; //estimation error covariance 8 | double k; //kalman gain 9 | 10 | public: 11 | Kalman(double _q, double _r, double _p, double _initial_value); 12 | void update(double measurement); 13 | void update_2(double measurement); 14 | void update(double r_measurement,double measurement); 15 | void update_avrage(double r_measurement,double measurement); 16 | 17 | double GetValue() {return x;} 18 | void reset(double _q, double _r, double _p, double _initial_value); 19 | }; 20 | -------------------------------------------------------------------------------- /easymqOs_odom_imu_fusion/inc/rtquaternion.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _RTQUATERNION_H_ 3 | #define _RTQUATERNION_H_ 4 | #include "sensor_msg.h" 5 | #include 6 | typedef float RTFLOAT; 7 | class RTQuaternion 8 | { 9 | public: 10 | RTQuaternion(); 11 | RTQuaternion(RTFLOAT scalar, RTFLOAT x, RTFLOAT y, RTFLOAT z); 12 | 13 | 14 | 15 | void normalize(); 16 | void toEuler(Vector3 *vec); 17 | void fromEuler(Vector3 vec); 18 | RTQuaternion conjugate() const; 19 | void toAngleVector(RTFLOAT& angle, Vector3 vec); 20 | void fromAngleVector(const RTFLOAT& angle, const Vector3 vec); 21 | 22 | void zero(); 23 | const char *display(); 24 | 25 | inline RTFLOAT scalar() const { return m_data[0]; } 26 | inline RTFLOAT x() const { return m_data[1]; } 27 | inline RTFLOAT y() const { return m_data[2]; } 28 | inline RTFLOAT z() const { return m_data[3]; } 29 | inline RTFLOAT data(const int i) const { return m_data[i]; } 30 | 31 | inline void setScalar(const RTFLOAT val) { m_data[0] = val; } 32 | inline void setX(const RTFLOAT val) { m_data[1] = val; } 33 | inline void setY(const RTFLOAT val) { m_data[2] = val; } 34 | inline void setZ(const RTFLOAT val) { m_data[3] = val; } 35 | inline void setData(const int i, RTFLOAT val) { m_data[i] = val; } 36 | inline void fromArray(RTFLOAT *val) { memcpy(m_data, val, 4 * sizeof(RTFLOAT)); } 37 | inline void toArray(RTFLOAT *val) const { memcpy(val, m_data, 4 * sizeof(RTFLOAT)); } 38 | 39 | private: 40 | RTFLOAT m_data[4]; 41 | }; 42 | 43 | 44 | #endif -------------------------------------------------------------------------------- /easymqOs_odom_imu_fusion/inc/sensor_msg.h: -------------------------------------------------------------------------------- 1 | #ifndef _SENSOR_MSG_H 2 | #define _SENSOR_MSG_H 3 | 4 | 5 | #include 6 | #include 7 | using namespace std; 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | 13 | typedef struct Quaternion 14 | { 15 | 16 | double x; 17 | double y; 18 | double z; 19 | double w; 20 | }; 21 | typedef struct Vector3 22 | { 23 | 24 | double x; 25 | double y; 26 | double z; 27 | }; 28 | typedef struct sensors_msg_imu 29 | { 30 | /* data */ 31 | 32 | unsigned int seq ; 33 | time_t stamp_ss ; // 时间戳 34 | time_t stamp_ms ; // 时间戳 35 | Quaternion orientation ; // 姿态 36 | double orientation_covariance[9] ;// 姿态协方差 37 | Vector3 angular_velocity ; // 角速度 38 | double angular_velocity_covariance[9]; // 角速度协方差 39 | Vector3 linear_acceleration ; // 线加速度 40 | double linear_acceleration_covariance[9] ; // 线加速度协方差 41 | Vector3 mag ; // 角度 ROS中没有 单独加的 42 | }__attribute__((packed)); 43 | 44 | typedef struct sensors_msg_odom 45 | { 46 | /* data */ 47 | 48 | unsigned int seq ; 49 | time_t stamp_ss ; // 时间戳 50 | time_t stamp_ms ; // 时间戳 51 | Quaternion orientation ; // 姿态 52 | Vector3 angular_velocity ; // 角速度 53 | Vector3 linear_velocity ; // 线速度 54 | Vector3 position ; // 55 | int left_encoders; 56 | int right_encoders; 57 | }__attribute__((packed)); 58 | 59 | 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | #endif -------------------------------------------------------------------------------- /easymqOs_odom_imu_fusion/inc/simple_fusion.h: -------------------------------------------------------------------------------- 1 | #ifndef __EKF_FUSION_H 2 | #define __EKF_FUISION_H 3 | 4 | #include 5 | 6 | #include 7 | #include "sensor_msg.h" 8 | #include "rtquaternion.h" 9 | 10 | 11 | void imu_callback(sensors_msg_imu msg); 12 | void encoders_callback( int l_encodes, int r_encodes); 13 | // encoders callback 14 | void odom_callback(sensors_msg_odom msg); 15 | int fusion_task(void(*pfunc)(sensors_msg_odom )); 16 | #endif 17 | -------------------------------------------------------------------------------- /easymqOs_odom_imu_fusion/src/kalman.cpp: -------------------------------------------------------------------------------- 1 | #include "kalman.h" 2 | 3 | Kalman::Kalman(double _q, double _r, double _p, double _initial_value) 4 | { 5 | q = _q; 6 | r = _r; 7 | p = _p; 8 | x = _initial_value; 9 | } 10 | 11 | void Kalman::update(double measurement) 12 | { 13 | //prediction update 14 | //omit x = x 15 | this->p = this->p + this->q; 16 | 17 | //measurement update 18 | this->k = this->p / (this->p + this->r); 19 | this->x = this->x + this->k * (measurement - this->x); 20 | this->p = (1 - this->k) * this->p; 21 | } 22 | void Kalman::update_2(double measurement) 23 | { 24 | //prediction update 25 | this->x = this->x+ measurement; 26 | //omit x = x 27 | this->p = this->p + this->q; 28 | 29 | //measurement update 30 | this->k = this->p / (this->p + this->r); 31 | this->x = this->x + this->k * (measurement - this->x); 32 | this->p = (1 - this->k) * this->p; 33 | } 34 | void Kalman::update(double r_measurement,double measurement) 35 | { 36 | //prediction update 37 | //omit x = x 38 | this->p = this->p + this->q; 39 | 40 | //measurement update 41 | this->k = this->p / (this->p + this->r); 42 | this->x = measurement + this->k * (r_measurement -measurement ); 43 | this->p = (1 - this->k) * this->p; 44 | } 45 | 46 | void Kalman::update_avrage(double r_measurement,double measurement) 47 | { 48 | //prediction update 49 | 50 | this->x = (r_measurement + measurement )/2; 51 | 52 | } 53 | void Kalman::reset(double _q, double _r, double _p, double _initial_value) 54 | { 55 | q = _q; 56 | r = _r; 57 | p = _p; 58 | x = _initial_value; 59 | } 60 | -------------------------------------------------------------------------------- /easymqOs_opticalFlow_gl9306/Mqtt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${mosquitto_SOURCE_DIR}/lib 2 | ${STDBOOL_H_PATH} ${STDINT_H_PATH}) 3 | link_directories(${mosquitto_BINARY_DIR}/lib) 4 | 5 | set(shared_src client_shared.c client_shared.h) 6 | 7 | if (${WITH_SRV} STREQUAL ON) 8 | add_definitions("-DWITH_SRV") 9 | endif (${WITH_SRV} STREQUAL ON) 10 | 11 | add_executable(mosquitto_pub pub_client.c ${shared_src}) 12 | add_executable(mosquitto_sub sub_client.c ${shared_src}) 13 | 14 | target_link_libraries(mosquitto_pub libmosquitto) 15 | target_link_libraries(mosquitto_sub libmosquitto) 16 | 17 | install(TARGETS mosquitto_pub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 18 | install(TARGETS mosquitto_sub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 19 | -------------------------------------------------------------------------------- /easymqOs_opticalFlow_gl9306/Mqtt/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CLIENT_LDFLAGS += -L./Mqtt/lib -lmosquitto -I. 5 | .PHONY: all install uninstall reallyclean clean 6 | 7 | all : mosquitto_pub mosquitto_sub 8 | 9 | mosquitto_pub : pub_client.o client_shared.o 10 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 11 | 12 | mosquitto_sub : sub_client.o client_shared.o 13 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 14 | 15 | pub_client.o : pub_client.c libmosquitto.so 16 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 17 | 18 | sub_client.o : sub_client.c libmosquitto.so 19 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 20 | 21 | client_shared.o : client_shared.c client_shared.h 22 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 23 | 24 | 25 | 26 | install : all 27 | $(INSTALL) -d ${DESTDIR}$(prefix)/bin 28 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_pub ${DESTDIR}${prefix}/bin/mosquitto_pub 29 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_sub ${DESTDIR}${prefix}/bin/mosquitto_sub 30 | 31 | uninstall : 32 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_pub 33 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_sub 34 | 35 | reallyclean : clean 36 | 37 | clean : 38 | -rm -f *.o mosquitto_pub mosquitto_sub 39 | -------------------------------------------------------------------------------- /easymqOs_opticalFlow_gl9306/Mqtt/client_pub_sub.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIENT_PUB_SUB_H 2 | #define CLIENT_PUB_SUB_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | //extern int mainSub(int argc, char * argv [ ]); 8 | extern int mainSub(struct mosq_config *cfgon , char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 9 | extern int mainPub(struct mosq_config *cfgon, char *devid); 10 | extern int publish_message(unsigned int msglength,char *msg); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /easymqOs_opticalFlow_gl9306/Mqtt/client_shared.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Roger Light 3 | 4 | All rights reserved. This program and the accompanying materials 5 | are made available under the terms of the Eclipse Public License v1.0 6 | and Eclipse Distribution License v1.0 which accompany this distribution. 7 | 8 | The Eclipse Public License is available at 9 | http://www.eclipse.org/legal/epl-v10.html 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | Contributors: 14 | Roger Light - initial implementation and documentation. 15 | */ 16 | 17 | #ifndef _CLIENT_CONFIG_H 18 | #define _CLIENT_CONFIG_H 19 | 20 | #include 21 | 22 | /* pub_client.c modes */ 23 | #define MSGMODE_NONE 0 24 | #define MSGMODE_CMD 1 25 | #define MSGMODE_STDIN_LINE 2 26 | #define MSGMODE_STDIN_FILE 3 27 | #define MSGMODE_FILE 4 28 | #define MSGMODE_NULL 5 29 | 30 | #define CLIENT_PUB 1 31 | #define CLIENT_SUB 2 32 | 33 | struct mosq_config { 34 | char *id; 35 | char *id_prefix; 36 | int protocol_version; 37 | int keepalive; 38 | char *host; 39 | int port; 40 | int qos; 41 | bool retain; 42 | int pub_mode; /* pub */ 43 | char *file_input; /* pub */ 44 | char *message; /* pub */ 45 | long msglen; /* pub */ 46 | char *topic; /* pub */ 47 | char *bind_address; 48 | #ifdef WITH_SRV 49 | bool use_srv; 50 | #endif 51 | bool debug; 52 | bool quiet; 53 | unsigned int max_inflight; 54 | char *username; 55 | char *password; 56 | char *will_topic; 57 | char *will_payload; 58 | long will_payloadlen; 59 | int will_qos; 60 | bool will_retain; 61 | #ifdef WITH_TLS 62 | char *cafile; 63 | char *capath; 64 | char *certfile; 65 | char *keyfile; 66 | char *ciphers; 67 | bool insecure; 68 | char *tls_version; 69 | # ifdef WITH_TLS_PSK 70 | char *psk; 71 | char *psk_identity; 72 | # endif 73 | #endif 74 | bool clean_session; /* sub */ 75 | char **topics; /* sub */ 76 | int topic_count; /* sub */ 77 | bool no_retain; /* sub */ 78 | char **filter_outs; /* sub */ 79 | int filter_out_count; /* sub */ 80 | bool verbose; /* sub */ 81 | bool eol; /* sub */ 82 | int msg_count; /* sub */ 83 | #ifdef WITH_SOCKS 84 | char *socks5_host; 85 | int socks5_port; 86 | char *socks5_username; 87 | char *socks5_password; 88 | #endif 89 | }; 90 | 91 | int client_config_load(struct mosq_config *config, int pub_or_sub, int argc, char *argv[]); 92 | void client_config_cleanup(struct mosq_config *cfg); 93 | int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg); 94 | int client_id_generate(struct mosq_config *cfg, const char *id_base); 95 | int client_connect(struct mosquitto *mosq, struct mosq_config *cfg); 96 | //int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, char *argv[]); 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /easymqOs_opticalFlow_gl9306/Mqtt/lib/libmosquitto.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_opticalFlow_gl9306/Mqtt/lib/libmosquitto.so -------------------------------------------------------------------------------- /easymqOs_opticalFlow_gl9306/README.MD: -------------------------------------------------------------------------------- 1 | # easymqOs_opticalFlow_gl9306 2 | 光流模块通过串口读取无名创新公司的gl9306传感器的数据,其协议格式位: 3 | 0xfe 0x04 d0 d1 d2 d3 sum qual 0xaa 4 | flowx = d0+d1*256; 5 | flowy = d2+d3*256; 6 | flowx,flowy数据为上一帧0时的相对值 7 | 8 | 9 | 修改Makefile 中的 /dev/ttyS3 指定串口。 10 | 11 | 12 | -------------------------------------------------------------------------------- /easymqOs_opticalFlow_gl9306/easy_mqos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_opticalFlow_gl9306/easy_mqos -------------------------------------------------------------------------------- /easymqOs_opticalFlow_gl9306/easy_mqos.h: -------------------------------------------------------------------------------- 1 | #ifndef EASY_MQOS_H 2 | #define EASY_MQOS_H 3 | 4 | #include 5 | #include 6 | #include "Mqtt/client_shared.h" 7 | #include "Mqtt/mosquitto.h" 8 | using namespace std; 9 | class easymqos 10 | { 11 | 12 | public: 13 | easymqos(); 14 | easymqos(int pub_or_sub ); 15 | ~easymqos(); 16 | 17 | //初始化系统 18 | bool Init_Sub(vector _topic); 19 | bool Start_Sub(char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 20 | bool Init_Pub(char* _topic); 21 | bool Set_config_Pub(); 22 | bool Set_broker(char* host); 23 | unsigned int publish_messages(unsigned int len,string message); 24 | 25 | public: 26 | vector _topicStr; 27 | // struct mosq_config *subscribeCfg; 28 | // struct mosq_config *publicCfg; 29 | struct mosq_config *cfg; 30 | int _topicCnt_sub; 31 | 32 | }; 33 | 34 | 35 | 36 | 37 | #endif -------------------------------------------------------------------------------- /easymqOs_opticalFlow_gl9306/inc/Uart_comm.h: -------------------------------------------------------------------------------- 1 | #ifndef UART_COMM_H 2 | #define UART_COMM_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | #include "sys/socket.h" 7 | #include "netinet/in.h" 8 | 9 | #include "string.h" 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | 25 | 26 | extern speed_t getBaudrate(int baudrate); 27 | extern int OpenDev(char *Dev,int baudrate); 28 | extern int OpenDev_insulation(char *Dev,int baudrate); 29 | extern void GetCrC(unsigned char *CmmBuf, unsigned char Len); 30 | 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /easymqOs_opticalFlow_gl9306/inc/odometry.h: -------------------------------------------------------------------------------- 1 | #ifndef ODOMETRY_H 2 | #define ODOMETRY_H 3 | 4 | 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #include 11 | typedef struct Quaternion 12 | { 13 | 14 | double x; 15 | double y; 16 | double z; 17 | double w; 18 | }; 19 | typedef struct Vector3 20 | { 21 | 22 | double x; 23 | double y; 24 | double z; 25 | }; 26 | typedef struct sensors_msg_odom 27 | { 28 | /* data */ 29 | 30 | unsigned int seq ; 31 | time_t stamp_ss ; // 时间戳 32 | time_t stamp_ms ; // 时间戳 33 | Quaternion orientation ; // 姿态 34 | Vector3 angular_velocity ; // 角速度 35 | Vector3 linear_velocity ; // 线速度 36 | Vector3 position ; // 37 | int left_encoders; 38 | int right_encoders; 39 | 40 | }__attribute__((packed)); 41 | 42 | typedef struct 43 | { 44 | float LeftSpeed; 45 | float RightSpeed; 46 | unsigned int LeftPusle; 47 | unsigned int RightPusle; 48 | float leftdistance;//��ʻ�ľ��� ��λm 49 | float Rightdistance; 50 | }wheelInf; 51 | extern wheelInf wheelParam; 52 | extern float wheel_interval ;// 53 | extern float position_x; 54 | extern float position_y; 55 | extern float oriention; 56 | extern float velocity_linear; 57 | extern float velocity_angular; 58 | extern float velocity_linear_x; 59 | extern float velocity_linear_y; 60 | extern float velocity_linear_l; 61 | extern float velocity_linear_r; 62 | extern void odometry(float right,float left); 63 | extern void odometry_simple(float right,float left); 64 | extern long long getsecond(); 65 | extern long long getmiilsecond(); 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | #endif -------------------------------------------------------------------------------- /easymqOs_opticalFlow_gl9306/inc/opticalflow_control.h: -------------------------------------------------------------------------------- 1 | #ifndef OPTICALFLOW_CONTROL_H 2 | #define OPTICALFLOW_CONTROL_H 3 | 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #include "odometry.h" 10 | 11 | typedef struct { 12 | char valid; 13 | char X_V; 14 | char Y_V; 15 | 16 | }CVFEED; 17 | extern float velspeed ; 18 | extern float angspeed ; 19 | extern CVFEED cv_res; 20 | extern unsigned int positionx; 21 | extern int odom_task(void(*pfunc)(sensors_msg_odom )); 22 | extern void cmd_vel_callback(const char * cmd_vel); 23 | extern void cmd_send(const char cmd_v,int speed); 24 | extern void cmd_send2(float vspeed,float aspeed); 25 | 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /easymqOs_opticalFlow_gl9306/inc/rtquaternion.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _RTQUATERNION_H_ 3 | #define _RTQUATERNION_H_ 4 | #include "odometry.h" 5 | #include 6 | typedef float RTFLOAT; 7 | class RTQuaternion 8 | { 9 | public: 10 | RTQuaternion(); 11 | RTQuaternion(RTFLOAT scalar, RTFLOAT x, RTFLOAT y, RTFLOAT z); 12 | 13 | 14 | 15 | void normalize(); 16 | void toEuler(Vector3 vec); 17 | void fromEuler(Vector3 vec); 18 | RTQuaternion conjugate() const; 19 | void toAngleVector(RTFLOAT& angle, Vector3 vec); 20 | void fromAngleVector(const RTFLOAT& angle, const Vector3 vec); 21 | 22 | void zero(); 23 | const char *display(); 24 | 25 | inline RTFLOAT scalar() const { return m_data[0]; } 26 | inline RTFLOAT x() const { return m_data[1]; } 27 | inline RTFLOAT y() const { return m_data[2]; } 28 | inline RTFLOAT z() const { return m_data[3]; } 29 | inline RTFLOAT data(const int i) const { return m_data[i]; } 30 | 31 | inline void setScalar(const RTFLOAT val) { m_data[0] = val; } 32 | inline void setX(const RTFLOAT val) { m_data[1] = val; } 33 | inline void setY(const RTFLOAT val) { m_data[2] = val; } 34 | inline void setZ(const RTFLOAT val) { m_data[3] = val; } 35 | inline void setData(const int i, RTFLOAT val) { m_data[i] = val; } 36 | inline void fromArray(RTFLOAT *val) { memcpy(m_data, val, 4 * sizeof(RTFLOAT)); } 37 | inline void toArray(RTFLOAT *val) const { memcpy(val, m_data, 4 * sizeof(RTFLOAT)); } 38 | 39 | private: 40 | RTFLOAT m_data[4]; 41 | }; 42 | 43 | 44 | #endif -------------------------------------------------------------------------------- /easymqOs_opticalFlow_gl9306/inc/serial.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/easymqOs_opticalFlow_gl9306/inc/serial.h -------------------------------------------------------------------------------- /easymqos_waypoint_save/README.MD: -------------------------------------------------------------------------------- 1 | https://github.com/horo2016/openCRobotics/tree/master/mqtt_waypointsave 2 | -------------------------------------------------------------------------------- /img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/img/1.png -------------------------------------------------------------------------------- /img/640.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/img/640.png -------------------------------------------------------------------------------- /img/640img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/img/640img.png -------------------------------------------------------------------------------- /img/640windows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/img/640windows.png -------------------------------------------------------------------------------- /img/712my1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/img/712my1.png -------------------------------------------------------------------------------- /img/712my2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/img/712my2.png -------------------------------------------------------------------------------- /img/dianjiqudognmban.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/img/dianjiqudognmban.png -------------------------------------------------------------------------------- /img/opirobot_kt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/img/opirobot_kt.png -------------------------------------------------------------------------------- /img/readme.md: -------------------------------------------------------------------------------- 1 | img performance 2 | -------------------------------------------------------------------------------- /img/robot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/img/robot.png -------------------------------------------------------------------------------- /img/中值滤波.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/img/中值滤波.png -------------------------------------------------------------------------------- /img/微信截图_20230712173505.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/img/微信截图_20230712173505.png -------------------------------------------------------------------------------- /orangepizero2/easymqOs_oledssd1306/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Haidar Jamal 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /orangepizero2/easymqOs_oledssd1306/Mqtt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${mosquitto_SOURCE_DIR}/lib 2 | ${STDBOOL_H_PATH} ${STDINT_H_PATH}) 3 | link_directories(${mosquitto_BINARY_DIR}/lib) 4 | 5 | set(shared_src client_shared.c client_shared.h) 6 | 7 | if (${WITH_SRV} STREQUAL ON) 8 | add_definitions("-DWITH_SRV") 9 | endif (${WITH_SRV} STREQUAL ON) 10 | 11 | add_executable(mosquitto_pub pub_client.c ${shared_src}) 12 | add_executable(mosquitto_sub sub_client.c ${shared_src}) 13 | 14 | target_link_libraries(mosquitto_pub libmosquitto) 15 | target_link_libraries(mosquitto_sub libmosquitto) 16 | 17 | install(TARGETS mosquitto_pub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 18 | install(TARGETS mosquitto_sub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") 19 | -------------------------------------------------------------------------------- /orangepizero2/easymqOs_oledssd1306/Mqtt/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CLIENT_LDFLAGS += -L./Mqtt/lib -lmosquitto -I. 5 | .PHONY: all install uninstall reallyclean clean 6 | 7 | all : mosquitto_pub mosquitto_sub 8 | 9 | mosquitto_pub : pub_client.o client_shared.o 10 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 11 | 12 | mosquitto_sub : sub_client.o client_shared.o 13 | ${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS} 14 | 15 | pub_client.o : pub_client.c libmosquitto.so 16 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 17 | 18 | sub_client.o : sub_client.c libmosquitto.so 19 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 20 | 21 | client_shared.o : client_shared.c client_shared.h 22 | ${CROSS_COMPILE}${CC} -c $< -o $@ ${CLIENT_CFLAGS} 23 | 24 | 25 | 26 | install : all 27 | $(INSTALL) -d ${DESTDIR}$(prefix)/bin 28 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_pub ${DESTDIR}${prefix}/bin/mosquitto_pub 29 | $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_sub ${DESTDIR}${prefix}/bin/mosquitto_sub 30 | 31 | uninstall : 32 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_pub 33 | -rm -f ${DESTDIR}${prefix}/bin/mosquitto_sub 34 | 35 | reallyclean : clean 36 | 37 | clean : 38 | -rm -f *.o mosquitto_pub mosquitto_sub 39 | -------------------------------------------------------------------------------- /orangepizero2/easymqOs_oledssd1306/Mqtt/client_pub_sub.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIENT_PUB_SUB_H 2 | #define CLIENT_PUB_SUB_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | //extern int mainSub(int argc, char * argv [ ]); 8 | extern int mainSub(struct mosq_config *cfgon , char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 9 | extern int mainPub(struct mosq_config *cfgon, char *devid); 10 | extern int publish_message(unsigned int msglength,char *msg); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /orangepizero2/easymqOs_oledssd1306/Mqtt/client_shared.d: -------------------------------------------------------------------------------- 1 | Mqtt/client_shared.o: Mqtt/client_shared.c Mqtt/mosquitto.h \ 2 | Mqtt/client_shared.h 3 | -------------------------------------------------------------------------------- /orangepizero2/easymqOs_oledssd1306/Mqtt/client_shared.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/orangepizero2/easymqOs_oledssd1306/Mqtt/client_shared.o -------------------------------------------------------------------------------- /orangepizero2/easymqOs_oledssd1306/Mqtt/pub_client.d: -------------------------------------------------------------------------------- 1 | Mqtt/pub_client.o: Mqtt/pub_client.c Mqtt/mosquitto.h \ 2 | Mqtt/client_shared.h Mqtt/client_pub_sub.h 3 | -------------------------------------------------------------------------------- /orangepizero2/easymqOs_oledssd1306/Mqtt/pub_client.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/orangepizero2/easymqOs_oledssd1306/Mqtt/pub_client.o -------------------------------------------------------------------------------- /orangepizero2/easymqOs_oledssd1306/Mqtt/sub_client.d: -------------------------------------------------------------------------------- 1 | Mqtt/sub_client.o: Mqtt/sub_client.c Mqtt/mosquitto.h \ 2 | Mqtt/client_shared.h Mqtt/client_pub_sub.h 3 | -------------------------------------------------------------------------------- /orangepizero2/easymqOs_oledssd1306/Mqtt/sub_client.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/orangepizero2/easymqOs_oledssd1306/Mqtt/sub_client.o -------------------------------------------------------------------------------- /orangepizero2/easymqOs_oledssd1306/easy_mqos.h: -------------------------------------------------------------------------------- 1 | #ifndef EASY_MQOS_H 2 | #define EASY_MQOS_H 3 | 4 | #include 5 | #include 6 | #include "Mqtt/client_shared.h" 7 | #include "Mqtt/mosquitto.h" 8 | using namespace std; 9 | class easymqos 10 | { 11 | 12 | public: 13 | easymqos(); 14 | easymqos(int pub_or_sub ); 15 | ~easymqos(); 16 | 17 | //初始化系统 18 | bool Init_Sub(vector _topic); 19 | bool Start_Sub(char *devid,void(*pfunc)(struct mosquitto *, void *, const struct mosquitto_message *)); 20 | bool Init_Pub(char* _topic); 21 | bool Set_config_Pub(); 22 | bool Set_broker(char* host); 23 | unsigned int publish_messages(unsigned int len,string message); 24 | 25 | public: 26 | vector _topicStr; 27 | // struct mosq_config *subscribeCfg; 28 | // struct mosq_config *publicCfg; 29 | struct mosq_config *cfg; 30 | int _topicCnt_sub; 31 | 32 | }; 33 | 34 | 35 | 36 | 37 | #endif -------------------------------------------------------------------------------- /orangepizero2/easymqOs_oledssd1306/inc/oled_common.h: -------------------------------------------------------------------------------- 1 | #ifndef VL53_COMMON_H 2 | #define VL53_COMMON_H 3 | /* 4 | orangepi@orangepizero2:~/wiringOP-master$ gpio readall 5 | +------+-----+----------+------+---+ H616 +---+------+----------+-----+------+ 6 | | GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO | 7 | +------+-----+----------+------+---+----++----+---+------+----------+-----+------+ 8 | | | | 3.3V | | | 1 || 2 | | | 5V | | | 9 | | 229 | 0 | SDA.3 | OFF | 0 | 3 || 4 | | | 5V | | | 10 | | 228 | 1 | SCL.3 | OFF | 0 | 5 || 6 | | | GND | | | 11 | | 73 | 2 | PC9 | OFF | 0 | 7 || 8 | 0 | ALT2 | TXD.5 | 3 | 226 | 12 | | | | GND | | | 9 || 10 | 0 | ALT2 | RXD.5 | 4 | 227 | 13 | | 70 | 5 | PC6 | ALT5 | 0 | 11 || 12 | 0 | OFF | PC11 | 6 | 75 | 14 | | 69 | 7 | PC5 | ALT5 | 0 | 13 || 14 | | | GND | | | 15 | | 72 | 8 | PC8 | OFF | 0 | 15 || 16 | 0 | OFF | PC15 | 9 | 79 | 16 | | | | 3.3V | | | 17 || 18 | 0 | OFF | PC14 | 10 | 78 | 17 | | 231 | 11 | MOSI.1 | ALT4 | 0 | 19 || 20 | | | GND | | | 18 | | 232 | 12 | MISO.1 | ALT4 | 0 | 21 || 22 | 0 | OFF | PC7 | 13 | 71 | 19 | | 230 | 14 | SCLK.1 | ALT4 | 0 | 23 || 24 | 0 | ALT4 | CE.1 | 15 | 233 | 20 | | | | GND | | | 25 || 26 | 0 | OFF | PC10 | 16 | 74 | 21 | | 65 | 17 | PC1 | OFF | 0 | 27 || 28 | | | | | | 22 | | 272 | 18 | PI16 | OFF | 0 | 29 || 30 | | | | | | 23 | | 262 | 19 | PI6 | OFF | 0 | 31 || 32 | | | | | | 24 | | 234 | 20 | PH10 | ALT3 | 0 | 33 || 34 | | | | | | 25 | +------+-----+----------+------+---+----++----+---+------+----------+-----+------+ 26 | | GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO | 27 | +------+-----+----------+------+---+ H616 +---+------+----------+-----+------+ 28 | orangepi@orangepizero2:~/wiringOP-master$ ls 29 | 30 | -lwiringPi -lpthread 31 | 32 | */ 33 | typedef unsigned char u8; 34 | typedef unsigned short u16; 35 | #define u32 unsigned int 36 | 37 | 38 | #define PIN_SDA 18 //PI16 39 | #define PIN_SCL 19 //PI6 40 | 41 | #define OLED_CMD 0 //写命令 42 | #define OLED_DATA 1 //写数据 43 | 44 | 45 | #endif -------------------------------------------------------------------------------- /orangepizero2/easymqOs_oledssd1306/inc/oled_interface.h: -------------------------------------------------------------------------------- 1 | #ifndef _OLED_INTERFACE_h 2 | #define _OLED_INTERFACE_h 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include "oled_common.h" 9 | extern void oled_task(void (*func)(char*)); 10 | extern void OLED_ColorTurn(u8 i); 11 | extern void OLED_DisplayTurn(u8 i); 12 | extern void OLED_WR_Byte(u8 dat,u8 cmd); 13 | extern void OLED_Set_Pos(u8 x, u8 y); 14 | extern void OLED_Display_On(void); 15 | extern void OLED_Display_Off(void); 16 | extern void OLED_Clear(void); 17 | extern void OLED_ShowChar(u8 x,u8 y,u8 chr,u8 sizey); 18 | extern u32 oled_pow(u8 m,u8 n); 19 | extern void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 sizey); 20 | extern void OLED_ShowString(u8 x,u8 y,u8 *chr,u8 sizey); 21 | extern void OLED_ShowChinese(u8 x,u8 y,u8 no,u8 sizey); 22 | extern void OLED_DrawBMP(u8 x,u8 y,u8 sizex, u8 sizey,u8 BMP[]); 23 | extern void OLED_Init(void); 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif -------------------------------------------------------------------------------- /orangepizero2/easymqOs_oledssd1306/inc/oledfont.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/orangepizero2/easymqOs_oledssd1306/inc/oledfont.h -------------------------------------------------------------------------------- /orangepizero2/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /python/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/python/1.png -------------------------------------------------------------------------------- /python/FastestDet.onnx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/python/FastestDet.onnx -------------------------------------------------------------------------------- /python/README.MD: -------------------------------------------------------------------------------- 1 | 新增 python的mqtt支持 2 | apt-get install paho-mqtt 3 | 4 | 5 | from paho.mqtt import client as mqtt_client 6 | 7 | 8 | # video_detect.py 9 | ![目标检测](https://github.com/horo2016/easyMQOS/blob/main/python/1.png) 10 | 11 | -------------------------------------------------------------------------------- /python/coco.names: -------------------------------------------------------------------------------- 1 | person 2 | bicycle 3 | car 4 | motorbike 5 | aeroplane 6 | bus 7 | train 8 | truck 9 | boat 10 | traffic light 11 | fire hydrant 12 | stop sign 13 | parking meter 14 | bench 15 | bird 16 | cat 17 | dog 18 | horse 19 | sheep 20 | cow 21 | elephant 22 | bear 23 | zebra 24 | giraffe 25 | backpack 26 | umbrella 27 | handbag 28 | tie 29 | suitcase 30 | frisbee 31 | skis 32 | snowboard 33 | sports ball 34 | kite 35 | baseball bat 36 | baseball glove 37 | skateboard 38 | surfboard 39 | tennis racket 40 | bottle 41 | wine glass 42 | cup 43 | fork 44 | knife 45 | spoon 46 | bowl 47 | banana 48 | apple 49 | sandwich 50 | orange 51 | broccoli 52 | carrot 53 | hot dog 54 | pizza 55 | donut 56 | cake 57 | chair 58 | sofa 59 | pottedplant 60 | bed 61 | diningtable 62 | toilet 63 | tvmonitor 64 | laptop 65 | mouse 66 | remote 67 | keyboard 68 | cell phone 69 | microwave 70 | oven 71 | toaster 72 | sink 73 | refrigerator 74 | book 75 | clock 76 | vase 77 | scissors 78 | teddy bear 79 | hair drier 80 | toothbrush 81 | -------------------------------------------------------------------------------- /python/receive_mqtt.py: -------------------------------------------------------------------------------- 1 | import time 2 | import paho.mqtt.client as paho 3 | broker="192.168.3.8" 4 | pic_topic="myhome/dafang/motion/snapshot/image" 5 | pic_filename="D:/Dump/motion-snap.jpg" 6 | vid_topic="/camera/collect" 7 | vid_filename="motion-vid.mp4" 8 | port = 1883 9 | cnt =0 10 | def on_message(client, userdata, message): 11 | #print("Receiving message") 12 | print(message.topic) 13 | if (message.topic == pic_topic): 14 | save_payload(message.payload, pic_filename) 15 | if (message.topic == vid_topic): 16 | save_payload(message.payload, vid_filename) 17 | def save_payload(payload, filename): 18 | global cnt 19 | cnt =cnt+1 20 | print("img%d\n"%cnt) 21 | #print("Saving file: "+filename) 22 | f=open(filename, "ab") # 'w' for 'write', 'b' for 'write as binary, not text' 23 | f.write(payload) 24 | f.close() 25 | print("Starting") 26 | c=paho.Client("clientddafddfsd188") 27 | c.connect(broker, port, 60) 28 | c.subscribe(pic_topic) 29 | c.subscribe(vid_topic) 30 | c.on_message = on_message 31 | c.loop_forever() -------------------------------------------------------------------------------- /pytorch/neural_network_avoidance/README.MD: -------------------------------------------------------------------------------- 1 | 采集激光雷达的5个角度信息 输入神经网络 ,使用预训练模型,实现避障功能 2 | -------------------------------------------------------------------------------- /web/README.MD: -------------------------------------------------------------------------------- 1 | # 说明 2 | 该程序配合js版本的mqtt使用 ; 3 | 即需要结合本包中的js文件夹中的paho-mqtt 一起使用。 4 | 在树莓派或者其他派终端web可以使用boa 容器。 5 | web 的mqtt使用websockets 协议,8083端口。 6 | 在/etc/mosquitto.conf 添加: 7 | 8 | port 1883 9 | listener 8083 10 | protocol websockets 11 | 12 | # 安装说明 13 | 14 | 请在浏览器打开每个功能模块下的 xx.html 正常使用。 15 | 使用前使用notepad++ 编辑xx.html中的hostip 地址改成你的树莓派 或者 orangepi nanopi的IP地址。 16 | 保存后使用浏览器打开后才能正常连接。 17 | 18 | 例如,找到 trajectmap 文件夹,使用文本编辑器打开 index_indoor.html 19 | 找到 MQTTconnect() 函数,将serverip 参数改成mqtt 的serverIp地址。 20 | 然后双击使用网页打开,查看是否正常连接(出现绿色背景) 21 | 22 | 23 | 24 | 25 | 目前能用的功能有 26 | # 指南针功能 27 | ![compass](https://pic2.zhimg.com/v2-b5a9d596113bdbfc3550533f12df0295_r.jpg) 28 | # 路径和航向显示 trajectorymap 29 | ![trajectorymap](https://pic3.zhimg.com/v2-84c0dfa714909f703525771918b2e64e_r.jpg) 30 | # 户外建图道路网络 31 | ![compass](https://github.com/horo2016/easyMQOS/blob/main/web/%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20230608102444.png) 32 | 33 | 34 | -------------------------------------------------------------------------------- /web/baidumap/README.MD: -------------------------------------------------------------------------------- 1 | # baidumap 2 | 百度地图 可以定位 并规划航点下发给 waypoint save 保存 ; 3 | 支持无数个航点下发; 4 | 支持实时下发; 5 | 支持清除; 6 | 支持保存文本; 7 | 8 | 9 | 修改hostip 为mqtt server 的IP地址,即可以订阅topic 和发布Topic, 10 | 在浏览器打开 map_car_new.html 即可订阅mqtt 并运行。 11 | -------------------------------------------------------------------------------- /web/baidumap/car.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/web/baidumap/car.png -------------------------------------------------------------------------------- /web/baidumap/car2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/web/baidumap/car2.png -------------------------------------------------------------------------------- /web/baidumap/greenball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/web/baidumap/greenball.png -------------------------------------------------------------------------------- /web/baidumap/j.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/web/baidumap/j.png -------------------------------------------------------------------------------- /web/baidumap/pic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/web/baidumap/pic.png -------------------------------------------------------------------------------- /web/baidumap/redball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/web/baidumap/redball.png -------------------------------------------------------------------------------- /web/baidumap/waypoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/web/baidumap/waypoint.png -------------------------------------------------------------------------------- /web/js/README.MD: -------------------------------------------------------------------------------- 1 | s 2 | -------------------------------------------------------------------------------- /web/tractorymap/README.MD: -------------------------------------------------------------------------------- 1 | 分别对应 mqtt的camera 图像显示 2 | 以及增加百度地图显示 3 | 通过与 4 | https://github.com/horo2016/easyMQOS/blob/main/python/collect_image.py 5 | 配合使用可以接收并显示图片 6 | 更新 index_door.html [电脑端网页通过输入IP地址连接机器人] 7 | 8 | -------------------------------------------------------------------------------- /web/微信截图_20230608102444.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horo2016/easyMQOS/ccb92adb2e5e00856d433341d6f062fd0f902b40/web/微信截图_20230608102444.png --------------------------------------------------------------------------------