Skip to content

RAM API Reference Utility

Yohei Miura edited this page Jul 29, 2017 · 20 revisions

Utility

Summary

This page shows some useful classes, including selecting a node, programatically saving/loading motion data, as well as storing camera settings.

Table of Contents

ramNodeFinder

ramNodeFinder searches for a node or multiple notes from an array of nodes managed by ramActorManager. If you want to manupulate specific nodes, this is much easier than a for-loop. ramNodeFinder should be used in your draw() loop, and not in drawActor() or drawRigid()


ramNodeFinder()

Constructor.

ramNodeFinder nf;
nf1.setTargetName("Yoko");
nf1.setJointID(ramActor::JOINT_HEAD);

ramNodeFinder(const ramNodeIdentifer& copy)

Constructor.

ramNodeIdentifer cyril_head("Cyril", ramActor::JOINT_HEAD);
ramNodeFinder nf(cyril_head);

void setTargetName(string name_)

Sets target name.


void setJointID(int index_)

Sets target joint id.


bool ramNodeFinder::findOne(ramNode &node)

Returns true if ramActorManager has ramNodeArray whose name is the same as ramNodeFinder::name, and the ramNodeArray has a node which has the same id as ramNodeFinder::index. If this is true, the search result node is set to ramNode &node.


vector findAll()

Return all nodes which matches the target name and target joint id.


vector findByID()

Return all nodes which matches the target joint id.



ramNodeIdentifer

A tiny class for identifying a node.
Generally it is used with ramNodeFinder.


ramNodeIdentifer()

Constructor.


ramNodeIdentifer(int index)

Constructor.


ramNodeIdentifer(const string &name)

Constructor.


ramNodeIdentifer(const string &name, int index)

Constructor.


ramNodeIdentifer(const ramNodeIdentifer& copy)

Constructor.


ramNodeIdentifer& operator=(const ramNodeIdentifer& copy)

Name and id are copied from right hand side.


void set(const string &name, int index)

Sets target name and target id.


void set(const string &name)

Sets target name.


void set(int index)

Sets target id.


void clear()

Clears target name and target id.


bool isValid() const

Checks to see if target name and target id are set.


friend ostream& operator<<(ostream &os, const ramNodeIdentifer& o)

Puts name and id into stream.



ramCameraSettings

ramCameraSettings stores some settings used for controlling ofCamera.

string name, ofVec3f pos, ofVec3f look_at, float fov, unsigned int moving_type, bool bMoving, ofVec3f moving_from, ofVec3f moving_to, float moving_duration, float moving_start_time, float moving_end_time, ofVec3f moving_axis_pos, ofVec3f moving_axis_up_vector, float moving_radius, float moving_speed, float moving_deg,

A sample XML format is available here: RAMDanceToolkit/resources/Settings/cam.moving.xml


ramCameraSettings(ofxXmlSettings& setting)

Loads one setting from XML


static vector loadSettings(ofxXmlSettings& setting)

Loads all settings from XML.



ramTSVCoder

bool load(const string filePath)

Returns true if loading const string filePath is successful.

ramCommunicationManager

ramCommunicationManager is communication tools with other applications via OSC.

An example is available at examples/example-communicationManager

Setup

//communicationManager setup
ramCommunicationManager::instance().addSender("localhost", 8000);

Send OSC to another app

//Send from communicationManager
ramCommunicationManager::instance().sendCC("rightHand", handPos, 3);

Receive OSC from another app and use it

//Receive from communicationManager

//[Send format]
//Port    : same as the port passed to ramInitialize( ... )
//Address : /ram/communicate/cc
//Args    : string(Instrument name), float(cc value), float(cc value), ...

float scale = 10 + ramCommunicationManager::instance().getCC("someInst", 0) * 50.0;

ofEnableDepthTest();
ramEnableShadow();
ramBeginCamera();

ofDrawBox(0, 100, 0, scale);

ramEndCamera();

ramOscReceiveTag

ramOscReceiveTag is an OSC receiver class for each scene.

Setup

ofxOscReceiveTag receiver;

receiver.addAddress("/Signals");
ramOscManager::instance().addReceiverTag(&receiver);

Receiving OSC

while (receiver.hasWaitingMessages()){
	
	ofxOscMessage m;
	receiver.getNextMessage(&m);

	if (m.getAddress() == "/Signals/bang"){
		cout << "Receive bang" << endl;
	}
	if (m.getAddress() == "/Signals/control"){
		cout << "Control :" << m.getArgAsInt32(0) << endl;
	}
	
}

Creative Commons License
This Document by YCAM InterLab, Yoshito Onishi, Satoru Higa, Motoi Shimizu, and Kyle McDonald is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Clone this wiki locally