Beispiel #1
0
void GLscene::updateScene()
{
    if (m_log->index()<0) return;

    LogManager<OpenHRP::SceneState> *lm 
        = (LogManager<OpenHRP::SceneState> *)m_log;
    OpenHRP::SceneState &ss = lm->state();
    for (unsigned int i=0; i<ss.states.length(); i++){
        OpenHRP::RobotState &rs = ss.states[i];
        GLbody *glbody = dynamic_cast<GLbody *>(body(i).get());
        glbody->setPosition(rs.basePose.position.x,
                            rs.basePose.position.y,
                            rs.basePose.position.z);
        glbody->setRotation(rs.basePose.orientation.r,
                            rs.basePose.orientation.p,
                            rs.basePose.orientation.y);
        glbody->setPosture(rs.q.get_buffer());
    }
}
Beispiel #2
0
void GLscene::updateScene()
{ 
    if (m_log->index()<0) return;

    LogManager<SceneState> *lm 
        = (LogManager<SceneState> *)m_log;
    SceneState &state = lm->state();
    
    for (unsigned int i=0; i<state.bodyStates.size(); i++){
        const BodyState& bstate = state.bodyStates[i];
        GLbody *glbody = dynamic_cast<GLbody *>(body(i).get());
        glbody->setPosture(bstate.q, bstate.p, bstate.R);
        if (m_showSensors){
            glbody->setSensorDrawCallback(
                boost::bind(&GLscene::drawSensorOutput, this, _1, _2));
        }else{
            glbody->setSensorDrawCallback(NULL);
        }
    }
}