VrmlWriter.cpp
Go to the documentation of this file.
00001 #include <hrpUtil/Eigen3d.h>
00002 #include "VrmlWriter.h"
00003 #include <fstream>
00004 
00005 using namespace hrp;
00006 using namespace OpenHRP;
00007 
00008 void VrmlWriter::write(OpenHRP::BodyInfo_var binfo, std::ostream &ofs)
00009 {
00010     m_indent = 0;
00011     writeProtoNodes(ofs);
00012     writeHumanoidNode(binfo, ofs);
00013 }
00014 
00015 void VrmlWriter::indent(std::ostream &ofs)
00016 {
00017     for (int i=0; i<m_indent; i++) ofs << " ";
00018 }
00019 
00020 void VrmlWriter::useInlineShape(bool use_inline)
00021 {
00022     m_use_inline_shape = use_inline;
00023 }
00024 
00025 void VrmlWriter::writeLink(int index, std::ostream &ofs)
00026 {
00027     LinkInfo &linfo = links[index];
00028     indent(ofs); ofs << "DEF " << linfo.name << " Joint {" << std::endl;
00029     m_indent += 2;
00030     if (linfo.translation[0] || linfo.translation[1] || linfo.translation[2]){
00031         indent(ofs); ofs << "translation " << linfo.translation[0] << " " 
00032                          << linfo.translation[1] << " " << linfo.translation[2]
00033                          << std::endl;
00034     }
00035     if (linfo.rotation[3]){
00036         indent(ofs); ofs << "rotation " << linfo.rotation[0] << " " 
00037                          << linfo.rotation[1] << " " << linfo.rotation[2] 
00038                          << " " << linfo.rotation[3] << std::endl;
00039     }
00040     if (linfo.jointId != -1){
00041         indent(ofs); ofs << "jointId " << linfo.jointId << std::endl;
00042     }
00043     indent(ofs); ofs << "jointType \"" << linfo.jointType << "\"" << std::endl;
00044     indent(ofs); ofs << "jointAxis " << linfo.jointAxis[0] << " " 
00045                      << linfo.jointAxis[1] << " " << linfo.jointAxis[2]
00046                      << std::endl;
00047     if (linfo.ulimit.length()){
00048         indent(ofs); ofs << "ulimit " << linfo.ulimit[0] << std::endl;
00049     }
00050     if (linfo.llimit.length()){
00051         indent(ofs); ofs << "llimit " << linfo.llimit[0] << std::endl;
00052     }
00053     if (linfo.uvlimit.length()){
00054         indent(ofs); ofs << "uvlimit " << linfo.uvlimit[0] << std::endl;
00055     }
00056     if (linfo.lvlimit.length()){
00057         indent(ofs); ofs << "lvlimit " << linfo.lvlimit[0] << std::endl;
00058     }
00059     if (linfo.gearRatio != 1){
00060         indent(ofs); ofs << "gearRatio " << linfo.gearRatio << std::endl;
00061     }
00062     if (linfo.rotorInertia){
00063         indent(ofs); ofs << "rotorInertia " << linfo.rotorInertia << std::endl;
00064     }
00065     if (linfo.rotorResistor){
00066         indent(ofs); ofs << "rotorResistor " << linfo.rotorResistor << std::endl;
00067     }
00068     if (linfo.torqueConst != 1){
00069         indent(ofs); ofs << "torqueConst " << linfo.torqueConst << std::endl;
00070     }
00071     if (linfo.encoderPulse != 1){
00072         indent(ofs); ofs << "encoderPulse " << linfo.encoderPulse << std::endl;
00073     }
00074     indent(ofs); ofs << "children [" << std::endl;
00075     m_indent += 2;
00076     if (linfo.segments.length() > 0) {
00077       indent(ofs); ofs << "DEF " << linfo.segments[0].name << " Segment {" << std::endl;
00078     } else {
00079       indent(ofs); ofs << "DEF " << linfo.name << "_s Segment {" << std::endl;
00080     }
00081     m_indent += 2;
00082     indent(ofs); ofs << "mass " << linfo.mass << std::endl;
00083     indent(ofs); ofs << "centerOfMass " << linfo.centerOfMass[0] << " "
00084                      << linfo.centerOfMass[1] << " "
00085                      << linfo.centerOfMass[2] << std::endl;
00086     indent(ofs); ofs << "momentsOfInertia [";
00087     for (size_t i=0; i<9; i++) ofs << linfo.inertia[i] << " ";
00088     ofs << "]" << std::endl;
00089     indent(ofs); ofs << "children [" << std::endl;
00090     m_indent +=2;
00091     TransformedShapeIndexSequence &tsis = linfo.shapeIndices;
00092     if (m_use_inline_shape) {
00093         std::string fname ( linfo.segments.length() > 0?linfo.segments[0].name:linfo.name );
00094         fname += ".wrl";
00095         indent(ofs); ofs << "Inline { url \"" << fname << "\" }" << std::endl;
00096         std::ofstream sofs(fname.c_str());
00097         for (size_t i=0; i<tsis.length(); i++){
00098             writeShape(tsis[i], sofs);
00099         }
00100         sofs.close();
00101     } else {
00102         for (size_t i=0; i<tsis.length(); i++){
00103             writeShape(tsis[i], ofs);
00104         }
00105     }
00106     for (size_t i=0; i<linfo.sensors.length(); i++){
00107         SensorInfo &si = linfo.sensors[i];
00108         std::string type = (const char *)si.type;
00109         indent(ofs); ofs << "DEF " << si.name <<  " ";
00110         if (type == "Force"){
00111             ofs << "ForceSensor{" << std::endl;
00112         }else if (type == "RateGyro"){
00113             ofs << "Gyro{" << std::endl;
00114         }else if (type == "Acceleration"){
00115             ofs << "AccelerationSensor{" << std::endl;
00116         }else if (type == "Vision"){
00117             ofs << "VisionSensor{" << std::endl;
00118         }else if (type == "Range"){
00119             ofs << "RangeSensor{" << std::endl;
00120         }else{
00121             std::cerr << "unknown sensor type(" << type << ")" << std::endl;
00122         }
00123         m_indent += 2;
00124         indent(ofs); ofs << "translation " << si.translation[0] << " " 
00125                          << si.translation[1] << " " << si.translation[2]
00126                          << std::endl;
00127         indent(ofs); ofs << "rotation " << si.rotation[0] << " " 
00128                          << si.rotation[1] << " " << si.rotation[2] << " "
00129                          << si.rotation[3] << std::endl;
00130         indent(ofs); ofs << "sensorId " << si.id << std::endl;
00131         if (si.shapeIndices.length()){
00132             indent(ofs); ofs << "children[" << std::endl;
00133             m_indent += 2;
00134             if (m_use_inline_shape) {
00135                 std::string fname (si.name);
00136                 fname += ".wrl";
00137                 indent(ofs); ofs << "inline {url \"" << fname << "\" }" << std::endl;
00138                 std::ofstream sofs( fname.c_str() );
00139                 for (size_t j=0; j<si.shapeIndices.length(); j++){
00140                     writeShape(si.shapeIndices[j], sofs);
00141                 }
00142                 sofs.close();
00143             } else {
00144                 for (size_t j=0; j<si.shapeIndices.length(); j++){
00145                     writeShape(si.shapeIndices[j], ofs);
00146                 }
00147             }
00148             m_indent -= 2;
00149             indent(ofs); ofs << "]" << std::endl;
00150         }
00151         m_indent -= 2;
00152         indent(ofs); ofs << "} #Sensor" << std::endl;
00153     }
00154     m_indent -=2;
00155     indent(ofs); ofs << "]" << std::endl;
00156     m_indent -= 2;
00157     if (linfo.segments.length() > 0) {
00158       indent(ofs); ofs << "} #Segment " << linfo.segments[0].name  << std::endl;
00159     } else {
00160       indent(ofs); ofs << "} #Segment " << linfo.name << "_s" << std::endl;
00161     }
00162     for (size_t i=0; i<linfo.childIndices.length(); i++){
00163         writeLink(linfo.childIndices[i], ofs);
00164     }
00165     m_indent -= 2;
00166     indent(ofs); ofs << "]" << std::endl;
00167     m_indent -= 2;
00168     indent(ofs); ofs << "} #Joint " << linfo.name << std::endl;
00169 }
00170 
00171 void VrmlWriter::writeShape(TransformedShapeIndex &tsi, std::ostream &ofs)
00172 {
00173     indent(ofs); ofs << "Transform {" << std::endl;
00174     m_indent += 2;
00175     if (tsi.transformMatrix[3] || tsi.transformMatrix[7] || tsi.transformMatrix[11]){
00176         indent(ofs); ofs << "translation " << tsi.transformMatrix[3] << " "
00177                          << tsi.transformMatrix[7] << " "
00178                          << tsi.transformMatrix[11] << " " << std::endl;
00179     }
00180     Vector3 xaxis, yaxis, zaxis;
00181     xaxis << tsi.transformMatrix[0],tsi.transformMatrix[4],tsi.transformMatrix[8];
00182     yaxis << tsi.transformMatrix[1],tsi.transformMatrix[5],tsi.transformMatrix[9];
00183     zaxis << tsi.transformMatrix[2],tsi.transformMatrix[6],tsi.transformMatrix[10];
00184     indent(ofs); ofs << "scale " << xaxis.norm() << " " <<  yaxis.norm() << " " << zaxis.norm() << std::endl;
00185     xaxis.normalize(); 
00186     yaxis.normalize(); 
00187     zaxis.normalize(); 
00188     Matrix33 R;
00189     R << xaxis[0], yaxis[0], zaxis[0],
00190         xaxis[1], yaxis[1], zaxis[1],
00191         xaxis[2], yaxis[2], zaxis[2];
00192     Vector3 omega = omegaFromRot(R);
00193     double th = omega.norm();
00194     Vector3 axis = omega/th;
00195     if (th){
00196         indent(ofs); ofs << "rotation " << axis[0] << " " << axis[1] << " "
00197                          << axis[2] << " " << th << std::endl;
00198     }
00199     indent(ofs); ofs << "children [" << std::endl;
00200     m_indent += 2;
00201     indent(ofs); ofs << "Shape {" << std::endl;
00202     m_indent += 2;
00203     ShapeInfo &si = shapes[tsi.shapeIndex];
00204     AppearanceInfo &app = appearances[si.appearanceIndex];
00205     switch(si.primitiveType){
00206     case SP_MESH:
00207         indent(ofs); ofs << "geometry IndexedFaceSet{" << std::endl;
00208         m_indent += 2;
00209         indent(ofs); ofs << "coord Coordinate{" << std::endl;
00210         m_indent += 2;
00211         indent(ofs); ofs << "point[" << std::endl;
00212         for (size_t i=0; i<si.vertices.length()/3; i++){
00213             indent(ofs); ofs << "  " << si.vertices[i*3] << " "
00214                              << si.vertices[i*3+1] << " " << si.vertices[i*3+2]
00215                              << std::endl;
00216         }
00217         indent(ofs); ofs << "]" << std::endl;
00218         m_indent -= 2;
00219         indent(ofs); ofs << "} #Coordinates" << std::endl;
00220         indent(ofs); ofs << "coordIndex [" << std::endl;
00221         for (size_t i=0; i<si.triangles.length()/3; i++){
00222             indent(ofs); ofs << "  " << si.triangles[i*3] << "," 
00223                              << si.triangles[i*3+1] << "," 
00224                              << si.triangles[i*3+2] << ", -1," << std::endl;
00225         }
00226         indent(ofs); ofs << "]" << std::endl;
00227         indent(ofs); ofs << "normal Normal{" << std::endl;
00228         m_indent += 2;
00229         indent(ofs); ofs << "vector [" << std::endl;
00230         for (size_t i=0; i<app.normals.length()/3; i++){
00231             indent(ofs); ofs << "  " << app.normals[i*3] << " " 
00232                              << app.normals[i*3+1] << " " << app.normals[i*3+2]
00233                              << "," << std::endl;
00234         }
00235         indent(ofs); ofs << "]" << std::endl;
00236         m_indent -= 2;
00237         indent(ofs); ofs << "} #Normal" << std::endl;
00238         indent(ofs); ofs << "normalIndex [" << std::endl;
00239         for (size_t i=0; i< app.normalIndices.length()/3; i++){
00240             indent(ofs); ofs << "  " << app.normalIndices[i*3] << ","
00241                              << app.normalIndices[i*3+1] << ","
00242                              << app.normalIndices[i*3+2] << ", -1," 
00243                              << std::endl;
00244         }
00245         indent(ofs); ofs << "]" << std::endl;
00246         indent(ofs); ofs << "normalPerVertex " << (app.normalPerVertex ? "TRUE" : "FALSE") << std::endl;
00247         indent(ofs); ofs << "solid " << (app.solid ? "TRUE" : "FALSE") << std::endl;
00248         if (app.creaseAngle){
00249             indent(ofs); ofs << "creaseAngle " << app.creaseAngle << std::endl;
00250         }
00251         if (app.colors.length()){
00252             indent(ofs); ofs << "color Color{" << std::endl;
00253             indent(ofs); ofs << "  color " << app.colors[0] << " " << app.colors[1] << " " << app.colors[2] << std::endl;;
00254             indent(ofs); ofs << "}" << std::endl;
00255         }
00256         if (app.colorIndices.length()){
00257             indent(ofs); ofs << "colorIndex [" << std::endl;
00258             m_indent += 2;
00259             for (size_t j=0; j<app.colorIndices.length(); j++){
00260                 ofs << app.colorIndices[j] << ","; 
00261             }
00262             ofs << std::endl;
00263             m_indent -= 2;
00264             indent(ofs); ofs << "]" << std::endl;
00265         }
00266         indent(ofs); ofs << "colorPerVertex " << (app.colorPerVertex ? "TRUE" : "FALSE") << std::endl;
00267         if (app.textureCoordinate.length()){
00268             indent(ofs); ofs << "texCoord TextureCoordinate {" << std::endl;
00269             m_indent += 2;
00270             indent(ofs); ofs <<"point [" << std::endl;
00271             m_indent += 2;
00272             for (size_t j=0; j<app.textureCoordinate.length()/2; j++){
00273                 indent(ofs); ofs << app.textureCoordinate[j*2] << " "
00274                                  << app.textureCoordinate[j*2+1] << ","
00275                                  << std::endl;
00276             }
00277             m_indent -= 2;
00278             indent(ofs); ofs << "]" << std::endl;
00279             m_indent -= 2;
00280             indent(ofs); ofs << "}" << std::endl;
00281         }
00282         if (app.textureCoordIndices.length()){
00283             indent(ofs); ofs << "texCoordIndex [" << std::endl;
00284             m_indent += 2;
00285             for (size_t j=0; j<app.textureCoordIndices.length()/3; j++){
00286                 indent(ofs); ofs << app.textureCoordIndices[j*3] << ","
00287                                  << app.textureCoordIndices[j*3+1] << ","
00288                                  << app.textureCoordIndices[j*3+2] << ",-1," << std::endl;
00289                 
00290             }
00291             m_indent -= 2;
00292             indent(ofs); ofs << "]" << std::endl;
00293         }
00294         //
00295         m_indent -= 2;
00296         indent(ofs); ofs << "} #IndexedFaceSet"  << std::endl;
00297         break;
00298     case SP_BOX:
00299         indent(ofs); ofs << "geometry Box{" << std::endl;
00300         indent(ofs); ofs << "  size " << si.primitiveParameters[0] << " "
00301                          << si.primitiveParameters[1] << " " 
00302                          << si.primitiveParameters[2] << std::endl;
00303         indent(ofs); ofs << "}" << std::endl;
00304         break;
00305     case SP_CYLINDER:
00306         indent(ofs); ofs << "geometry Cylinder{" << std::endl;
00307         indent(ofs); ofs << "  radius " << si.primitiveParameters[0] << std::endl;
00308         indent(ofs); ofs << "  height " << si.primitiveParameters[1] << std::endl;
00309         indent(ofs); ofs << "  top " << (si.primitiveParameters[2] ? "TRUE" : "FALSE") << std::endl;
00310         indent(ofs); ofs << "  bottom " << (si.primitiveParameters[3] ? "TRUE" : "FALSE") << std::endl;
00311         indent(ofs); ofs << "  side " << (si.primitiveParameters[4] ? "TRUE" : "FALSE") << std::endl;
00312         indent(ofs); ofs << "}" << std::endl;
00313         break;
00314     case SP_CONE:
00315         indent(ofs); ofs << "geometry Cone {" << std::endl;
00316         indent(ofs); ofs << "  bottomRadius " << si.primitiveParameters[0] << std::endl;
00317         indent(ofs); ofs << "  height " << si.primitiveParameters[1] << std::endl;
00318         indent(ofs); ofs << "  bottom " << (si.primitiveParameters[2] ? "TRUE" : "FALSE") << std::endl;
00319         indent(ofs); ofs << "  side " << (si.primitiveParameters[3] ? "TRUE" : "FALSE") << std::endl;
00320         indent(ofs); ofs << "}" << std::endl;
00321         break;
00322     case SP_SPHERE:
00323         indent(ofs); ofs << "geometry Sphere {" << std::endl;
00324         indent(ofs); ofs << "  radius " << si.primitiveParameters[0] << std::endl;
00325         indent(ofs); ofs << "}" << std::endl;
00326         break;
00327     case SP_PLANE:
00328         indent(ofs); ofs << "geometry Plane{" << std::endl;
00329         indent(ofs); ofs << "  size " << si.primitiveParameters[0] << " "
00330                          << si.primitiveParameters[1] << " " 
00331                          << si.primitiveParameters[2] << std::endl;
00332         indent(ofs); ofs << "}" << std::endl;
00333         break;
00334     default:
00335         std::cerr << "unknown primitive type:" << si.primitiveType << std::endl;
00336     }
00337     if (app.materialIndex >= 0){
00338         MaterialInfo &mat = materials[app.materialIndex];
00339         indent(ofs); ofs << "appearance Appearance{" << std::endl;
00340         m_indent += 2;
00341         indent(ofs); ofs << "material Material{" << std::endl;
00342         m_indent += 2;
00343         indent(ofs); ofs << "ambientIntensity " << mat.ambientIntensity 
00344                          << std::endl;
00345         indent(ofs); ofs << "diffuseColor " << mat.diffuseColor[0] << " "
00346                          << mat.diffuseColor[1] << " " << mat.diffuseColor[2] 
00347                          << std::endl;
00348         indent(ofs); ofs << "emissiveColor " << mat.emissiveColor[0] << " "
00349                          << mat.emissiveColor[1] << " " 
00350                          << mat.emissiveColor[2] << std::endl;
00351         indent(ofs); ofs << "shininess " << mat.shininess << std::endl;
00352         indent(ofs); ofs << "specularColor " << mat.specularColor[0] << " "
00353                          << mat.specularColor[1] << " " 
00354                          << mat.specularColor[2] << std::endl;
00355         indent(ofs); ofs << "transparency " << mat.transparency << std::endl;
00356         m_indent -= 2;
00357         indent(ofs); ofs << "} #Material" << std::endl;
00358         if (app.textureIndex >= 0){
00359             TextureInfo &ti = textures[app.textureIndex];
00360             indent(ofs); ofs << "texture ImageTexture{" << std::endl;
00361             indent(ofs); ofs << "  repeatS " << (ti.repeatS ? "TRUE" : "FALSE")
00362                              << std::endl;
00363             indent(ofs); ofs << "  repeatT " << (ti.repeatT ? "TRUE" : "FALSE")
00364                              << std::endl;
00365             indent(ofs); ofs << "  url \"" << ti.url << "\"" << std::endl;
00366             indent(ofs); ofs << "}" << std::endl;
00367             indent(ofs); ofs << "textureTransform TextureTransform{" << std::endl;
00368             m_indent += 2;
00369             // TODO:textransformMatrix
00370             m_indent -= 2;
00371             indent(ofs); ofs << "}" << std::endl;
00372         }
00373         //
00374         m_indent -= 2;
00375         indent(ofs); ofs << "} #Appearance" << std::endl;
00376     }
00377     m_indent -= 2;
00378     indent(ofs); ofs << "} #Shape" << std::endl;
00379     m_indent -= 2;
00380     indent(ofs); ofs << "]" << std::endl;
00381     m_indent -= 2;
00382     indent(ofs); ofs << "} #Transform" << std::endl;
00383 }
00384 void VrmlWriter::writeHumanoidNode(OpenHRP::BodyInfo_var binfo, 
00385                                    std::ostream &ofs)
00386 {
00387     ofs << "DEF " << binfo->name() << " Humanoid {" << std::endl;
00388     ofs << "  humanoidBody [" << std::endl;
00389     links = binfo->links();
00390     shapes = binfo->shapes();
00391     appearances = binfo->appearances();
00392     materials = binfo->materials();
00393     textures = binfo->textures();
00394     m_indent = 4;
00395     writeLink(0, ofs);
00396     ofs << "  ]" << std::endl;
00397     ofs << "  joints [" << std::endl;
00398     for (size_t i=0; i<links->length(); i++){
00399         ofs << "    USE " << links[i].name << "," << std::endl;
00400     }
00401     ofs << "  ]" << std::endl;
00402     ofs << "  segments [" << std::endl;
00403     for (size_t i=0; i<links->length(); i++){
00404         if (links[i].segments.length() > 0) {
00405           ofs << "    USE " << links[i].segments[0].name << "," << std::endl;
00406         } else {
00407           ofs << "    USE " << links[i].name << "_s," << std::endl;
00408         }
00409     }
00410     ofs << "  ]" << std::endl;
00411     ofs << "  name \"" << binfo->name() << "\"" << std::endl;
00412     ofs << "  info [" << std::endl;
00413     StringSequence_var info = binfo->info();
00414     for (size_t i=0; i<info->length(); i++){
00415         ofs << "    \"" << info[i] << "\"" << std::endl;
00416     }
00417     ofs << "  ]" << std::endl;
00418     ofs << "}" << std::endl;
00419 }
00420 
00421 void VrmlWriter::writeProtoNodes(std::ostream &ofs)
00422 {
00423     ofs << "#VRML V2.0 utf8" << std::endl;
00424     ofs << "" << std::endl;
00425     ofs << "PROTO Joint [" << std::endl;
00426     ofs << "  exposedField     SFVec3f      center              0 0 0" << std::endl;
00427     ofs << "  exposedField     MFNode       children            []" << std::endl;
00428     ofs << "  exposedField     MFFloat      llimit              []" << std::endl;
00429     ofs << "  exposedField     MFFloat      lvlimit             []" << std::endl;
00430     ofs << "  exposedField     SFRotation   limitOrientation    0 0 1 0" << std::endl;
00431     ofs << "  exposedField     SFString     name                \"\"" << std::endl;
00432     ofs << "  exposedField     SFRotation   rotation            0 0 1 0" << std::endl;
00433     ofs << "  exposedField     SFVec3f      scale               1 1 1" << std::endl;
00434     ofs << "  exposedField     SFRotation   scaleOrientation    0 0 1 0" << std::endl;
00435     ofs << "  exposedField     MFFloat      stiffness           [ 0 0 0 ]" << std::endl;
00436     ofs << "  exposedField     SFVec3f      translation         0 0 0" << std::endl;
00437     ofs << "  exposedField     MFFloat      ulimit              []" << std::endl;
00438     ofs << "  exposedField     MFFloat      uvlimit             []" << std::endl;
00439     ofs << "  exposedField     SFString     jointType           \"\"" << std::endl;
00440     ofs << "  exposedField     SFInt32      jointId             -1" << std::endl;
00441     ofs << "  exposedField     SFVec3f      jointAxis           0 0 1" << std::endl;
00442     ofs << "" << std::endl;
00443     ofs << "  exposedField     SFFloat      gearRatio           1" << std::endl;
00444     ofs << "  exposedField     SFFloat      rotorInertia        0" << std::endl;
00445     ofs << "  exposedField     SFFloat      rotorResistor       0" << std::endl;
00446     ofs << "  exposedField     SFFloat      torqueConst         1" << std::endl;
00447     ofs << "  exposedField     SFFloat      encoderPulse        1" << std::endl;
00448     ofs << "]" << std::endl;
00449     ofs << "{" << std::endl;
00450     ofs << "  Transform {" << std::endl;
00451     ofs << "    center           IS center" << std::endl;
00452     ofs << "    children         IS children" << std::endl;
00453     ofs << "    rotation         IS rotation" << std::endl;
00454     ofs << "    scale            IS scale" << std::endl;
00455     ofs << "    scaleOrientation IS scaleOrientation" << std::endl;
00456     ofs << "    translation      IS translation" << std::endl;
00457     ofs << "  }" << std::endl;
00458     ofs << "}" << std::endl;
00459     ofs << "" << std::endl;
00460     ofs << "PROTO Segment [" << std::endl;
00461     ofs << "  field           SFVec3f     bboxCenter        0 0 0" << std::endl;
00462     ofs << "  field           SFVec3f     bboxSize          -1 -1 -1" << std::endl;
00463     ofs << "  exposedField    SFVec3f     centerOfMass      0 0 0" << std::endl;
00464     ofs << "  exposedField    MFNode      children          [ ]" << std::endl;
00465     ofs << "  exposedField    SFNode      coord             NULL" << std::endl;
00466     ofs << "  exposedField    MFNode      displacers        [ ]" << std::endl;
00467     ofs << "  exposedField    SFFloat     mass              0 " << std::endl;
00468     ofs << "  exposedField    MFFloat     momentsOfInertia  [ 0 0 0 0 0 0 0 0 0 ]" << std::endl;
00469     ofs << "  exposedField    SFString    name              \"\"" << std::endl;
00470     ofs << "  eventIn         MFNode      addChildren" << std::endl;
00471     ofs << "  eventIn         MFNode      removeChildren" << std::endl;
00472     ofs << "]" << std::endl;
00473     ofs << "{" << std::endl;
00474     ofs << "  Group {" << std::endl;
00475     ofs << "    addChildren    IS addChildren" << std::endl;
00476     ofs << "    bboxCenter     IS bboxCenter" << std::endl;
00477     ofs << "    bboxSize       IS bboxSize" << std::endl;
00478     ofs << "    children       IS children" << std::endl;
00479     ofs << "    removeChildren IS removeChildren" << std::endl;
00480     ofs << "  }" << std::endl;
00481     ofs << "}" << std::endl;
00482     ofs << "" << std::endl;
00483     ofs << "PROTO Humanoid [" << std::endl;
00484     ofs << "  field           SFVec3f    bboxCenter            0 0 0" << std::endl;
00485     ofs << "  field           SFVec3f    bboxSize              -1 -1 -1" << std::endl;
00486     ofs << "  exposedField    SFVec3f    center                0 0 0" << std::endl;
00487     ofs << "  exposedField    MFNode     humanoidBody          [ ]" << std::endl;
00488     ofs << "  exposedField    MFString   info                  [ ]" << std::endl;
00489     ofs << "  exposedField    MFNode     joints                [ ]" << std::endl;
00490     ofs << "  exposedField    SFString   name                  \"\"" << std::endl;
00491     ofs << "  exposedField    SFRotation rotation              0 0 1 0" << std::endl;
00492     ofs << "  exposedField    SFVec3f    scale                 1 1 1" << std::endl;
00493     ofs << "  exposedField    SFRotation scaleOrientation      0 0 1 0" << std::endl;
00494     ofs << "  exposedField    MFNode     segments              [ ]" << std::endl;
00495     ofs << "  exposedField    MFNode     sites                 [ ]" << std::endl;
00496     ofs << "  exposedField    SFVec3f    translation           0 0 0" << std::endl;
00497     ofs << "  exposedField    SFString   version               \"1.1\"" << std::endl;
00498     ofs << "  exposedField    MFNode     viewpoints            [ ]" << std::endl;
00499     ofs << "]" << std::endl;
00500     ofs << "{" << std::endl;
00501     ofs << "  Transform {" << std::endl;
00502     ofs << "    bboxCenter       IS bboxCenter" << std::endl;
00503     ofs << "    bboxSize         IS bboxSize" << std::endl;
00504     ofs << "    center           IS center" << std::endl;
00505     ofs << "    rotation         IS rotation" << std::endl;
00506     ofs << "    scale            IS scale" << std::endl;
00507     ofs << "    scaleOrientation IS scaleOrientation" << std::endl;
00508     ofs << "    translation      IS translation" << std::endl;
00509     ofs << "    children [" << std::endl;
00510     ofs << "      Group {" << std::endl;
00511     ofs << "        children IS viewpoints" << std::endl;
00512     ofs << "      }" << std::endl;
00513     ofs << "      Group {" << std::endl;
00514     ofs << "        children IS humanoidBody " << std::endl;
00515     ofs << "      }" << std::endl;
00516     ofs << "    ]" << std::endl;
00517     ofs << "  }" << std::endl;
00518     ofs << "}" << std::endl;
00519     ofs << "" << std::endl;
00520     ofs << "PROTO VisionSensor [" << std::endl;
00521     ofs << "  exposedField SFVec3f    translation       0 0 0" << std::endl;
00522     ofs << "  exposedField SFRotation rotation          0 0 1 0" << std::endl;
00523     ofs << "  exposedField MFNode     children          [ ]" << std::endl;
00524     ofs << "  exposedField SFFloat    fieldOfView       0.785398" << std::endl;
00525     ofs << "  exposedField SFString   name              \"\"" << std::endl;
00526     ofs << "  exposedField SFFloat    frontClipDistance 0.01" << std::endl;
00527     ofs << "  exposedField SFFloat    backClipDistance  10.0" << std::endl;
00528     ofs << "  exposedField SFString   type              \"NONE\"" << std::endl;
00529     ofs << "  exposedField SFInt32    sensorId          -1" << std::endl;
00530     ofs << "  exposedField SFInt32    width             320" << std::endl;
00531     ofs << "  exposedField SFInt32    height            240" << std::endl;
00532     ofs << "  exposedField SFFloat    frameRate         30" << std::endl;
00533     ofs << "]" << std::endl;
00534     ofs << "{" << std::endl;
00535     ofs << "  Transform {" << std::endl;
00536     ofs << "    rotation         IS rotation" << std::endl;
00537     ofs << "    translation      IS translation" << std::endl;
00538     ofs << "    children         IS children" << std::endl;
00539     ofs << "  }" << std::endl;
00540     ofs << "}" << std::endl;
00541     ofs << "" << std::endl;
00542     ofs << "" << std::endl;
00543     ofs << "PROTO ForceSensor [  " << std::endl;
00544     ofs << "  exposedField SFVec3f    maxForce    -1 -1 -1" << std::endl;
00545     ofs << "  exposedField SFVec3f    maxTorque   -1 -1 -1" << std::endl;
00546     ofs << "  exposedField SFVec3f    translation 0 0 0" << std::endl;
00547     ofs << "  exposedField SFRotation rotation    0 0 1 0" << std::endl;
00548     ofs << "  exposedField SFInt32    sensorId    -1" << std::endl;
00549     ofs << "]" << std::endl;
00550     ofs << "{" << std::endl;
00551     ofs << "  Transform {" << std::endl;
00552     ofs << "    translation IS translation" << std::endl;
00553     ofs << "    rotation    IS rotation" << std::endl;
00554     ofs << "  }" << std::endl;
00555     ofs << "}" << std::endl;
00556     ofs << "" << std::endl;
00557     ofs << "PROTO Gyro [" << std::endl;
00558     ofs << "  exposedField SFVec3f    maxAngularVelocity -1 -1 -1" << std::endl;
00559     ofs << "  exposedField SFVec3f    translation        0 0 0" << std::endl;
00560     ofs << "  exposedField SFRotation rotation           0 0 1 0" << std::endl;
00561     ofs << "  exposedField SFInt32    sensorId           -1" << std::endl;
00562     ofs << "]" << std::endl;
00563     ofs << "{" << std::endl;
00564     ofs << "  Transform {" << std::endl;
00565     ofs << "    translation IS translation" << std::endl;
00566     ofs << "    rotation    IS rotation" << std::endl;
00567     ofs << "  }" << std::endl;
00568     ofs << "}" << std::endl;
00569     ofs << "" << std::endl;
00570     ofs << "PROTO AccelerationSensor [" << std::endl;
00571     ofs << "  exposedField SFVec3f    maxAcceleration -1 -1 -1" << std::endl;
00572     ofs << "  exposedField SFVec3f    translation     0 0 0" << std::endl;
00573     ofs << "  exposedField SFRotation rotation        0 0 1 0" << std::endl;
00574     ofs << "  exposedField SFInt32    sensorId        -1" << std::endl;
00575     ofs << "]" << std::endl;
00576     ofs << "{" << std::endl;
00577     ofs << "  Transform {" << std::endl;
00578     ofs << "    translation IS translation" << std::endl;
00579     ofs << "    rotation    IS rotation" << std::endl;
00580     ofs << "  }" << std::endl;
00581     ofs << "}" << std::endl;
00582 }


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Apr 11 2019 03:30:19