University of Southern CaliforniaUSC
USC ICT TwitterUSC ICT FacebookUSC ICT YouTube

getting started with smartbody-lib | General SmartBody Discussion | Forum

Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
getting started with smartbody-lib
June 21, 2012
9:41 pm
Avatar
Member
Members
Forum Posts: 80
Member Since:
June 13, 2012
sp_UserOfflineSmall Offline

I'm having trouble figuring how to do anything with smartbody-lib, from the brief discussion in the manual. Supposing I figure out how to create a character, give it a skeleton, and set its position and orientation, how do I get the character to do anything? For example, how do I make the character look at something? I can see some classes that are probably involved, such as GazeBehavior, MeCtGaze, and MeCtSimpleGaze, but it's not clear what to do with them.

June 21, 2012
9:58 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

The main way to control your characters is via the BML interface, which is an XML-formatted instruction to your character. So to gaze at something you can send:

assuming that the 'chair' object is in the scene.
You can walk to a location:

You can reach for an object:

and so forth. The SmartBody manual contains such instructions in the section called 'BML Behaviors'. You can experiment with those commands in sbm-fltk by using the Window->BML Creator, which is an interface that assembles the proper BML command for you after you choose a few options from check boxes and drop-down lists.

Ari

June 21, 2012
10:40 pm
Avatar
Member
Members
Forum Posts: 80
Member Since:
June 13, 2012
sp_UserOfflineSmall Offline

It looks like your post is missing images or something. There are blank lines after your colons.

June 21, 2012
10:43 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

Looks like the forum didn't like my XML description. Let's try again; here are some BML commands:

Gaze:
<gaze target="chair"/>

Move:
<locomotion target="100 300"/>

Reach:

<sbm:reach target="ball"/>

Ari

June 21, 2012
11:16 pm
Avatar
Member
Members
Forum Posts: 80
Member Since:
June 13, 2012
sp_UserOfflineSmall Offline

OK, thanks.

July 10, 2012
10:17 pm
Avatar
Member
Members
Forum Posts: 80
Member Since:
June 13, 2012
sp_UserOfflineSmall Offline

The section "Using smartbody-lib" in the manual starts right out with SmartBody::getScene() (which I think should really be SmartBody::SBScene::getScene()). When I tried that, I got a crash (access violation) in Xerces. Apparently I need to call xercesc_3_1::XMLPlatformUtils::Initialize(). What other initialization steps need to be taken before using SmartBody?

July 10, 2012
10:31 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

hmm...that looks like a bug to me. The XMLPlatformUtils::Initialize(); should be contained within the scene initialization code.
I'll make that change.

In the meantime, you'll also want to initialize Python, although that should also be wrapped up into the getScene() command:

initPython("/path/to/python/libs")

Ari

July 10, 2012
10:47 pm
Avatar
Member
Members
Forum Posts: 80
Member Since:
June 13, 2012
sp_UserOfflineSmall Offline

Sorry, I don't know what to pass to initPython. What are python libs?

July 10, 2012
10:51 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

For the version of Python that you are using, there are a set of libraries (.py files and subfolders containing other .py files) that increase Python's functionality.
On OSX, it is somewhere like:

/System/Library/Frameworks/Python.framework/Versions/2.6/lib

Ari

April 1, 2015
9:56 pm
Avatar
Member
Members
Forum Posts: 6
Member Since:
March 19, 2015
sp_UserOfflineSmall Offline

Hello,

I am getting an an exception when call initPython.

initPython("/System/Library/Frameworks/Python.framework/Versions/2.7/lib/");

What may causes this problem?

Thank you,

Margarita

April 2, 2015
5:30 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

hmm... there's a bit of strangeness in the initPython call which probably needs to be fixed (and probably worked for Windows). It has code which sets the real python path to the folder up one from the folder that you give it. So in sb/SBPython.cpp:initPython() this code appears:

std::string pythonHome = pythonLibPath + "/..";

...

Py_SetPythonHome((char*)pythonHome.c_str());

 

 

so perhaps you can do something like this:

initPython("/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7")

 

And see if that still causes a crash?

Ari

April 2, 2015
5:51 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

Another possibility is that there is a difference between the Python version being used by SmartBody (2.7), and the default one that the system is using, which causes a crash at runtime.

 

Ari

April 2, 2015
6:39 pm
Avatar
Member
Members
Forum Posts: 6
Member Since:
March 19, 2015
sp_UserOfflineSmall Offline

I set the path python_lib_path = "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7" but causes exception.

Also, i run on terminal python -V

and the default python is Python 2.7.5.

The exception in initPython function causes on line 

boost::python::object module = boost::python::import("__main__"); while importing the main module.

 

Thank you,

Margarita

Forum Timezone: America/Los_Angeles

Most Users Ever Online: 733

Currently Online: Jamesnuh, gotselyuk1987mon, koenig62ramos, krygerhagen69, coxgeorge3, doyle68bekker, ludvigsen62abbott, shortstext78, cormierhopper5
66 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

jwwalker: 80

jyambao: 52

rbaral: 47

adiaz: 30

WargnierP: 29

lucky7456969: 28

mbarros: 28

avida.matt: 26

JonathanW: 24

laguerre: 23

Member Stats:

Guest Posters: 67

Members: 100502

Moderators: 3

Admins: 4

Forum Stats:

Groups: 1

Forums: 5

Topics: 460

Posts: 2403