-
Notifications
You must be signed in to change notification settings - Fork 40
RAM API Reference Core
This page shows basic structure of RAMDanceToolkit. After reading this page, you will know how to use the data sent from sensors as actor, rigid body and its nodes.
ramBaseApp passes recieved OSC message (generally listening on port 10000) to ramActorManager automatically for managing data from MOTIONER or other sensors as ramActor and ramRigidBody.
testApp is inherited several functions and events from ramBaseApp to manipulate actors and rigidbodies.
//--------------------------------------------------------------
void testApp::setup()
{
}
//--------------------------------------------------------------
void testApp::update()
{
}
//--------------------------------------------------------------
void testApp::draw()
{
}
#pragma mark - ram methods
//--------------------------------------------------------------
void testApp::drawActor(const ramActor &actor)
{
// To be called as many as number of recieving OSC data of ramActor.
// Each of the actor is passed as the argument `const ramActor &actor`.
}
//--------------------------------------------------------------
void testApp::drawRigid(const ramRigidBody &rigid)
{
// To be called as many as number of recieving OSC data of ramRigidBody.
// Each of the actor is passed as the argument `const ramRigidBody &rigid`.
}
#pragma mark - ram Events
//--------------------------------------------------------------
void testApp::onActorSetup(const ramActor &actor)
{
// To be called when ramActorManager start to recieve OSC data of new ramActor.
// The new actor is passed as the argument `const ramActor &actor`.
}
//--------------------------------------------------------------
void testApp::onActorExit(const ramActor &actor)
{
// To be called when `const ramActor &actor` is outdated.
// 1.0 sec is set to RAM_OUTDATED_DURATION in ramConstants.h as default.
}
//--------------------------------------------------------------
void testApp::onRigidSetup(const ramRigidBody &rigid)
{
// To be called when ramActorManager start to recieve OSC data of new ramRigidBody.
// The new rigidbody is passed as the argument `const ramRigidBody &rigid`.
}
//--------------------------------------------------------------
void testApp::onRigidExit(const ramRigidBody &rigid)
{
// To be called when `const ramRigidBody &rigid` is outdated.
// 1.0 sec is set to RAM_OUTDATED_DURATION in ramConstants.h as default.
}
And ramBaseApp provides some more functions.
Floor is not drawn if bool v is false.
ramActor always has 23 nodes these has a parent‐child relationship. ramRigidBody is a simple nodes cluster which doesn't have a parent‐child relationship and fixed number of nodes.
/Images/API/JointNames_osc.png
Both of these classes are inherited from ramNodeArray which provides some calculation methods to control positions. See also ofxNodeArary inherited by ramNodeArray.
Returns size of the nodes in ramNodeArray.
Returns reference to ramNode which corresponds to node_id.
In case of ramActor, using enum Joint defined in ramActor.h is useful to find ramNode what you want to access.
enum Joint
{
JOINT_HIPS = 0,
JOINT_ABDOMEN = 1,
JOINT_CHEST = 2,
JOINT_NECK = 3,
JOINT_HEAD = 4,
JOINT_LEFT_HIP = 5,
JOINT_LEFT_KNEE = 6,
JOINT_LEFT_ANKLE = 7,
JOINT_LEFT_TOE = 8,
JOINT_RIGHT_HIP = 9,
JOINT_RIGHT_KNEE = 10,
JOINT_RIGHT_ANKLE = 11,
JOINT_RIGHT_TOE = 12,
JOINT_LEFT_COLLAR = 13,
JOINT_LEFT_SHOULDER = 14,
JOINT_LEFT_ELBOW = 15,
JOINT_LEFT_WRIST = 16,
JOINT_LEFT_HAND = 17,
JOINT_RIGHT_COLLAR = 18,
JOINT_RIGHT_SHOULDER = 19,
JOINT_RIGHT_ELBOW = 20,
JOINT_RIGHT_WRIST = 21,
JOINT_RIGHT_HAND = 22,
NUM_JOINTS = 23,
};
Therefore the code to access nodes in your testApp.cpp will be like this:
void testApp::drawActor(const ramActor &actor)
{
// access to right hand
ramNode rightHand = actor.getNode(ramActor::JOINT_RIGHT_HAND);
// do something with rightHand...
}
void testApp::drawRigid(const ramRigidBody &rigid)
{
// access to all nodes
for(int i=0; i<rigid.getNumNode(); i++)
{
ramNode node = rigid.getNode(i);
// do something with node...
}
}
Returns true if the ramNodeArray is ramActor.
Returns true if the ramNodeArray is ramRigidBody.
Returns true if the ramNodeArray is same type to ramNodeArrayType t which is defined in ramActor.h.
enum ramNodeArrayType
{
RAM_NODEARRAY_TYPE_ACTOR = 0,
RAM_NODEARRAY_TYPE_RIGIDBODY = 1
};
Return the name of node array e.g. Yoko, Cyril, Yasu …
Return true if the right hand side ramNodeArray is same to left hand side.
Return true if the right hand side ramNodeArray is not same to left hand side.
Returns ramNodeArray which has synthesized global position.
Returns self which has synthesized global position.
Returns ramNodeArray which has synthesized global position.
Returns self which has synthesized global position.
Returns the reference to self which is lerped using float t.
Returns the copy of self which is lerped using float t.
Returns the reference to self which is normalized using float length.
Returns the copy of self which is normalized using float length.
Returns the reference to self which is limited using float length.
Returns the copy of self which is limited using float length.
Returns the last update client time of the ramNodeArray. The last update client time is updated when RAMDanceToolkit recieved new OSC data of the node array.
ramNode is used as a joint of ramActor and ramRigidBody which is inherited from ofNode. See also ofxNodeArray::Node .
Returns its parent node.
Returns true if ramNode has parent node.
Returns its global position.
It can be used as shortcut of ofNode::getGlobalPosition() so here is a sample code to draw shapes using oF methods.
void testApp::drawActor(const ramActor &actor)
{
ramNode rightHand = actor.getNode(ramActor::JOINT_RIGHT_HAND);
ramNode leftHand = actor.getNode(ramActor::JOINT_LEFT_HAND);
// line between two node
ofLine(rightHand, leftHand);
// a box on right hand
ofBox(rightHand, 100);
// a sphere on left hand
ofSphere(leftHand, 100);
}
Another example to draw ramActor using ofBox and ofLine:
void testApp::drawActor(const ramActor &actor)
{
for(int i=0; i<actor.getNumNode(); i++)
{
ramNode node = actor.getNode(i);
// draw box as joint
ofBox(node, 10);
// draw line if it has parent node
if(node.hasParent())
{
ofLine(node, *node.getParent());
}
}
}
Returns the distance between previous frame and current frame.
Returns the acceleration calculated by previous frame and current frame.
Returns the acceleration calculated by previous frame and current frame.
Returns the anguler velocity calculated by previous frame and current frame.
Returns the anguler acceleration calculated by previous frame and current frame.
Returns the node name e.g. JOINT_HEAD, JOIND_RIGHT_TOE ...
Draws the node name int floatPos = 20 cm above the node.
Alias to transformGL() .
Alias to restoreTransformGL() .
The sample code putted at ramNode::operator ofVec3f() didn't use the orientation so here is the another sample to use orientation of ramNode.
void testApp::drawActor(const ramActor &actor)
{
for(int i=0; i<actor.getNumNode(); i++)
{
ramNode node = actor.getNode(i);
// draw box as joint
node.beginTransform();
ofBox(10);
node.endTransform();
}
}
Return true if the right hand side ramNode is same to left hand side.
Return true if the right hand side ramNode is not same to left hand side.
Returns ramNode which has synthesized global position.
Returns self which has synthesized global position.
Returns ramNode which has synthesized global position.
Returns self which has synthesized global position.
Returns the reference to self which is lerped using float t.
Returns the copy of self which is lerped using float t.
Returns the reference to self which is normalized using float length.
Returns the copy of self which is normalized using float length.
Returns the reference to self which is limited using float length.
Returns the copy of self which is limited using float length.
RAMDanceToolkit manages OSC data sent from MOTIONER or other sensor as ramActor or ramRigidBody. ramActorManager stores actors and updates these states.
There are some shortcuts you can use anywhere to access the actors.
Returns reference to ramActorManager.
Returns reference to ramNodeArray whose name is same to string name.
Returns reference to ramNodeArray whose index is same to int index.
For example, the index of first actor RAMDanceToolkit recieved is 0.
Returns true if ramActorManager has ramNodeArray whose name is same to string name.
Returns true if ramActorManager has ramNodeArray whose name is same to string name.
Returns number of the ramNodeArray RAMDanceToolkit is recieving at the time.
Returns all names of ramNodeArray RAMDanceToolkit is recieving at the time as vector.
Returns all ramNodeArray RAMDanceToolkit is recieving at the time as vector.
This Wiki and API References (RAMDanceToolkit 1.0.0) is created on 2013-03-09