tutorials/tutsim.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2011 The Board of Trustees of The Leland Stanford Junior University. All rights reserved.
00003  *
00004  * Author: Roland Philippsen
00005  *         http://cs.stanford.edu/group/manips/
00006  *
00007  * This program is free software: you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License
00009  * as published by the Free Software Foundation, either version 3 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this program.  If not, see
00019  * <http://www.gnu.org/licenses/>
00020  */
00021 
00022 #ifndef WBC_TUTORIAL_SIMULATOR_HPP
00023 #define WBC_TUTORIAL_SIMULATOR_HPP
00024 
00025 // The CMake setup "should" set the TUTROB_XML_PATH_STR
00026 // correctly. Otherwise, fall back to a default that will produce
00027 // sensible error messages in case we fail to find the file.
00028 
00029 #ifndef TUTROB_XML_PATH_STR
00030 #define TUTROB_XML_PATH_STR "tutrob.xml"
00031 #endif // TUTROB_XML_PATH_STR
00032 
00033 #include <jspace/Model.hpp>
00034 
00040 struct tutsim {
00041   
00054   static void set_robot_filename(char const * robot_filename);
00055   
00060   static void set_rates(double gfx_rate_hz,
00061       double servo_rate_hz,
00062       double sim_rate_hz);
00063   
00072   static void set_window_params(int width, int height, char const * title);
00073   
00080   static void draw_robot(jspace::Vector const & jpos, int width,
00081        unsigned char red, unsigned char green, unsigned char blue,
00082        double x0, double y0, double scale);
00083   
00088   static void draw_delta_jpos(jspace::Vector const & jpos, int width,
00089             unsigned char red, unsigned char green, unsigned char blue,
00090             double x0, double y0, double scale);
00091   
00105   static void set_draw_cb(void (*draw_cb)(double x0, double y0, double scale));
00106   
00119   static int run(bool (*servo_cb)(size_t toggle_count,
00120           double wall_time_ms,
00121           double sim_time_ms,
00122           jspace::State & state,
00123           jspace::Vector & command));
00124   
00125 };
00126 
00127 #endif // WBC_TUTORIAL_SIMULATOR_HPP

Generated on Fri Aug 26 01:31:18 2011 for Stanford Whole-Body Control Framework by  doxygen 1.5.4