doosan-robotics / doosan-robot

ROS for Doosan Robot
BSD 3-Clause "New" or "Revised" License
118 stars 59 forks source link

Use RT control with emulator #207

Open scostiit opened 1 month ago

scostiit commented 1 month ago

Hello. I'm trying to test some API function using the emulator. I have some problems using the RT control.

I can open the connection (Drfl.connect_rt_control(127.0.0.1);) and set the callback in set_on_rt_monitoring_data, but I cannot receive any data.

Is it possible to use the RT control with the emulator?


void onRTMonitoringDataCB(LPRT_OUTPUT_DATA_LIST tData)
{
    std::cout << "j0 : " << tData->actual_joint_position[0] << std::endl;
    std::cout << "sin: " << tData->singularity << std::endl;
    std::cout << "robot_mode: " << int(tData->robot_mode) << std::endl;
    std::cout << "robot_state: " << int(tData->robot_state) << std::endl;
    std::cout << "control_mode: " << int(tData->control_mode) << std::endl;
}

main(){
  [...]
  Drfl.connect_rt_control(host, 12347);
  std::string version = "v1.0";
  float period = 0.1;
  int losscount = 4;
  string tData = Drfl.get_rt_control_output_data_list(version);
  std::cout << tData << std::endl;
  Drfl.set_on_rt_monitoring_data(onRTMonitoringDataCB);
  Drfl.set_rt_control_output(version, period, losscount);
  Drfl.start_rt_control();

  [...]

  Drfl.stop_rt_control();
  Drfl.disconnect_rt_control();
}