Beispiel #1
0
void RemoteKinematics::GetHeadMethod::execute(xmlrpc_c::paramList const& paramList, xmlrpc_c::value* const resultP) {
    paramList.verifyEnd(1);
    bool top_camera = paramList.getBoolean(0);
    SensorData<double>::Ptr data;
    data = this->m_kinematics->getHeadPosition(top_camera);

    xmlrpc_env env;
    xmlrpc_env_init(&env);

    xmlrpc_value* elem;
    xmlrpc_value* values;
    xmlrpc_value* result;

    values = xmlrpc_array_new(&env);
    for (int i = 0; i < data->data.size(); ++i) {
        elem = xmlrpc_double_new(&env, data->data[i]);
        xmlrpc_array_append_item(&env, values, elem);
        xmlrpc_DECREF(elem);
    }

    elem = xmlrpc_double_new(&env, data->timestamp);
    // Create result struct
    result = xmlrpc_struct_new(&env);
    xmlrpc_struct_set_value(&env, result, "data", values);
    xmlrpc_struct_set_value(&env, result, "timestamp", elem);
    // Apply result
    resultP->instantiate(result);
    // Clean this shit!
    xmlrpc_DECREF(elem);
    xmlrpc_DECREF(values);
    xmlrpc_DECREF(result);
    xmlrpc_env_clean(&env);
}
Beispiel #2
0
void RemoteKinematics::LookAtMethod::execute(xmlrpc_c::paramList const& paramList, xmlrpc_c::value* const resultP) {
    paramList.verifyEnd(4);
    double x = paramList.getDouble(0);
    double y = paramList.getDouble(1);
    double z = paramList.getDouble(2);
    bool top_camera = paramList.getBoolean(3);
    this->m_kinematics->lookAt(x, y, z, top_camera);
    *resultP = value_nil();
}
Beispiel #3
0
    void
    execute(const xmlrpc_c::paramList & paramList, xmlrpc_c::value* retvalP) {
        // Get the requested mode
        bool const hvRequested(paramList.getBoolean(0));
        paramList.verifyEnd(1);

        TheTransmitControl->setHvRequested(hvRequested);
        *retvalP = xmlrpc_c::value_nil();
    }
Beispiel #4
0
void RemoteKinematics::JointsLookAtMethodLookAtMethod::execute(xmlrpc_c::paramList const& paramList,
                                                               xmlrpc_c::value* const resultP) {
    paramList.verifyEnd(4);
    double x = paramList.getDouble(0);
    double y = paramList.getDouble(1);
    double z = paramList.getDouble(2);
    bool top_camera = paramList.getBoolean(3);
    ValuesVectorPtr data = this->m_kinematics->jointsLookAt(x, y, z, top_camera);

    xmlrpc_env env;
    xmlrpc_env_init(&env);
    xmlrpc_value* elem;
    xmlrpc_value* values;
    values = xmlrpc_array_new(&env);
    for (int i = 0; i < data->size(); ++i) {
        elem = xmlrpc_double_new(&env, data->at(i));
        xmlrpc_array_append_item(&env, values, elem);
        xmlrpc_DECREF(elem);
    }
    resultP->instantiate(values);
    // Clean this shit!
    xmlrpc_DECREF(values);
    xmlrpc_env_clean(&env);
}