User Tools

Site Tools


steereo:classes:steerparametercommand

SteerParameterCommand

Description

The SteerParameterCommand gives you the opportunity to enable a simulation for parameter steering. The command is provided by the Steereo library and automatically loaded into the command map. You can see it in “action” in the Howto.

Use in the simulation

In the simulation the only thing to do is to register the parameters, you want to be steerable with on of these static functions (T and TC are template parameters, of which you shouldn't have to take care). For each scalar and array you can either register the parameter with a pointer or getter and setter methods.

  • void registerScalarParameter (std::string paramName, T* ptrToParam, std::string minVal=“0”, std::string maxVal=“0”)
  • void registerScalarParameter (std::string paramName, TC* ptrToInstance, T (TC::*getter) (), void (TC::*setter) (T), std::string minVal =“0”, std::string maxVal=“0”)
  • void registerArrayParameter (std::string paramName, T* ptrToParam, int arrayLength)
  • void registerArrayParameter (std::string paramName, TC* ptrToInstance, T (TC::*getter) (), int arrayLength)

Parameters

  • paramName - the name, with which the parameter can be requested from a client
  • ptrToParam - pointer to the steered parameter
  • ptrToInstance - pointer to the instance from which the getter (and setter for scalars) should be used
  • getter - function pointer to the getter function (usually something like &(className::getParam) )
  • setter - function pointer to the setter function (usually something like &(className::setParam) )
  • arrayLength - length of the steered array
  • minVal, maxVal (optional) - minimal and maximal value of the parameter

How does the client request parameters

The easiest would be to use the SteerParameterClient, which helps you making requests and handling the responses. But you can use the usual makeRequest:

ClientSteering clientSteer;
clientSteer->addAction("steerParameter", &processParameter);
clientSteer->makeRequest ("steerParameter", requestString);
//or 
clientSteer->makeRequest ("steerParameter", requestString, additionalData);

The requestString can be:

  • “GET param” - request the value of the parameter param (can also be an array)
  • “GET param index” - request the value of param[index]], if param is an array otherwise index is ignored and the value of param is returned
  • “SET param” - request to set the value of param to values, which have to be sent as third argument (additionalData in the abov snippet) as a SteereoStream.
  • “SET param value” - request to set the value of param to value
  • “SET param index value” - request to set the value of param[index] to value.
steereo/classes/steerparametercommand.txt · Last modified: 2010/03/22 15:25 (external edit)