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

Use qInit instead of qIn to initialize mc_rtc #14

Merged
merged 4 commits into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions projects/JVRC1/cnoid/sim_mc.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def startMCControl():
mc.setProperty("is_enabled", "1")

def connectMCControl():
connectPorts(sh.port("qOut"), mc.port("qInit"))
connectPorts(rh.port("q"), mc.port("qIn"))
connectPorts(rh.port("dq"), mc.port("alphaIn"))
connectPorts(rh.port("tauOut"), mc.port("taucIn"))
Expand Down
11 changes: 10 additions & 1 deletion src/MCControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,16 @@ RTC::ReturnCode_t MCControl::onExecute(RTC::UniqueId ec_id)
if(!init)
{
mc_rtc::log::info("Init controller");
controller.init(qIn);
if(qInit.size() == qIn.size())
{
controller.init(qInit);
}
else
{
mc_rtc::log::warning("The size of qInit does not mach the size of qIn, please update the corresponding "
"Python script... using qIn instead to initialize the controller");
controller.init(qIn);
}
init = true;
}
if(controller.run())
Expand Down