/*!
    \file
    \brief Beego用 関数群

    $Id: xxxx test_run.h 2011-04-14 12:00:xxx fukuda $
*/

/* 軌跡をgnuplotで表示する関数 */
void plot_pos( FILE *gp )
{
    double x, y, theta;
    Spur_get_pos_GL(&x, &y, &theta);
    fprintf( gp, "set xlabel \"y\"\n" );
    fprintf( gp, "set ylabel \"x\"\n" );
    fprintf( gp, "set xrange [-4.0:1.0]\n" );
    fprintf( gp, "set yrange [0:4.0]\n" );
    fprintf( gp, "plot '-' title \"plot_pos\" w p pt 5\n" );
    fprintf( gp, "%f %f\n", -y, x );
    fprintf( gp, "e\n" );
    fflush( gp );
    usleep( 100000 );
}

/* プログラムを停止させる関数 */
void ctrlC( int aStatus )
{
    Spur_stop( );
    signal( SIGINT, NULL );
    exit( aStatus );
}

/* "Ctrl"+"C"が押された時に，ctrlC関数を呼び出す関数 */
void setSigInt( )
{
    signal( SIGINT, ctrlC );
}
