void ConsoleLogger::logCallback( U32 level, const char *consoleLine ) { ConsoleLogger *curr; // Loop through active consumers and send them the message for( int i = 0; i < mActiveLoggers.size(); i++ ) { curr = mActiveLoggers[i]; // If the log level is within the log threshhold, log it if( curr->mLevel <= level ) curr->log( consoleLine ); } }
int main(int argc, char **argv) { printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); string robotFile = SRCDIR"/../manipulators/katana.robot.xml"; ConsoleLogger* cl = new ConsoleLogger(); OpenRaveRobotPtr robot( new OpenRaveRobot(cl) ); OpenRaveEnvironmentPtr env( new OpenRaveEnvironment(cl) ); vector<OpenRAVE::RobotBasePtr> robots; list<OpenRAVE::ModuleBasePtr> modules; env->create(); env->get_env_ptr()->GetModules(modules); env->get_env_ptr()->GetRobots(robots); cl->log_debug("qa_modules", "Environment created"); cl->log_debug("qa_modules", "#modules:%u #robots:%u", modules.size(), robots.size()); try { robot->load(robotFile, env); } catch (Exception &e) { cl->log_error("qa_modules", "error:%s", e.what()); return 0; } env->get_env_ptr()->GetModules(modules); env->get_env_ptr()->GetRobots(robots); cl->log_debug("qa_modules", "Robot loaded"); cl->log_debug("qa_modules", "#modules:%u #robots:%u", modules.size(), robots.size()); env->add_robot(robot); robot->set_ready(); env->get_env_ptr()->GetModules(modules); env->get_env_ptr()->GetRobots(robots); cl->log_debug("qa_modules", "Robot initialized"); cl->log_debug("qa_modules", "#modules:%u #robots:%u", modules.size(), robots.size()); robot = NULL; env->get_env_ptr()->GetModules(modules); env->get_env_ptr()->GetRobots(robots); cl->log_debug("qa_modules", "Robot Destroyed"); cl->log_debug("qa_modules", "#modules:%u #robots:%u", modules.size(), robots.size()); env->destroy(); return 0; }
int main(int argc, char **argv) { printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); string robotFile = SRCDIR"/../manipulators/katana.robot.xml"; ConsoleLogger* cl = new ConsoleLogger(); OpenRaveManipulator* manip = new OpenRaveManipulatorKatana6M180(6, 5); OpenRaveRobot* robot = new OpenRaveRobot(cl); OpenRaveEnvironment* env = new OpenRaveEnvironment(cl); env->create(); try { robot->load(robotFile, env); } catch (Exception &e) { cl->log_error("qa_robot", "error:%s", e.what()); return 0; } // configure manip manip->add_motor(0,0); manip->add_motor(1,1); manip->add_motor(2,2); manip->add_motor(4,3); manip->add_motor(5,4); robot->set_manipulator(manip); env->add_robot(robot); robot->set_ready(); env->lock(); vector<float> val, v; val.push_back(0.1); val.push_back(0.2); val.push_back(0.3); val.push_back(0.4); val.push_back(0.5); manip->set_angles_device(val); manip->get_angles(v); printVector(v); manip->get_angles_device(v); printVector(v); env->start_viewer(); //print angles taken from OpenRAVE Model (can be modified in GUI) while(1) { robot->update_manipulator(); manip->get_angles(v); printVector(v); manip->get_angles_device(v); printVector(v); usleep(1000*500); } env->destroy(); return 0; }
void ServerPipeline::sendMsgToLogger(const Message *msg) { ConsoleLogger logger; logger.WARN("ServerPipeline sendMsgToLogger","sendMsgToLogger is running...\n"); }