src/walking.cpp
/**
 * @brief Construct and initialize all necessary classes and register 
 * callback function.
 */
@brief Construct and initialize all necessary classes and register
callback function.
@brief Construct and initialize all necessary classes and register callback function .
void oru_walk::walk()
{
    ORUW_LOG_OPEN;
    wp.readParameters();
    readSensors(nao.state_sensor);
    try
    {
        boost::thread walk_control_thread(&oru_walk::walkControl, this);
        struct sched_param walk_control_thread_sched;
        walk_control_thread_sched.sched_priority = wp.walk_control_thread_priority;
        int retval = pthread_setschedparam(
                walk_control_thread.native_handle(), 
                SCHED_FIFO, 
                &walk_control_thread_sched);
        if (retval != 0)
        {
            ORUW_LOG_MESSAGE("Cannot change the priority of the walk control thread: %s\n", strerror(retval));
        }
        walk_control_thread.detach();
    }
    catch (...)
    {
        halt("Failed to spawn the walk control thread.\n", __FUNCTION__);
    }
    dcm_loop_counter = 0;
    try
    {
        dcm_callback_connection =
            getParentBroker()->getProxy("DCM")->getModule()->atPostProcess
            (boost::bind(&oru_walk::dcmCallback, this));
    }
    catch (const ALError &e)
    {
        ORUW_LOG_MESSAGE("Callback registration failed: %s\n", e.what());
        halt("Callback registration failed!", __FUNCTION__);
    }
}
void oru_walk :: walk ( ) { ORUW_LOG_OPEN ; wp . readParameters ( ) ; readSensors ( nao . state_sensor ) ; try { boost :: thread walk_control_thread ( & oru_walk :: walkControl , this ) ; struct sched_param walk_control_thread_sched ; walk_control_thread_sched . sched_priority = wp . walk_control_thread_priority ; int retval = pthread_setschedparam ( walk_control_thread . native_handle ( ) , SCHED_FIFO , & walk_control_thread_sched ) ; if ( retval != 0 ) { ORUW_LOG_MESSAGE ( " \n " , strerror ( retval ) ) ; } walk_control_thread . detach ( ) ; } catch ( ... ) { halt ( " \n " , __FUNCTION__ ) ; } dcm_loop_counter = 0 ; try { dcm_callback_connection = getParentBroker ( ) -> getProxy ( " " ) -> getModule ( ) -> atPostProcess ( boost :: bind ( & oru_walk :: dcmCallback , this ) ) ; } catch ( const ALError & e ) { ORUW_LOG_MESSAGE ( " \n " , e . what ( ) ) ; halt ( " " , __FUNCTION__ ) ; } }
@brief Construct and initialize all necessary classes and register
 callback function.
@brief Construct and initialize all necessary classes and register callback function .
// initialize Nao model // start walk control thread // Assume that this error is not critical // register callback