jrl-umi3218 / mc_rtc

mc_rtc is an interface for simulated and real robotic systems suitable for real-time control
BSD 2-Clause "Simplified" License
122 stars 36 forks source link

comparing controller cost and period for the simulation by mc_rtc_ros and choreonoid #362

Closed Saeed-Mansouri closed 1 year ago

Saeed-Mansouri commented 1 year ago

Hello, Dr.Gergondet @gergondet and Dr.Tanguy @arntanguy,

I have opened this issue to compare the cost and period of the controller for two simulation cases run by mc_rtc_ros and choreonoid. For the simulations, I have used LIPM Walking Controller. The following images show the controller cost for both cases. As you can see in Figure 1, running the controller by mc_rtc_ros costs around one msec which is acceptable. However, for the simulation with choreonoid, the controller cost for the walking motion is more than the step-time of the controller which is 5 msec, see Figure 2. Such a large cost for the controller does not seem reasonable to me.

ros_cost Figure 1. Controller cost for the simulation run by mc_rtc_ros

rtm_cost Figure 2. Controller cost for the simulation run by choreonoid

Figures 3 and 4 show the step-time of the controller for both simulation cases which are estimated by a high-resolution clock. For the case ran by mc_rtc_ros, the variation of the estimated step-time is about 0.1 msec. However, for the simulation with choreonoid, it is not reasonable during the walking motion, see Figure 4.

ros_period Figure 3. Estimated controller step-time for the simulation run by mc_rtc_ros

rtm_period Figure 4. Estimated controller step-time for the simulation run by choreonoid

I will appreciate it if you respond following items:

  1. Should I do any settings on the PC to reduce the computation cost for running the simulation by choreonoid?
  2. Is there any way to run the controller with mc_opernrtm without using choreonoid? (Like mc_rtc_ros that runs the controller without using choreonoid)
gergondet commented 1 year ago

Hi @Saeed-Mansouri

Sorry for the long delay on this answer.

Are you still seeing this issue?

The difference in perf_ControllerRun is quite surprising. Have you built mc_openrtm with the right CMAKE_BUILD_TYPE?

The fluctuation you seen in perf_Period_rtm are from this spiky controller runs. As Choreonoid will "catch up" the time that was lost in previous iterations to maintain the sim/real ratio to 1.0

Should I do any settings on the PC to reduce the computation cost for running the simulation by choreonoid?

Normally no but I advice setting your CPU to performance mode for the most reliable comparison between the two.

Is there any way to run the controller with mc_opernrtm without using choreonoid? (Like mc_rtc_ros that runs the controller without using choreonoid)

No. Unless you run on a robot with the RobotHardware component running but I'm assuming you mean simulation here.

I'm closing this for now but feel free to re-open if you are still observing this issue.