Joystick control dji psdk

Completed

Comments

7 comments

  • DJI Developer Support
    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.
    0
    Comment actions Permalink
  • Rinto

    Alright, thanks. Does this also work in HILSIM? I.e. does the rpm give realistic values when flying?

    0
    Comment actions Permalink
  • DJI Developer Support
    It can be used in the simulator, but the throttle value in the simulator and the actual flight may be different.
    0
    Comment actions Permalink
  • Rinto

    Alright. Thanks for your support.

    0
    Comment actions Permalink
  • Rinto

    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));
    }
    0
    Comment actions Permalink
  • DJI Developer Support
    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)
    0
    Comment actions Permalink
  • Barathwaja S

    DJI Developer Support,

    I'm also facing the same issue, like initially am getting 180 even when the drone is not armed or flying. Attaching below:

    0
    Comment actions Permalink

Please sign in to leave a comment.