jrl-umi3218 / mc_openrtm

Interface between OpenRTM and mc_rtc
BSD 2-Clause "Simplified" License
3 stars 10 forks source link

[critical/urgent] open_iob call in timestep check fails intermittently #30

Open rohanpsingh opened 1 year ago

rohanpsingh commented 1 year ago

https://github.com/jrl-umi3218/mc_openrtm/blob/b2a28aaff697945f3d36dddcba09cfc4dc2b7cb1/src/MCControl.cpp#L634-L654

This check is happening at every onExecute. In today's experiment (@orikuma), we noticed that the open_iob call fails a few timesteps after starting the controller! This caused the MCControl to be deactivated.

We can rewrite and make sure that the timestep check happens only once in the beginning but I think we need to dig deeper - because the same problem could happen while modifying the PD gains. Or could be problematic if we introduce more such features that make direct interaction with the IOB.

gergondet commented 1 year ago

We can rewrite and make sure that the timestep check happens only once in the beginning but I think we need to dig deeper - because the same problem could happen while modifying the PD gains. Or could be problematic if we introduce more such features that make direct interaction with the IOB.

Sorry I shouldn't have merged yesterday. This definitely should only be done once. It's not a good idea to repeatedly open/close the iob this way.

rohanpsingh commented 1 year ago

Okay we can put it in the if(!init) {...} block. But how about the PD gain calls? Even that could be a problem because ideally one would make repeated calls to "setServoGains" for interpolating and gradually changing the PD gains, for example.

gergondet commented 1 year ago

What error do you see when you call open_iob?

I think it's ok to call open_iob once if we plan to make repeated calls to it

rohanpsingh commented 1 year ago

The exact error was as follows:

shmat(open_iob): Cannot allocate memory
[critical] [mc_openrtm] Call to open_iob failed! Cannot execute (mc_openrtm constructor).

(process:1720): GLib-ERROR **: 10:57:24.748: creating thread 'gmain': Error creating thread: Resource temporarily unavailable
rohanpsingh commented 1 year ago

Though I couldn't reproduce this problem later today with posture controller...