Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rohanpsingh opened this issue Feb 9, 2023 · 5 comments

Comments

@rohanpsingh
Copy link
Contributor

// confirm mc-rtc timestep is same as IOB timestep
if(!m_is_simulation)
{
if(!open_iob())
{
failed_iob("open_iob", "(mc_openrtm constructor)");
mc_rtc::log::error_and_throw<std::runtime_error>("[mc_openrtm] Cannot verify timesteps of IOB and mc-rtc.");
}
double iob_ts = get_signal_period() / 1e9;
if(fabs(iob_ts - controller.controller().timeStep) > 1e-6)
{
mc_rtc::log::error_and_throw<std::runtime_error>(
"[mc_openrtm] Missmatch between IOB timestep ({}ms) and mc_rtc ({}ms).", iob_ts,
controller.controller().timeStep);
}
if(!close_iob())
{
failed_iob("close_iob", "(mc_openrtm constructor)");
mc_rtc::log::error_and_throw<std::runtime_error>("[mc_openrtm] Could not close IOB.");
}
}

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
Copy link
Member

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
Copy link
Contributor Author

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
Copy link
Member

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants