Joystick control dji psdk
CompletedHi, I want to do thrust autonomous control.
- Is there any news on the mapping from value (0-100%) to thrust? Do you control RPM or forward a PWM to ESC internally?
- I try to do joystick control by first obtaining joystick authority. Then setting joystick mode: (vertical mode to 2=thrustcontrol, the rest to 0). When I do this, I see the drone making a small hop, but not maintaining the thrust. Should I send the joystick command at a certain rate to maintain a certain thrust?
- All the previous was done in DJI HITL SIM with PSDK 3.2 and a Matrice 300 RTK.
-
1、The flight controller will process the throttle parameters passed in from outside the O/PSDK to control the thrust. Unfortunately, the current flight controller does not provide a mapping from throttle parameters to thrust. Currently, the relationship between throttle thrust and ESC can be evaluated by subscribing to ESC data(TOPIC_ESC_DATA). 2、The joystick needs to be sent continuously at a certain frequency, once the sending is stopped, the drone will stop moving. -
I always get 180 RPM for the first 4 ESC's. Doesnt matter if flying, armed or not armed. I get 0 RPM for next 4 ESCS (which is realistic, since there are only four). Why is this? Code:
if (DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_ESC_DATA, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ,escRPMCallback) != 0) {ROS_FATAL_STREAM("fcSubscribeTopic DJI_FC_SUBSCRIPTION_TOPIC_ESC_DATA failed\n");exit(1);}T_DjiReturnCode DjiTelemetry::escRPMCallback(const uint8_t* data, uint16_t, const T_DjiDataTimestamp* timestamp_fc) {T_DjiFcSubscriptionEscData esc_data_array = *((T_DjiFcSubscriptionEscData*)data);mb_msgs::ESCData msg;msg.stamp = mb_time_sync_.convertTimeRos(timestamp_fc->millisecond);for (int i = 0; i < kNumEscs; i++) {msg.speed.push_back(esc_data_array.esc[i].speed);std::cout<<"RPM = "<<static_cast<int>(esc_data_array.esc[i].speed)<<std::endl;}return isaac_interface_.executeFunction(AbstractFunction::PUBLISH_ESC_DATA, std::move(msg));} -
Tested in the simulator, the value is 0 when the motor is not started, and 180 after the motor is started. Check again if the subscription data is correct. ![](https://djisdksupport.zendesk.com/attachments/token/TdfDkzAoiP7aA9W87QEuM67bi/?name=image.png) -
I'm also facing the same issue, like initially am getting 180 even when the drone is not armed or flying. Attaching below:
Please sign in to leave a comment.
Comments
7 comments