⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 examplemodel.cc

📁 机器人人3D仿真工具,可以加入到Simbad仿真环境下应用。
💻 CC
字号:
/* *  Gazebo - Outdoor Multi-Robot Simulator *  Copyright (C) 2003   *     Nate Koenig & Andrew Howard * *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; either version 2 of the License, or *  (at your option) any later version. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * *//* * Desc: Factory for creating models * Author: Andrew Howard * Date: 14 Jul 2004 * CVS info: $Id: ExampleModel.cc,v 1.5 2004/11/16 19:22:53 inspectorg Exp $ */#include <unistd.h>#include <string.h>#include <stdio.h>#include <gazebo/BoxGeom.hh>#include <gazebo/ModelFactory.hh>#include "ExampleModel.hh"/////////////////////////////////////////////////////////////////////////////// Register the modelGZ_REGISTER_PLUGIN("ExampleModel", ExampleModel)//////////////////////////////////////////////////////////////////////////////// ConstructorExampleModel::ExampleModel( World *world )    : Model( world ){  return;}//////////////////////////////////////////////////////////////////////////////// DestructorExampleModel::~ExampleModel(){  return;}//////////////////////////////////////////////////////////////////////////////// Load the sensorint ExampleModel::Load( WorldFile *file, WorldFileNode *node ){  Geom *geom;    // Create the canonical body  this->tma = new Body( this->world );  this->AddBody( this->tma, true );    // Create a simple box  geom = new BoxGeom( this->tma, this->modelSpaceId, 1, 4, 9 );  geom->SetRelativePosition(GzVectorSet(0, 0, 4.5) );  geom->SetMass( 1 );  geom->SetColor( GzColor(0, 0, 0) );  return 0;}//////////////////////////////////////////////////////////////////////////////// Initialize the sensorint ExampleModel::Init( WorldFile *file, WorldFileNode *node ){  return 0;}//////////////////////////////////////////////////////////////////////////////// Finalize the sensorint ExampleModel::Fini(){  return 0;}//////////////////////////////////////////////////////////////////////////////// Get commands from the external interfacevoid ExampleModel::IfaceGetCmd(){  // Receive commands from external interface  return;}//////////////////////////////////////////////////////////////////////////////// Update external interfacevoid ExampleModel::IfacePutData(){  // Update external interfaces    return;}//////////////////////////////////////////////////////////////////////////////// Update the sensor information; returns non-zero if sensor data has// been updatedvoid ExampleModel::Update( double step ){  // Get commands from the external interface  this->IfaceGetCmd();  // Command any actuators    // Update any sensors  // Update the external interface with the new data  IfacePutData();  return;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -