GrxWorldStateItem.java
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * General Robotix Inc.
8  * National Institute of Advanced Industrial Science and Technology (AIST)
9  */
10 /*
11  * GrxWorldStateItem.java
12  *
13  * Copyright (C) 2007 GeneralRobotix, Inc.
14  * All Rights Reserved
15  *
16  * @author Yuichiro Kawasumi (General Robotix, Inc.)
17  */
18 
19 package com.generalrobotix.ui.item;
20 
21 import java.io.*;
22 import java.lang.reflect.InvocationTargetException;
23 import java.lang.Runtime;
24 import java.nio.ByteBuffer;
25 import java.util.*;
26 import java.util.zip.ZipEntry;
27 import java.util.zip.ZipFile;
28 import javax.vecmath.Matrix3d;
29 
30 import org.eclipse.core.runtime.IProgressMonitor;
31 import org.eclipse.jface.action.Action;
32 import org.eclipse.jface.dialogs.MessageDialog;
33 import org.eclipse.jface.dialogs.ProgressMonitorDialog;
34 import org.eclipse.jface.operation.IRunnableWithProgress;
35 import org.eclipse.swt.SWT;
36 import org.eclipse.swt.widgets.FileDialog;
37 import org.eclipse.swt.widgets.DirectoryDialog;
38 
39 import jp.go.aist.hrp.simulator.*;
40 
49 import com.generalrobotix.ui.view.graph.*;
51 
52 @SuppressWarnings("serial") //$NON-NLS-1$
53 public class GrxWorldStateItem extends GrxTimeSeriesItem {
54  public static final String TITLE = "World State"; //$NON-NLS-1$
55  public static final String DEFAULT_DIR = "/"; //$NON-NLS-1$
56  public static final String FILE_EXTENSION = "log"; //$NON-NLS-1$
57 
58  public static final double DEFAULT_TOTAL_TIME = 20.0;
59  private static final int MAX_RAM_BUFFER_SIZE = -1; // 無制限
60  private static final int LOAD_LOG_MODITOR_DIM = 32; // プログレスモニター用定数
61  private static final long HEAP_MEMORY_TOLERANCE = 4*1024*1024; //残りヒープメモリサイズの許容量
62  private static final String OVER_HEAP_LOG_DIR_NAME = "over"; //ヒープメモリを超えたときにログを退避させるディレクトリ //$NON-NLS-1$
63  private static String LOG_DIR;
64 
65  private WorldStateEx newStat_ = null;
66  private WorldStateEx preStat_ = null;
67  private int prePos_ = -1;
68 
69  public final LogManager logger_ = new LogManager();
70  private float recDat_[][];
71  private String lastCharName_ = null;
72  private boolean initLogFlag_ = false;
73  private boolean useDisk_ = true;
74  private boolean storeAllPos_ = true;
75 
76  private Action save_ = new Action(){
77  public String getText(){ return MessageBundle.get("GrxWorldStateItem.menu.saveLog"); } //$NON-NLS-1$
78  public void run(){
79  if(isRemoved()){
80  MessageDialog.openWarning(
82  MessageBundle.get("GrxWorldStateItem.dialog.title.saveLog"), //$NON-NLS-1$
83  MessageBundle.get("GrxWorldStateItem.dialog.message.saveLog")); //$NON-NLS-1$
84  return;
85  }
86  _saveLog();
87  }
88  };
89  private Action saveCSV_ = new Action(){
90  public String getText(){ return MessageBundle.get("GrxWorldStateItem.menu.saveAsCSV"); } //$NON-NLS-1$
91  public void run(){
92  if(isRemoved()){
93  MessageDialog.openWarning(
95  MessageBundle.get("GrxWorldStateItem.dialog.title.saveAsCSV"), //$NON-NLS-1$
96  MessageBundle.get("GrxWorldStateItem.dialog.message.saveAsCSV")); //$NON-NLS-1$
97  return;
98  }
99  _saveCSV();
100  }
101  };
102  private Action clear_ = new Action(){
103  public String getText(){ return MessageBundle.get("GrxWorldStateItem.menu.clearLog"); } //$NON-NLS-1$
104  public void run(){
105  if( MessageDialog.openQuestion( null, MessageBundle.get("GrxWorldStateItem.dialog.title.clearLog"), MessageBundle.get("GrxWorldStateItem.dialog.message.clearLog") ) ) //$NON-NLS-1$ //$NON-NLS-2$
106  clearLog();
107  }
108  };
109 
110  private AxisAngle4d a4d = new AxisAngle4d();
111  private Matrix3d m3d = new Matrix3d();
112  private AxisAngle4d a4dg = new AxisAngle4d();
113  private Matrix3d m3dg = new Matrix3d();
114 
115  private String tempDirBase_;
116  private String tempDir_;
117 
118  public GrxWorldStateItem(String name, GrxPluginManager manager) {
119  super(name, manager);
120 
121  tempDirBase_ = System.getProperty("java.io.tmpdir")+File.separator+"grxui-"+System.getProperty("user.name")+File.separator; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
122  tempDir_ = tempDirBase_+getName();
123 
124  Action load = new Action(){
125  public String getText(){ return MessageBundle.get("GrxWorldStateItem.menu.loadLog"); } //$NON-NLS-1$
126  public void run(){
127  FileDialog fdlg = new FileDialog(GrxUIPerspectiveFactory.getCurrentShell(), SWT.OPEN);
128  fdlg.setFilterExtensions(new String[]{"*.log"}); //$NON-NLS-1$
129  fdlg.setFilterPath(getDefaultDir().getAbsolutePath());
130  final String fPath = fdlg.open();
131  _loadLog(new File(fPath));
132  setDefaultDirectory(new File(fPath).getParent());
133  }
134  };
135  setMenuItem(save_);
136  setMenuItem(load);
137  setMenuItem(saveCSV_);
138  setMenuItem(clear_);
139 
140  setExclusive(true);
141  setIcon( "world.png" ); //$NON-NLS-1$
142 
143  logger_.init();
144  }
145 
146 // public static String[] getStaticMenu() {
147 // return new String[]{"create", "load"};
148 // }
149 
150  public boolean create() {
151  clearLog();
152  setDbl("logTimeStep", 0.001); //$NON-NLS-1$
153  return true;
154  }
155 
156  public boolean load(File f) {
157  _loadLog(f);
158  return true;
159  }
160 
161  public void setLogMenus(boolean bAble){
162  save_.setEnabled(bAble);
163  saveCSV_.setEnabled(bAble);
164  clear_.setEnabled(bAble);
165  }
166 
167  public void restoreProperties() {
168  super.restoreProperties();
169  useDisk_ = isTrue("useDisk", true); //$NON-NLS-1$
170  storeAllPos_ = isTrue("storeAllPosition", storeAllPos_); //$NON-NLS-1$
171  int size = getInt("bufferSize", MAX_RAM_BUFFER_SIZE); //$NON-NLS-1$
172  if ( useDisk_ ) {
173  super.setMaximumLogSize(MAX_RAM_BUFFER_SIZE);
174  } else {
175  GrxDebugUtil.println("GrxWorldStateItem: useDisk = false"); //$NON-NLS-1$
176  super.setMaximumLogSize(size);
177  }
178  }
179 
180  public void rename(String newName) {
181  File oldDir = new File(LOG_DIR+File.separator+getName());
182  super.rename(newName);
183  File newDir = new File(LOG_DIR+File.separator+getName());
184  if (newDir.isDirectory())
185  newDir.delete();
186 
187  if (oldDir.isDirectory())
188  oldDir.renameTo(newDir);
189  else
190  newDir.mkdir();
191 
192  logger_.setTempDir(newDir.getPath());
193  }
194 
195  public void clearLog() {
196  super.clearLog();
197  initLogFlag_ = false;
198  logger_.init();
199  newStat_ = null;
200  preStat_ = null;
201  prePos_ = -1;
202  lastCharName_ = null;
203  setLogMenus(false);
204  remove("url");
205  if(useDisk_)
206  logger_.closeReads();
207  syncExec(new Runnable(){
208  public void run(){
209  notifyObservers("ClearLog"); //$NON-NLS-1$
210  }
211  });
212  }
213 
214  @SuppressWarnings("unchecked") //$NON-NLS-1$
215  public void registerCharacter(String cname, BodyInfo binfo) {
216  ArrayList<String> logList = new ArrayList<String>();
217  logList.add("time"); //$NON-NLS-1$
218  logList.add("float"); //$NON-NLS-1$
219 
220  LinkInfo[] li = binfo.links();
221  ArrayList<Short> jointList = new ArrayList<Short>();
222  ArrayList<SensorInfoLocal> sensList = new ArrayList<SensorInfoLocal>();
223  for (int i=0; i<li.length; i++) {
224  jointList.add(li[i].jointId);
225 
226  SensorInfo[] si = li[i].sensors;
227  for (int j=0; j<si.length; j++)
228  sensList.add(new SensorInfoLocal(si[j]));
229  }
230 
231  Collections.sort(sensList);
232 
233  int len = storeAllPos_ ? li.length : 1;
234  for (int i=0; i< len; i++) {
235  String jname = li[i].name;
236  logList.add(jname+".translation"); //$NON-NLS-1$
237  logList.add("float[3]"); //$NON-NLS-1$
238  logList.add(jname+".rotation"); //$NON-NLS-1$
239  logList.add("float[4]"); //$NON-NLS-1$
240  }
241 
242  for (short i=0; i<jointList.size(); i++) { // short <- its depend on the idl def.
243  int idx = jointList.indexOf(i);
244  if (idx >= 0) {
245  String jname = li[idx].name;
246  logList.add(jname+".angle"); //$NON-NLS-1$
247  logList.add("float"); //$NON-NLS-1$
248  logList.add(jname+".jointTorque"); //$NON-NLS-1$
249  logList.add("float"); //$NON-NLS-1$
250  }
251  }
252 
253  for (int i=0; i<sensList.size(); i++) {
254  String sname = sensList.get(i).name;
255  // ##### [Changed] NewModelLoader.IDL
256  //switch(sensList.get(i).type) {
257  //case SensorType._FORCE_SENSOR:
258  // logList.add(sname+".force");
259  // logList.add("float[3]");
260  // logList.add(sname+".torque");
261  // logList.add("float[3]");
262  // break;
263  //case SensorType._RATE_GYRO:
264  // logList.add(sname+".angularVelocity");
265  // logList.add("float[3]");
266  // break;
267  //case SensorType._ACCELERATION_SENSOR:
268  // logList.add(sname+".acceleration");
269  // logList.add("float[3]");
270  // break;
271  //default:
272  // break;
273  //}
274  if(sensList.get(i).type.equals("Force")){ //$NON-NLS-1$
275  logList.add(sname+".force"); //$NON-NLS-1$
276  logList.add("float[3]"); //$NON-NLS-1$
277  logList.add(sname+".torque"); //$NON-NLS-1$
278  logList.add("float[3]"); //$NON-NLS-1$
279  }else if(sensList.get(i).type.equals("RateGyro")){ //$NON-NLS-1$
280  logList.add(sname+".angularVelocity"); //$NON-NLS-1$
281  logList.add("float[3]"); //$NON-NLS-1$
282  }else if(sensList.get(i).type.equals("Acceleration")){ //$NON-NLS-1$
283  logList.add(sname+".acceleration"); //$NON-NLS-1$
284  logList.add("float[3]"); //$NON-NLS-1$
285  }else if(sensList.get(i).type.equals("Range")){ //$NON-NLS-1$
286  logList.add(sname+".range"); //$NON-NLS-1$
287  SensorInfo info = sensList.get(i).info;
288  int half = (int)(info.specValues[0]/2/info.specValues[1]);// = scanAngle/scanStep
289  logList.add("float["+(half*2+1)+"]"); //$NON-NLS-1$ //$NON-NLS-2$
290  }else{
291  }
292  }
293 
294  logList.add("command"); //$NON-NLS-1$
295  logList.add("float["+jointList.size()+"]"); //$NON-NLS-1$ //$NON-NLS-2$
296  logList.add("servoState");
297  logList.add("float["+jointList.size()+"]");
298  logList.add("powerState");
299  logList.add("float[2]");
300  try {
301  logger_.addLogObject(cname, logList.toArray(new String[0]));
302  } catch (LogFileFormatException e) {
303  e.printStackTrace();
304  }
305  }
306 
307  public void addValue(Double t, Object obj) {
308  if ( useDisk_ ) {
309  _addValueToLog(t, obj);
310  }else {
311  if(overPos_ > 0){
312  // メモリ+ファイル記録のログのファイル記録
313  _addValueToLog(t, obj);
314  ++overPos_;
315  } else {
316  if( Runtime.getRuntime().freeMemory() < HEAP_MEMORY_TOLERANCE){
317  //メモリからファイルへのログ保存に切替
318  File f = new File(tempDir_);
319  File pf = f.getParentFile();
320  if (!pf.isDirectory()){
321  pf.mkdir();
322  }
323  tempDir_ = tempDirBase_ + getName() + File.separator + OVER_HEAP_LOG_DIR_NAME;
324  changePos_ = super.getLogSize();
325  _addValueToLog(t, obj);
326  ++overPos_;
327  } else {
328  super.addValue(t, obj);
329  }
330  }
331  }
332  }
333 
334  private void _addValueToLog(Double t, Object obj){
335  if (obj instanceof WorldStateEx) {
336  newStat_ = (WorldStateEx) obj;
337  _initLog();
338  _toLogFile(logger_);
339  super.addValue(newStat_.time, null);
340  }
341  }
342 
343  private void _addValueToLogFromSuperLog(Double t, Object obj, LogManager temp){
344  if (obj instanceof WorldStateEx) {
345  newStat_ = (WorldStateEx) obj;
346  if(temp == logger_){
347  _initLog();
348  }
349  _toLogFile(temp);
350  }
351  }
352 
353  private void _toLogFile(LogManager temp){
354  temp.setTime(new Time((float)newStat_.time));
355 
356  try {
357  Collision[] cols = newStat_.collisions;
358  if (cols != null && cols.length > 0) {
359  List<CollisionPoint> cdList = new ArrayList<CollisionPoint>();
360  for (int i=0; i < cols.length; i++) {
361  if( cols[i].points == null){
362  continue;
363  }
364  for (int j=0; j<cols[i].points.length; j++)
365  cdList.add(cols[i].points[j]);
366  }
367  CollisionPoint[] cd = cdList.toArray(new CollisionPoint[0]);
368  temp.putCollisionPointData(cd);
369  }
370  } catch (Exception e) {
371  GrxDebugUtil.printErr("",e); //$NON-NLS-1$
372  }
373 
374  for (int i=0; i < newStat_.charList.size(); i++) {
375  int k = 0;
376  recDat_[i][k++] = (float) newStat_.time;
377  CharacterStateEx cpos = newStat_.charList.get(i);
378  int len = storeAllPos_ ? cpos.position.length : 1;
379  for (int j=0; j<len; j++) {
380  for (int m=0; m<3; m++)
381  recDat_[i][k++] = (float)cpos.position[j].p[m];
382  m3d.set(cpos.position[j].R);
383  //m3d.transpose();
384  a4d.setMatrix(m3d);
385  recDat_[i][k++] = (float) a4d.x;
386  recDat_[i][k++] = (float) a4d.y;
387  recDat_[i][k++] = (float) a4d.z;
388  recDat_[i][k++] = (float) a4d.angle;
389  }
390 
391  String cname = cpos.characterName;
392  SensorState sdata = cpos.sensorState;
393  if (sdata != null) {
394  for (int j=0; j<sdata.q.length; j++) {
395  recDat_[i][k++] = (float) sdata.q[j];
396  recDat_[i][k++] = (float) sdata.u[j];
397  }
398  for (int j=0; j<sdata.force.length; j++) {
399  for (int m=0; m<sdata.force[j].length; m++)
400  recDat_[i][k++] = (float)sdata.force[j][m];
401  }
402  for (int j=0; j<sdata.rateGyro.length; j++) {
403  for (int m=0; m<sdata.rateGyro[j].length; m++)
404  recDat_[i][k++] = (float)sdata.rateGyro[j][m];
405  }
406  for (int j=0; j<sdata.accel.length; j++) {
407  for (int m=0; m<sdata.accel[j].length; m++)
408  recDat_[i][k++] = (float)sdata.accel[j][m];
409  }
410  if (sdata.range != null){
411  for (int j=0; j<sdata.range.length; j++) {
412  for (int m=0; m<sdata.range[j].length; m++)
413  recDat_[i][k++] = (float)sdata.range[j][m];
414  }
415  }
416  }
417  if (cpos.targetState != null){
418  for (int j=0; j<cpos.targetState.length; j++){
419  recDat_[i][k++] = (float)cpos.targetState[j];
420  }
421  }
422  if (cpos.servoState != null){
423  for (int j=0; j<cpos.servoState.length; j++){
424  ByteBuffer buffer = ByteBuffer.allocate(10);
425  buffer.putInt(cpos.servoState[j]);
426  float f = buffer.getFloat(0);
427  recDat_[i][k++] = f;
428  //recDat_[i][k++] = (float)cpos.servoState[j];
429  }
430  }
431  if (cpos.powerState != null){
432  for (int j=0; j<cpos.powerState.length; j++){
433  recDat_[i][k++] = (float)cpos.powerState[j];
434  }
435  }
436  try {
437  temp.put(cname, recDat_[i]);
438  } catch (Exception e) {
439  e.printStackTrace();
440  }
441  }
442  }
443 
444  public void init(){
445  double val = getDbl("logTimeStep",0.001); //$NON-NLS-1$
446  setDbl("logTimeStep",val); //$NON-NLS-1$
447  }
448 
449  private void _initLog() {
450  if ( initLogFlag_ ){
451  return;
452  }
453  initLogFlag_ = true;
454  setLogMenus(true);
455  SimulationTime stime = new SimulationTime();
456  stime.setCurrentTime(newStat_.time);
457  stime.setStartTime(newStat_.time);
458 
459  double val = getDbl("logTimeStep",0.001); //$NON-NLS-1$
460  stime.setTimeStep(val);
461 
462  GrxSimulationItem simItem = manager_.<GrxSimulationItem>getSelectedItem(GrxSimulationItem.class, null);
463  String method = "";
464  if(simItem!=null){
465  val = simItem.getDbl("totalTime", DEFAULT_TOTAL_TIME); //$NON-NLS-1$
466  method = simItem.getStr("method");
467  }else
468  val = DEFAULT_TOTAL_TIME;
469  stime.setTotalTime(val);
470 
471  logger_.setTempDir(tempDir_);
472 
473  logger_.initCollisionLog(stime);
474  try {
475  logger_.openAsWrite(stime, method);
476  logger_.openAsRead();
477  logger_.openCollisionLogAsWrite();
478  logger_.openCollisionLogAsRead();
479  } catch (FileOpenFailException e) {
480  e.printStackTrace();
481  } catch (IOException e1) {
482  e1.printStackTrace();
483  }
484  recDat_ = new float[logger_.getLogObjectNum()][];
485  for (int i=0; i<recDat_.length; i++)
486  recDat_[i] = new float[logger_.getDataLength(newStat_.charList.get(i).characterName)];
487  preStat_ = newStat_;
488  }
489 
492 
493  int pos = getPosition();
494  if(useDisk_){
495  if (pos >= 0){
496  if (pos == getLogSize()-1 && newStat_ != null){
497  ret = newStat_;
498  }
499  if (pos != prePos_ && preStat_ != null)
500  ret = getValue(pos);
501  }
502  } else {
503  if( pos > changePos_ && changePos_ >= 0){
504  ret = _getValueFromLog( pos - changePos_ );
505  } else {
506  ret = (WorldStateEx)super.getValue(pos);
507  }
508  }
509  return ret;
510  }
511 
512  public WorldStateEx getValue(int pos) {
514  if (pos >= 0){
515  if ( useDisk_ ){
516  ret = _getValueFromLog( pos );
517  } else {
518  if( pos > changePos_ && changePos_ >= 0 ){
519  ret = _getValueFromLog(pos - changePos_);
520  } else {
521  ret = (WorldStateEx)super.getValue(pos);
522  }
523  }
524  }
525  return ret;
526  }
527 
528  private WorldStateEx _getValueFromLog(int pos){
529  if(pos == prePos_)
530  return preStat_;
531 
532  try {
533  preStat_.collisions = new Collision[]{new Collision()};
534  preStat_.collisions[0].points = logger_.getCollisionPointData(pos);
535 
536  for (int i=0; i<preStat_.charList.size(); i++) {
537  int k=0;
538  CharacterStateEx cpos = preStat_.charList.get(i);
539  float[] f = logger_.get(cpos.characterName, (long)pos);
540  preStat_.time = (double)f[k++];
541  for (int j=0; j<cpos.position.length; j++) {
542  LinkPosition lpos = cpos.position[j];
543  if (storeAllPos_ || j == 0) {
544  for (int m=0; m<3; m++)
545  lpos.p[m] = (double)f[k++];
546  a4dg.set((double)f[k++], (double)f[k++], (double)f[k++], (double)f[k++]);
547  m3dg.set(a4dg);
548  lpos.R[0] = m3dg.m00;
549  lpos.R[1] = m3dg.m01;
550  lpos.R[2] = m3dg.m02;
551  lpos.R[3] = m3dg.m10;
552  lpos.R[4] = m3dg.m11;
553  lpos.R[5] = m3dg.m12;
554  lpos.R[6] = m3dg.m20;
555  lpos.R[7] = m3dg.m21;
556  lpos.R[8] = m3dg.m22;
557  } else {
558  lpos.p = null; // to calculate kinema in model
559  lpos.R = null; // to calculate kinema in model
560  }
561  }
562 
563  SensorState sdata = cpos.sensorState;
564  if (sdata != null) {
565  for (int j=0; j<sdata.q.length; j++) {
566  sdata.q[j] = (double)f[k++];
567  sdata.u[j] = (double)f[k++];
568  }
569  for (int j=0; j<sdata.force.length; j++) {
570  for (int m=0; m<sdata.force[j].length; m++)
571  sdata.force[j][m] = (double)f[k++];
572  }
573  for (int j=0; j<sdata.rateGyro.length; j++) {
574  for (int m=0; m<sdata.rateGyro[j].length; m++)
575  sdata.rateGyro[j][m] = (double)f[k++];
576  }
577  for (int j=0; j<sdata.accel.length; j++) {
578  for (int m=0; m<sdata.accel[j].length; m++)
579  sdata.accel[j][m] = (double)f[k++];
580  }
581  if (sdata.range != null){
582  for (int j=0; j<sdata.range.length; j++) {
583  for (int m=0; m<sdata.range[j].length; m++)
584  sdata.range[j][m] = (double)f[k++];
585  }
586  }
587  }
588  if (cpos.targetState != null){
589  for (int j=0; j<cpos.targetState.length; j++){
590  cpos.targetState[j] = (double)f[k++];
591  }
592  }
593  if (cpos.servoState != null){
594  for (int j=0; j<cpos.servoState.length; j++){
595  ByteBuffer buffer = ByteBuffer.allocate(10);
596  buffer.putFloat(f[k++]);
597  int ss = buffer.getInt(0);
598  cpos.servoState[j] = ss;
599  //cpos.servoState[j] = (int)f[k++];
600  }
601  }
602  if (cpos.powerState != null){
603  for (int j=0; j<cpos.powerState.length; j++){
604  cpos.powerState[j] = (double)f[k++];
605  }
606  }
607  }
608  } catch (IOException e) {
609  e.printStackTrace();
610  }
611  prePos_ = pos;
612  return preStat_;
613  }
614 
615  private void _loadLog(final File logFile) {
616  try {
617  IRunnableWithProgress op = new IRunnableWithProgress() {
618  public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
619  int size = 0;
620  try{
621  ZipFile local = new ZipFile(logFile);
622  size = local.size();
623  local.close();
624  } catch ( IOException ex ){
625  ex.printStackTrace();
626  return;
627  } catch ( Exception ex){
628  ex.printStackTrace();
629  return;
630  }
631 
632  monitor.beginTask("Loading log as a file:"+logFile.getName(), size + LOAD_LOG_MODITOR_DIM + 2); //$NON-NLS-1$
633  _loadLog(logFile,monitor);
634  monitor.done();
635  notifyObservers("LoadLog");
636  }
637  };
638  new ProgressMonitorDialog(GrxUIPerspectiveFactory.getCurrentShell()).run(false, true, op);
639  setLogMenus(true);
640  } catch (InvocationTargetException e) {
641  e.printStackTrace();
642  } catch (InterruptedException e) {
643  clearLog();
644  }
645  }
646 
647  private void _loadLog(File logFile, IProgressMonitor monitor ) throws InterruptedException{
648  String fname = logFile.getAbsolutePath();
649  try {
650  if (logFile == null)
651  logFile = new File("log"+File.separator+getName()+".log"); //$NON-NLS-1$ //$NON-NLS-2$
652 
653  if (!logFile.isFile())
654  return;
655 
656  clearLog();
657  tempDir_ = tempDirBase_ + getName();
658  logger_.setTempDir(tempDir_);
659  logger_.load(fname, ""); //$NON-NLS-1$
660 
661  monitor.worked(1);
662  final SimulationTime sTime = new SimulationTime();
663  logger_.getSimulationTime(sTime);
664  syncExec(new Runnable(){
665  public void run(){
666  GrxSimulationItem simItem = manager_.<GrxSimulationItem>getSelectedItem(GrxSimulationItem.class, null);
667  if(simItem!=null)
668  simItem.setDbl("totalTime", sTime.getTotalTime());
669  setDbl("logTimeStep", sTime.getTimeStep()); //$NON-NLS-1$
670  }
671  });
672 
673  logger_.openAsRead();
674  logger_.openCollisionLogAsRead();
675 
676  preStat_ = new WorldStateEx();
677  Enumeration<? extends ZipEntry> e = new ZipFile(fname).entries();
678  while (e.hasMoreElements()) {
679  monitor.worked(1);
680  if (monitor.isCanceled())
681  throw new InterruptedException();
682  String entry = ((ZipEntry)e.nextElement()).getName();
683  if (entry.indexOf(LogManager.COLLISION_LOG_NAME) >= 0 ||
684  entry.indexOf(LogManager.COLLISION_LOG_DAT_NAME) >= 0) {
685  continue;
686  }
687 
688  lastCharName_ = new File(entry).getName().split(".tmp")[0]; //$NON-NLS-1$
689  String[] format = logger_.getDataFormat(lastCharName_);
690  List<LinkPosition> lposList = new ArrayList<LinkPosition>();
691  int jointCount = 0;
692  int forceCount = 0;
693  int gyroCount = 0;
694  int accelCount = 0;
695  int rangeCount = 0;
696 
697  for (int i=0; i<format.length; i++) {
698  String[] str = format[i].split("[.]"); //$NON-NLS-1$
699  if (str.length <= 1) {
700  continue;
701  } else if (str[1].equals("translation")) { //$NON-NLS-1$
702  LinkPosition lpos = new LinkPosition();
703  lpos.p = new double[3];
704  lpos.R = new double[9];
705  lposList.add(lpos);
706  } else if (str[1].equals("angle")) { //$NON-NLS-1$
707  if (!storeAllPos_)
708  lposList.add(new LinkPosition());
709  jointCount++;
710  } else if (str[1].equals("force")) { //$NON-NLS-1$
711  forceCount++;
712  } else if (str[1].equals("angularVelocity")) { //$NON-NLS-1$
713  gyroCount++;
714  } else if (str[1].equals("acceleration")) { //$NON-NLS-1$
715  accelCount++;
716  } else if (str[1].equals("range")){ //$NON-NLS-1$
717  rangeCount++;
718  }
719  }
720 
721  CharacterStateEx cpos = new CharacterStateEx();
722  cpos.characterName = lastCharName_;
723  cpos.position = lposList.toArray(new LinkPosition[0]);
724  if (jointCount+forceCount+accelCount+gyroCount+rangeCount > 1) {
725  SensorState sdata = new SensorState();
726  sdata.q = new double[jointCount];
727  sdata.u = new double[jointCount];
728  sdata.force = new double[forceCount][6];
729  sdata.rateGyro = new double[gyroCount][3];
730  sdata.accel = new double[accelCount][3];
731  sdata.range = new double[rangeCount][]; // TODO
732  cpos.sensorState = sdata;
733  }
734  preStat_.charList.add(cpos);
735  preStat_.charMap.put(lastCharName_, cpos);
736  }
737 
738  int datLen = logger_.getRecordNum(lastCharName_);
739 
740  // プログレス用変数の初期化
741  int workdim[] = new int[LOAD_LOG_MODITOR_DIM];
742  int workdimCounter = 0;
743  int localLength = workdim.length;
744 
745  for( int i = 0; i < localLength; ++i){
746  workdim[i] = datLen * (i + 1) / localLength;
747  }
748 
749  monitor.worked(1);
750 
751  if( !useDisk_ ){
752  recDat_ = new float[logger_.getLogObjectNum()][];
753  for (int i=0; i<recDat_.length; i++)
754  recDat_[i] = new float[logger_.getDataLength(preStat_.charList.get(i).characterName)];
755  }
756 
757  for (int i=0; i < datLen; i++){
758  if ( useDisk_ ) {
759  try{
760  super.addValue( null , null);
761  } catch (Exception ex){
762  ex.printStackTrace();
763  break;
764  }
765  } else {
766  //メモリーに展開する場合
767  WorldStateEx worldState = _getValueFromLog(i);
768 
769  if( Runtime.getRuntime().freeMemory() < HEAP_MEMORY_TOLERANCE){
770  //ヒープメモリが足りない場合の処理
771  _createOverLog( worldState.time,
772  i == 0 ? worldState.time : getTime(0),
773  i, datLen - i);
774  break;
775  }
776 
777  try{
778  super.addValue( worldState.time , worldState.clone());
779  } catch (Exception ex){
780  ex.printStackTrace();
781  break;
782  }
783  }
784 
785  //プログレスチェックと処理
786  if ( workdim[workdimCounter] < i){
787  workdimCounter ++;
788  monitor.worked(1);
789  }
790  }
791 
792  syncExec(new Runnable(){
793  public void run(){
794  setPosition(0);
795  }
796  });
797  monitor.worked(1);
798  } catch (FileOpenFailException e) {
799  e.printStackTrace();
800  MessageDialog.openError(
802  MessageBundle.get("GrxWorldStateItem.dialog.title.errorLoadLogMessageDlg"),
803  MessageBundle.get("GrxWorldStateItem.dialog.message.errorFileOpenFail") +
804  System.getProperty("line.separator") + fname);
805  } catch (LogFileFormatException e) {
806  e.printStackTrace();
807  MessageDialog.openError(
809  MessageBundle.get("GrxWorldStateItem.dialog.title.errorLoadLogMessageDlg"),
810  MessageBundle.get("GrxWorldStateItem.dialog.message.errorLogFileFormat") +
811  System.getProperty("line.separator") + fname);
812  } catch (IOException e) {
813  e.printStackTrace();
814  MessageDialog.openError(
816  MessageBundle.get("GrxWorldStateItem.dialog.title.errorLoadLogMessageDlg"),
817  MessageBundle.get("GrxWorldStateItem.dialog.message.errorIOException") +
818  System.getProperty("line.separator") + fname);
819  }
820  }
821 
822  private void _saveLog() {
823  FileDialog fdlg = new FileDialog(GrxUIPerspectiveFactory.getCurrentShell(), SWT.SAVE);
824  fdlg.setFileName(GrxWorldStateItem.this.getName()+".log"); //$NON-NLS-1$
825  fdlg.setFilterExtensions(new String[]{"*.log"}); //$NON-NLS-1$
826  fdlg.setFilterPath(getDefaultDir().getAbsolutePath());
827  final String fPath = fdlg.open();
828  if (fPath != null) {
829  Thread t = new Thread() {
830  public void run() {
831  try {
832  if( useDisk_ ){
833  // 従来の処理
834  logger_.closeAsWrite();
835  logger_.closeCollisionLogAsWrite();
836  logger_.save(fPath, getName()+".prj"); //$NON-NLS-1$
837  } else {
838  // オンメモリデータをファイルへ
839  LogManager temp = _restoreLogFileFromSuperLog();
840  if(temp != null){
841  temp.save(fPath, getName()+".prj"); //$NON-NLS-1$
842  if(temp != logger_){
843  temp.closeReads();
844  }
845  }
846  }
847  } catch (IOException ex){
848  ex.printStackTrace();
849  } catch (Exception ex) {
850  ex.printStackTrace();
851  }
852  }
853  };
854  t.start();
855  setDefaultDirectory(new File(fPath).getParent());
856  setURL(fPath);
857  }
858  }
859 
860  private void _createOverLog(double currentTime, double startTime, int changePos, int overPos ){
861  changePos_ = changePos;
862  overPos_ = overPos;
863 
864  // サブディレクトリOVER_HEAP_LOG_DIR_NAMEにuseDiskがfalseの時と同様のログを生成
865  LogManager temp = new LogManager(logger_);
866  if( temp == null){
867  return;
868  }
869  String overDir = tempDirBase_ + getName() + File.separator + OVER_HEAP_LOG_DIR_NAME;
870  temp.setTempDir( overDir );
871  SimulationTime stime = new SimulationTime();
872  logger_.getSimulationTime(stime);
873  stime.setStartTime(currentTime);
874  temp.initCollisionLog(stime);
875  try {
876  temp.openAsWrite(stime, logger_.getIntegrationMethodStr());
878  temp.separateLogs(changePos);
879  temp.closeAsWrite();
881  } catch (IOException ex) {
882  ex.printStackTrace();
883  }
884 
885  // loggerをOVER_HEAP_LOG_DIR_NAMEディレクトリ以下のファイルを参照するように変更
886  logger_.closeReads();
887  logger_.setTempDir(overDir);
888  try {
889  logger_.openAsRead();
890  logger_.openCollisionLogAsRead();
891  } catch (FileOpenFailException e) {
892  e.printStackTrace();
893  } catch (IOException ex) {
894  ex.printStackTrace();
895  }
896 
897  //overPos部分の時間を登録
898  for(int i = 0; i < overPos; ++i){
899  try{
900  super.addValue( (double)logger_.get(lastCharName_, i)[0], null);
901  } catch (Exception ex){
902  ex.printStackTrace();
903  break;
904  }
905  }
906  }
907 
909  LogManager ret = null;
910  if( changePos_ < 0 ){
911  // 全てのログがメモリにある場合
912  for(int index = 0; index < getLogSize(); ++index){
913  TValue localTValue = getObject(index);
914  _addValueToLogFromSuperLog(localTValue.getTime(), localTValue.getValue(), logger_);
915  }
916  try{
917  logger_.closeAsWrite();
918  logger_.closeCollisionLogAsWrite();
919  ret = logger_;
920  } catch (IOException ex){
921  ex.printStackTrace();
922  } catch (Exception ex) {
923  ex.printStackTrace();
924  }
925  } else {
926  //全てのログがメモリにない場合
927  // 書き込みファイルストリームを全て閉じる
928  try{
929  logger_.closeAsWrite();
930  logger_.closeCollisionLogAsWrite();
931  } catch (IOException ex){
932  ex.printStackTrace();
933  } catch (Exception ex) {
934  ex.printStackTrace();
935  }
936 
937  // サブディレクトリOVER_HEAP_LOG_DIR_NAMEの親ディレクトリにuseDiskがtrueの時と同様のログを生成
938  LogManager temp = new LogManager(logger_);
939  if( temp == null){
940  return ret;
941  }
942  temp.setTempDir( tempDirBase_ + getName() );
943  SimulationTime stime = new SimulationTime();
944  stime.setCurrentTime(preStat_.time);
945  stime.setStartTime( super.getTime(0) );
946 
947  double localTime = getDbl("logTimeStep",0.001); //$NON-NLS-1$
948  stime.setTimeStep(localTime);
949 
950  GrxSimulationItem simItem = manager_.<GrxSimulationItem>getSelectedItem(GrxSimulationItem.class, null);
951  String method = "";
952  if(simItem!=null){
953  localTime = simItem.getDbl("totalTime", DEFAULT_TOTAL_TIME); //$NON-NLS-1$
954  method = simItem.getStr("method");
955  }else
956  localTime = DEFAULT_TOTAL_TIME;
957  stime.setTotalTime(localTime);
958  temp.initCollisionLog(stime);
959  try {
960  temp.openAsWrite(stime, method);
961  temp.openAsRead();
963  temp.openCollisionLogAsRead();
964  } catch (FileOpenFailException e) {
965  e.printStackTrace();
966  } catch (IOException e1) {
967  e1.printStackTrace();
968  }
969 
970  //メモリ上のログをファイルへ展開
971  for(int index = 0; index < getLogSize(); ++index){
972  TValue localTValue = getObject(index);
973  Object val = localTValue.getValue();
974  if( val != null){
975  _addValueToLogFromSuperLog(localTValue.getTime(), val, temp);
976  continue;
977  }
978  break;
979  }
980 
981  try{
982  // 残りのサブディレクトリOVER_HEAP_LOG_DIR_NAMEのログを結合
983  temp.jointLogs();
984  temp.setTime( new Time( stime.getCurrentTime() ) );
985  temp.closeAsWrite();
987  ret = temp;
988  } catch (IOException ex){
989  ex.printStackTrace();
990  } catch (Exception ex) {
991  ex.printStackTrace();
992  }
993  }
994  return ret;
995  }
996 
997  private void _saveCSV() {
998  DirectoryDialog ddlg = new DirectoryDialog(GrxUIPerspectiveFactory.getCurrentShell());
999  try {
1000  ddlg.setFilterPath(getDefaultDir().getCanonicalPath());
1001  } catch (IOException e1) {
1002  // TODO 自動生成された catch ブロック
1003  e1.printStackTrace();
1004  }
1005  final String dir = ddlg.open();
1006  if (dir != null){
1007  Thread t = new Thread() {
1008  public void run() {
1009  LogManager temp = null;
1010  if( !useDisk_ ){
1011  // オンメモリデータをファイルへ
1012  temp = _restoreLogFileFromSuperLog();
1013  }
1014  for (int i=0; i<preStat_.charList.size(); i++) {
1015  String name = preStat_.charList.get(i).characterName;
1016  String fname = dir+File.separator+name+".csv"; //$NON-NLS-1$
1017  try {
1018  if( useDisk_ ){
1019  logger_.saveCSV(fname, name);
1020  }else{
1021  // オンメモリデータをファイルへ
1022  if(temp != null){
1023  temp.saveCSV(fname, name);
1024  }
1025  }
1026  } catch (FileOpenFailException e) {
1027  e.printStackTrace();
1028  }
1029  }
1030  if(temp != null && temp != logger_){
1031  temp.closeReads();
1032  }
1033  }
1034  };
1035  t.start();
1036  setDefaultDirectory(dir);
1037  }
1038  }
1039 
1040  public Double getTime(int pos) {
1041  if (pos < 0)
1042  return null;
1043  Double t = super.getTime(pos);
1044  if (t == null && lastCharName_ != null) {
1045  try {
1046  float[] f = logger_.get(lastCharName_, pos);
1047  t = (double)f[0];
1048  setTimeAt(pos, t);
1049  } catch (IOException e) {
1050  e.printStackTrace();
1051  }
1052  }
1053  return t;
1054  }
1055 
1056  public void extendTime(double time) {
1057  SimulationTime stime = new SimulationTime();
1058  stime.setCurrentTime(preStat_.time);
1059  stime.setStartTime(preStat_.time);
1060 
1061  double val = getDbl("logTimeStep",0.001); //$NON-NLS-1$
1062  stime.setTimeStep(val);
1063  setDbl("logTimeStep",val); //$NON-NLS-1$
1064 
1065  stime.setTotalTime(time);
1066 
1067  //logger_.initCollisionLog(stime);
1068  logger_.extendTime(stime);
1069  }
1070 
1071  public void stopSimulation(){
1072  if (useDisk_)
1073  logger_.closeWrites();
1074  }
1075 
1076  public boolean isUseDsik(){ return useDisk_; }
1077 
1082  public void setPosition(Integer pos) {
1083  if (super.setPosition(pos))
1084  notifyPosition(pos);
1085  }
1086 
1087  // viewで指定された以外に通知 //
1088  public void setPosition(Integer pos, GrxBaseView view) {
1089  if (super.setPosition(pos)){
1090  ListIterator<GrxPositionObserver> it = pos_obs_.listIterator();
1091  while (it.hasNext()) {
1092  GrxPositionObserver pos_ob = it.next();
1093  if(pos_ob != view)
1094  pos_ob.updatePosition(this ,pos);
1095  }
1096  }
1097  }
1098 
1099  private ArrayList<GrxPositionObserver> pos_obs_ = new ArrayList<GrxPositionObserver>();
1100 
1102  pos_obs_.add(v);
1103  }
1104 
1106  pos_obs_.remove(v);
1107  }
1108 
1109  private void notifyPosition(Integer pos){
1110  ListIterator<GrxPositionObserver> it = pos_obs_.listIterator();
1111  while (it.hasNext()) {
1112  GrxPositionObserver pos_ob = it.next();
1113  pos_ob.updatePosition(this, pos);
1114  }
1115  }
1116 
1117  public static class WorldStateEx {
1118  public double time;
1119  public Collision[] collisions;
1120  private List<CharacterStateEx> charList = new ArrayList<CharacterStateEx>();
1121  private Map<String, CharacterStateEx> charMap = new HashMap<String, CharacterStateEx>();
1122 
1123  public WorldStateEx() {}
1124 
1125  public WorldStateEx(WorldState wstate) {
1126  setWorldState(wstate);
1127  }
1128 
1129  public CharacterStateEx get(int idx) {
1130  return charList.get(idx);
1131  }
1132 
1133  public CharacterStateEx get(String charName) {
1134  return charMap.get(charName);
1135  }
1136 
1137  private CharacterStateEx _get(String charName) {
1138  CharacterStateEx c = get(charName);
1139  if (c == null) {
1140  c = new CharacterStateEx();
1141  c.characterName = charName;
1142  charMap.put(charName, c);
1143  charList.add(c);
1144  }
1145  return c;
1146  }
1147 
1148  public int size() {
1149  return charList.size();
1150  }
1151 
1152  public String[] characters() {
1153  String[] chars = new String[charList.size()];
1154  for (int i=0; i<charList.size(); i++)
1155  chars[i] = charList.get(i).characterName;
1156  return chars;
1157  }
1158 
1159  public void setWorldState(WorldState wstate) {
1160  time = wstate.time;
1161  collisions = wstate.collisions;
1162  for (int i=0; i<wstate.characterPositions.length; i++) {
1163  _get(wstate.characterPositions[i].characterName).position =
1164  wstate.characterPositions[i].linkPositions;
1165  }
1166  }
1167 
1168  public void setSensorState(String charName, SensorState state) {
1169  _get(charName).sensorState = state;
1170  }
1171 
1172  public void setTargetState(String charName, double[] targets) {
1173  _get(charName).targetState = targets;
1174  }
1175 
1176  public void setServoState(String charName, int[] servoStat) {
1177  _get(charName).servoState = servoStat;
1178  }
1179 
1180  public void setPowerState(String charName, double voltage, double current){
1181  _get(charName).powerState = new double[]{voltage, current};
1182  }
1183 
1184  protected Object clone() throws CloneNotSupportedException{
1185  WorldStateEx ret = new WorldStateEx();
1186  ret.time = time;
1187  if(collisions != null){
1188  ret.collisions = new Collision[]{new Collision()};
1189  ret.collisions[0].points = collisions[0].points;
1190  }
1191  for(CharacterStateEx i:charList){
1192  ret.charList.add((CharacterStateEx)i.clone());
1193  }
1194  for (String i:charMap.keySet()){
1195  ret.charMap.put(new String(i), (CharacterStateEx)charMap.get(i).clone());
1196  }
1197  return ret;
1198  }
1199  }
1200 
1201  public static class CharacterStateEx {
1202  public String characterName;
1203  public LinkPosition[] position;
1204  public SensorState sensorState;
1205  public double[] targetState;
1206  public int[] servoState;
1207  public double[] powerState;
1208 
1209  protected Object clone() throws CloneNotSupportedException{
1211  ret.characterName = new String( characterName );
1212  if(position != null){
1213  ret.position = new LinkPosition[ position.length ];
1214  for(int i = 0; i < position.length; ++i){
1215  ret.position[i] = new LinkPosition();
1216  if(position[i].p != null){
1217  ret.position[i].p = new double[position[i].p.length];
1218  GrxCopyUtil.copyDim(position[i].p, ret.position[i].p, position[i].p.length);
1219  }
1220  if(position[i].R != null){
1221  ret.position[i].R = new double[position[i].R.length];
1222  GrxCopyUtil.copyDim(position[i].R, ret.position[i].R, position[i].R.length);
1223  }
1224  }
1225  }
1226  if(sensorState != null){
1227  ret.sensorState = new SensorState();
1228  if( sensorState.accel != null){
1229  ret.sensorState.accel = GrxCopyUtil.copyDoubleWDim(sensorState.accel);
1230  }
1231  if(sensorState.force != null){
1232  ret.sensorState.force = GrxCopyUtil.copyDoubleWDim(sensorState.force);
1233  }
1234  if(sensorState.range != null){
1235  ret.sensorState.range = GrxCopyUtil.copyDoubleWDim(sensorState.range);
1236  }
1237  if(sensorState.rateGyro != null){
1238  ret.sensorState.rateGyro = GrxCopyUtil.copyDoubleWDim(sensorState.rateGyro);
1239  }
1240  if(sensorState.dq != null){
1241  ret.sensorState.dq = new double[sensorState.dq.length];
1242  GrxCopyUtil.copyDim(sensorState.dq, ret.sensorState.dq, sensorState.dq.length);
1243  }
1244  if(sensorState.q != null){
1245  ret.sensorState.q = new double[sensorState.q.length];
1246  GrxCopyUtil.copyDim(sensorState.q, ret.sensorState.q, sensorState.q.length);
1247  }
1248  if(sensorState.u != null){
1249  ret.sensorState.u = new double[sensorState.u.length];
1250  GrxCopyUtil.copyDim(sensorState.u, ret.sensorState.u, sensorState.u.length);
1251  }
1252  }
1253  if(targetState != null){
1254  ret.targetState = new double[targetState.length];
1255  GrxCopyUtil.copyDim(targetState, ret.targetState, targetState.length);
1256  }
1257  if(servoState != null){
1258  ret.servoState = new int[servoState.length];
1259  GrxCopyUtil.copyDim(servoState, ret.servoState, servoState.length);
1260  }
1261  if(powerState != null){
1262  ret.powerState = new double[powerState.length];
1263  GrxCopyUtil.copyDim(powerState, ret.powerState, powerState.length);
1264  }
1265  return ret;
1266  }
1267  }
1268 
1269  private static class SensorInfoLocal implements Comparable {
1270  String name;
1271  String type; //#####[Changed] int -> string u5・Xl"・I
1272  int id;
1273  SensorInfo info;
1274  public SensorInfoLocal(SensorInfo _info) {
1275  info = _info;
1276  name = info.name;
1277  // ##### [Changed] NewModelLoader.IDL
1278  //if( info.type.equals("Force") )
1279  //{
1280  //type = Integer.valueOf(SensorType.FORCE_SENSOR).intValue();
1281  //}
1282  //else if( info.type.equals("RateGyro") )
1283  //{
1284  //type = SensorType.RATE_GYRO;
1285  //}
1286  //else if( info.type.equals("Acceleration") )
1287  //{
1288  //type = SensorType.ACCELERATION_SENSOR;
1289  //}
1290  // type = info.type.value();
1291  type = info.type;
1292  // ###### [Changed]
1293 
1294 
1295  id = info.id;
1296  }
1297 
1298  public int compareTo(Object o) {
1299  if (o instanceof SensorInfoLocal) {
1300  SensorInfoLocal s = (SensorInfoLocal) o;
1301  int _this = getOrder(type);
1302  int _s = getOrder(s.type);
1303  if (_this < _s)
1304  return -1;
1305  else if (_this == _s){
1306  if (id < s.id)
1307  return -1;
1308  }else
1309  return 1;
1310  }
1311  return 1;
1312  }
1313 
1314  private int getOrder(String type) {
1315  if (type.equals("Force")) //$NON-NLS-1$
1316  return 0;
1317  else if (type.equals("RateGyro")) //$NON-NLS-1$
1318  return 1;
1319  else if (type.equals("Acceleration")) //$NON-NLS-1$
1320  return 2;
1321  else if (type.equals("Vision")) //$NON-NLS-1$
1322  return 3;
1323  else if (type.equals("Range")) //$NON-NLS-1$
1324  return 4;
1325  else
1326  return -1;
1327 
1328 
1329  }
1330 
1331  }
1332 
1333  public void delete(){
1334  if(useDisk_)
1335  logger_.closeReads();
1336  super.delete();
1337  }
1338 
1339 }
void _createOverLog(double currentTime, double startTime, int changePos, int overPos)
void setSensorState(String charName, SensorState state)
static final String get(String key)
int c
Definition: autoplay.py:16
png_infop png_charp png_int_32 png_int_32 int * type
Definition: png.h:2332
void addLogObject(String objectName, String[] format)
#define null
our own NULL pointer
Definition: IceTypes.h:57
png_uint_32 size
Definition: png.h:1521
png_infop png_charpp name
Definition: png.h:2382
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
void setTargetState(String charName, double[] targets)
png_uint_32 i
Definition: png.h:2735
void putCollisionPointData(CollisionPoint[] data)
final void setDbl(String key, double value)
associate double value to key
static double [][] copyDoubleWDim(double[][] src)
void save(String fileName, String prjFileName)
int method
Definition: png.h:1847
list index
def run(tree, args)
int val
Definition: jpeglib.h:956
t
void updatePosition(GrxBasePlugin plugin, Integer pos)
void initCollisionLog(SimulationTime time)
void _addValueToLogFromSuperLog(Double t, Object obj, LogManager temp)
void setPosition(Integer pos, GrxBaseView view)
void openAsWrite(SimulationTime time, String method)
final Double getDbl(String key, Double defaultVal)
get double value associated to key
id
void put(String objectName, float[] data)
final String getStr(String key)
get value associated to keyword
typedef int
Definition: png.h:1113
static< T > void copyDim(T src, T dest, int length)
backing_store_ptr info
Definition: jmemsys.h:181
プラグイン管理クラス GrxUIの核になるクラス。プラグインのロード等の、初期化を実行する。 プラグインとそ...
void separateLogs(final int changePos)
png_infop png_bytep buffer
Definition: png.h:2042
def getText(self, nodes=None)
#define local
Definition: crc32.c:31
org
void _loadLog(File logFile, IProgressMonitor monitor)
GrxWorldStateItem(String name, GrxPluginManager manager)
void setPowerState(String charName, double voltage, double current)
void saveCSV(String fileName, String ObjectName)


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Sep 8 2022 02:24:03