Page 1 of 1

sample code for printing to Messages screen

Posted: Mon Jun 27, 2011 9:43 am
by papaya
Hi,
I was wondering if there's a simple syntax for printing something to the 'messages' screen of the OpenSim GUI. I'm writing a plugin and just want to be able to see the function outputs (e.g. positions, rotations, etc) as I run things for error checking (without having to print them to an external .sto/.mot file).
Essentially, I'm just looking for something along the lines of:

computeMotion(const SimTK::State& s) const
{
stuffstuffstuff computationscomputationscomputations

--> print to the messages window what dq is before 'return dq;' <--
return dq;
}

It seems simple enough, but I don't know what appropriate syntax for it since I can't seem to find an example of a code snippet that does it.

Thanks!
adila

RE: sample code for printing to Messages screen

Posted: Mon Jun 27, 2011 6:15 pm
by aymanh
Hi Adila,

The GUI takes over whatever is printed out to the stdout and/or stderr, so on the C++ side you just need to cout whatever message you want as in
cout << "My message" << endl;

Hope this helps,
-Ayman

RE: sample code for printing to Messages screen

Posted: Tue Jun 28, 2011 5:51 am
by papaya
hey Ayman,

Thanks for the quick reply. I tried what you said -- e.g. cout<< "X_FM is" << X_FM <<endl; -- rebuild, reinstall, rerun, but nothing is printing to screen. I'm seeing this message though which I don't think was there before:

WARNING: UNSUPPORTED Trying to load a file from a more recent version of OpenSim.
Extra attributes, if any, will be ignored.WARNING: UNSUPPORTED Trying to load a file from a more recent version of OpenSim.

All I added in though was the cout message.

Thanks,
adila

All I added in though was the cout message.

Thanks,
adila

Re: sample code for printing to Messages screen

Posted: Thu Feb 23, 2012 7:08 pm
by saxbyd
Hi Guys,

This may be slightly different, but we are planning to batch process a bunch of trials and wanted to use the residuals from the IK process as a metric, i.e total error or marker specific errors above some threshold gets flagged.

Is it possible to access the message window results from various tools (static scale, IK, ID) from Matlab?

Many thanks for any help.

David