[15.224][linker]-[Error]-[DjiLinker_RecvTask:259) send msg to queue error
CompletedHi, I have the following error sometimes upon connection and setting up FC subscriptions.How come and how do I solve it? It always happens at startup.
-
Our current baudrate is 921600. Note that after this happens, it happens a few times again. However, if it does work again (i.e. not crash), I see
[14.428][adapter]-[Info]-[DjiAccessAdapter_Init:242) Now auto reconfigure baudrate from 1000000 to 921600in the logs. I'm sure I never changed the baudrate myself. If I change the baudrate myself back to 921600 it also works fine again. It seems that it crashes because the PSDK changes the baudrate for me. Have you got any info on that?
Extra info: It always happens in the constructor where I register fcsubscriptions and I register a HMS_info callback (and initialize both ofc) -
[0.002][core]-[Info]-[DjiCore_Init:92) Payload SDK Version : V3.2.0-beta.0-build.1539
[1.393][utils]-[Info]-[DjiSdkVersionAck_Parse:183) Identify aircraft serial number = 1ZN3J97001W004, Firmware = 3.4.18.7
[1.396][adapter]-[Info]-[DjiAccessAdapter_Init:154) Identify aircraft series is Matrice 300 Series
[1.396][adapter]-[Info]-[DjiAccessAdapter_Init:171) Identify mount position type is Extension Port Type
[2.559][core]-[Info]-[DjiIdentityVerify_UpdatePolicy:415) Updating dji sdk policy file...
[3.559][core]-[Info]-[DjiIdentityVerify_UpdatePolicy:418) Update dji sdk policy file successfully
[3.562][core]-[Info]-[DjiCore_Init:151) Identify AircraftType = Matrice 300 RTK, MountPosition = Extension Port, SdkAdapterType = None
[3.562][core]-[Info]-[DjiCore_ApplicationStart:209) Start dji sdk application
[3.562][user]-[Info]-[DjiUser_ApplicationStart:198) Application start.
[7.439][utils]-[Error]-[DjiMsgq_Send:230) semaphore wait timeout
[7.439][linker]-[Error]-[DjiLinker_RecvTask:267) send msg to queue error
[7.451][utils]-[Error]-[DjiMsgq_Send:230) semaphore wait timeout
[7.451][linker]-[Error]-[DjiLinker_RecvTask:267) send msg to queue error
[7.462][utils]-[Error]-[DjiMsgq_Send:230) semaphore wait timeout
[7.462][linker]-[Error]-[DjiLinker_RecvTask:259) send msg to queue error
[7.472][utils]-[Error]-[DjiMsgq_Send:230) semaphore wait timeout
[7.472][linker]-[Error]-[DjiLinker_RecvTask:259) send msg to queue error
[7.482][utils]-[Error]-[DjiMsgq_Send:230) semaphore wait timeout
[7.482][linker]-[Error]-[DjiLinker_RecvTask:259) send msg to queue error
[7.492][utils]-[Error]-[DjiMsgq_Send:230) semaphore wait timeout
[7.492][linker]-[Error]-[DjiLinker_RecvTask:259) send msg to queue error
[7.503][utils]-[Error]-[DjiMsgq_Send:230) semaphore wait timeout
[7.503][linker]-[Error]-[DjiLinker_RecvTask:259) send msg to queue error -
I have a main which constructs two classes: The application class (as in the sample code): `Application application(argc, argv);` . and a DjiTelemetry Class. The program crashes in the constructor of my DjiTelemetry class. This constructor looks as follows:
DjiTelemetry::DjiTelemetry() {
if (DjiFcSubscription_Init() != 0) {
ROS_ERROR_STREAM("fcSubscriptionInit failed\n");
exit(1);
};
if (DjiHms_Init() != 0) {
ROS_ERROR_STREAM("DjiHms_Init failed\n");
exit(1);
};
if (DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_BATTERY_INFO, DJI_DATA_SUBSCRIPTION_TOPIC_1_HZ,
batteryStateCallback) != 0) {
ROS_ERROR_STREAM("fcSubscribeTopic DJI_FC_SUBSCRIPTION_TOPIC_BATTERY_INFO failed\n");
exit(1);
};
if (DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_STATUS_FLIGHT, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ,
flightStatusCallback) != 0) {
ROS_ERROR_STREAM("fcSubscribeTopic DJI_FC_SUBSCRIPTION_TOPIC_STATUS_FLIGHT failed\n");
exit(1);
};
if (DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_HEIGHT_RELATIVE, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ,
heightAboveTakeoffCallback) != 0) {
ROS_ERROR_STREAM("fcSubscribeTopic DJI_FC_SUBSCRIPTION_TOPIC_HEIGHT_RELATIVE failed\n");
exit(1);
};
if (DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_POSITION_VO, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ,
voPositionCallback) != 0) {
ROS_ERROR_STREAM("fcSubscribeTopic DJI_FC_SUBSCRIPTION_TOPIC_POSITION_VO failed\n");
exit(1);
};
// Documentation specifies maximum is 100 Hz, but can only be called with 50 Hz max.
if (DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_RC, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ,
rcButtonCallback) != 0) {
ROS_ERROR_STREAM("fcSubscribeTopic DJI_FC_SUBSCRIPTION_TOPIC_RC failed\n");
exit(1);
};
if (DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_HARD_SYNC, DJI_DATA_SUBSCRIPTION_TOPIC_400_HZ,
hardsyncCallback) != 0) {
ROS_ERROR_STREAM("fcSubscribeTopic DJI_FC_SUBSCRIPTION_TOPIC_ACCELERATION_RAW failed\n");
exit(1);
}
if (DjiHms_RegHmsInfoCallback(hmsInfoCallback) != 0) {
ROS_ERROR_STREAM("DjiHms_RegHmsInfoCallback failed\n");
exit(1);
}
}This crash (see output previous comment) only happens every 1 out of 5 times. It always happens at the beginning (because it crashes within the constructor). I have a sleep of five seconds between the vehicle connection (`Application.cpp`) and the DjiTelemetry class.
In the callback function I obtain the data using:
`T_DjiFcSubscriptionHeightRelative height = *((T_DjiFcSubscriptionHeightRelative*)data);`
Please let me know if I can provide you with more info. -
It is recommended to check the code to ensure that after DjiUser_ApplicationStart is completed, then start the function module, such as FcSubscription.If it still doesn't work, please provide the complete code of the initialization part, it seems to be a problem of initialization execution order. -
DjiUser_ApplicationStart is definitely completed, since it is in the constructor of Application application(argc, argv);. I changed the order of my own constructor and it seems to work now (no crashes in ten tries). Why does this work? Is this a bug from your side or did I miss anything?
DjiTelemetry::DjiTelemetry() {if (DjiFcSubscription_Init() != 0) {ROS_ERROR_STREAM("fcSubscriptionInit failed\n");exit(1);};
if (DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_BATTERY_INFO, DJI_DATA_SUBSCRIPTION_TOPIC_1_HZ,batteryStateCallback) != 0) {ROS_ERROR_STREAM("fcSubscribeTopic DJI_FC_SUBSCRIPTION_TOPIC_BATTERY_INFO failed\n");exit(1);};
if (DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_STATUS_FLIGHT, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ,flightStatusCallback) != 0) {ROS_ERROR_STREAM("fcSubscribeTopic DJI_FC_SUBSCRIPTION_TOPIC_STATUS_FLIGHT failed\n");exit(1);};
if (DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_HEIGHT_RELATIVE, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ,heightAboveTakeoffCallback) != 0) {ROS_ERROR_STREAM("fcSubscribeTopic DJI_FC_SUBSCRIPTION_TOPIC_HEIGHT_RELATIVE failed\n");exit(1);};
if (DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_POSITION_VO, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ,voPositionCallback) != 0) {ROS_ERROR_STREAM("fcSubscribeTopic DJI_FC_SUBSCRIPTION_TOPIC_POSITION_VO failed\n");exit(1);};
// Documentation specifies maximum is 100 Hz, but can only be called with 50 Hz max.if (DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_RC, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ,rcButtonCallback) != 0) {ROS_ERROR_STREAM("fcSubscribeTopic DJI_FC_SUBSCRIPTION_TOPIC_RC failed\n");exit(1);};
if (DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_HARD_SYNC, DJI_DATA_SUBSCRIPTION_TOPIC_400_HZ,hardsyncCallback) != 0) {ROS_ERROR_STREAM("fcSubscribeTopic DJI_FC_SUBSCRIPTION_TOPIC_ACCELERATION_RAW failed\n");exit(1);}
if (DjiHms_Init() != 0) {ROS_ERROR_STREAM("DjiHms_Init failed\n");exit(1);};
if (DjiHms_RegHmsInfoCallback(hmsInfoCallback) != 0) {ROS_ERROR_STREAM("DjiHms_RegHmsInfoCallback failed\n");exit(1);}
}
Please sign in to leave a comment.
Comments
9 comments