sample code for printing to Messages screen

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Nur Adila Faruk Senan
Posts: 75
Joined: Tue Apr 06, 2010 8:20 pm

sample code for printing to Messages screen

Post by Nur Adila Faruk Senan » Mon Jun 27, 2011 9:43 am

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

User avatar
Ayman Habib
Posts: 2248
Joined: Fri Apr 01, 2005 12:24 pm

RE: sample code for printing to Messages screen

Post by Ayman Habib » Mon Jun 27, 2011 6:15 pm

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

User avatar
Nur Adila Faruk Senan
Posts: 75
Joined: Tue Apr 06, 2010 8:20 pm

RE: sample code for printing to Messages screen

Post by Nur Adila Faruk Senan » Tue Jun 28, 2011 5:51 am

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

User avatar
David John Saxby
Posts: 83
Joined: Mon May 09, 2011 8:39 pm

Re: sample code for printing to Messages screen

Post by David John Saxby » Thu Feb 23, 2012 7:08 pm

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

POST REPLY