Class Object3d

java.lang.Object
  |
  +--Object3d
Direct Known Subclasses:
Graspable, Hand

class Object3d
extends java.lang.Object

Author:
Erhan Oztop, 2001-2002

Source code by Erhan Oztop (erhan@atr.co.jp)
Copyright August 2002 via
University of Southern California Ph.D. publication copyright

Field Summary
 Reach activeReachThread
           
(package private) static int bab_ph_GRASP1
           
(package private) static int bab_ph_NONE
           
(package private) static int bab_ph_REACH1
           
(package private) static int bab_ph_REACH2
           
(package private) static int bab_ph_WRIST1
           
(package private) static int bab_ph_WRIST2
           
private  boolean babble
           
(package private) static int BABBLE
           
(package private) static int babble_GRASPFAIL
           
(package private) static int babble_GRASPOK
           
(package private) static int babble_GRASPON
           
(package private)  int babble_phase
           
(package private) static int babble_REACH1FAIL
           
(package private) static int babble_REACH1OK
           
(package private) static int babble_REACH1ON
           
(package private) static int babble_REACH2FAIL
           
(package private) static int babble_REACH2OK
           
(package private) static int babble_REACH2ON
           
(package private) static int babble_ROTATEFAIL
           
(package private) static int babble_ROTATEOK
           
(package private) static int babble_ROTATEON
           
(package private)  int babble_steps
           
(package private)  int babble_succ
           
(package private)  int babble_trials
           
(package private) static int babbleGradIt
           
(package private)  Point3d babbleOffset
           
(package private) static int babbleReach1MaxTick
           
(package private) static int babbleReach2MaxTick
           
(package private)  int babbleStatus
           
(package private) static double babbleZero
           
(package private)  double basetimestep
           
(package private)  double[] bestConfig
           
(package private)  double[][] betas
           
(package private)  Segment bj1
           
(package private)  Segment bj2
           
(package private)  Segment bj3
           
(package private)  Segment bj4
           
(package private)  int blockc
           
 boolean callexe
           
(package private)  boolean chopped
           
private  int clx
           
private  int cly
           
private  int clz
           
 java.lang.String com
           
(package private)  double costThreshold
           
(package private)  double cRATE
           
(package private)  double dis
           
(package private)  double[] dTeta
           
(package private)  int encloseTime
           
private  Point3d end
           
private  Segment endeff
           
(package private)  double endtime
           
(package private) static int EXECUTE
           
(package private)  int finger_trials
           
(package private)  double goodZ
           
(package private)  double[] graspConfig
           
(package private)  Hand h
           
 int[] hindex
           
 int hpc
           
 Plane[] hplist
           
(package private) static int infoRate
           
(package private)  java.lang.String infoStr
           
(package private)  int infoStrC
           
(package private)  double[] initialConfig
           
private  Point3d intemp
           
(package private)  double[][] J
           
(package private)  double JACOBIAN_th
           
(package private)  Spline[] jointpath
           
(package private)  Segment kol
           
(package private)  double l1
           
(package private)  double l2
           
 double lasterr
           
(package private)  double[] lastOK
           
(package private)  Trajectory lasttr
           
(package private)  int location_trials
           
private  boolean mapping
           
(package private)  int MAXBABBLE
           
private  int maxclx
           
private  int maxcly
           
private  int maxclz
           
(package private)  int MAXFINGER
           
(package private)  int MAXREACH
           
(package private)  int MAXROTATE
           
(package private)  Object3d merged
           
(package private)  double[] midteta
           
(package private)  double minCost
           
(package private)  double minTorque
           
(package private)  MotorPlan mp
           
(package private)  double negReinforcement
           
(package private)  boolean newBabbleAttempt
           
(package private)  boolean newPDFgrasp
           
 boolean noshow
           
private  boolean nslrun
           
 int ntick
           
(package private)  Graspable obj
           
 double objdepth
          Object view depth
 Point3d objectCenter
           
 double objectRadius
           
private  ObjectFrame of
           
(package private)  double offRandomness
           
 double offSave
           
 int offx
           
 int offy
           
static boolean ordered_pick
           
(package private)  java.lang.String[] params
           
(package private)  ParamsNode parnode
           
(package private)  int pdf_phase
           
(package private) static int PDFGRASP
           
(package private)  int PDFgraspc
           
 int PDFgraspcINI
           
(package private)  boolean PDFwristgrasp
           
(package private)  java.lang.String[] phaseStr
           
 double reach_basetime
           
 double reach_deltat
           
 double reach_speed
           
(package private)  double[] reach1Config
           
(package private)  int reach1failc
           
(package private)  double[] reach2Config
           
(package private)  java.lang.String Reach2Target
           
private  boolean recognize
           
private  boolean recordit
           
(package private)  Segment root
           
(package private)  int rotate_trials
           
(package private)  double[] rotateConfig
           
(package private)  double rotRandomness
           
 double rotSave
           
(package private)  double rtime
          Called when executing a stored trajectory.
(package private)  double[] save
           
 int search_mode
           
private  int search_phase
           
(package private)  double searchZ
           
(package private)  Segment[] seg
           
(package private)  int segc
           
(package private)  boolean showInfo
           
(package private) static int SILENT_SEARCH
           
(package private)  int slc
           
static int softcon
           
(package private)  double speed
           
(package private) static Plane[] sPL
           
(package private) static Point3d[] sPN
           
private  Point3d start
           
(package private)  double[] teta1
           
(package private)  double[] teta2
           
(package private)  double time
           
 int[] udef_d
           
 int udef_dc
           
 int[] udef_i
           
 int udef_ic
           
 Point3d[] udef_P
           
 int udef_Pc
           
 java.util.Vector userPoints
           
(package private) static int VISUAL_SEARCH
           
(package private)  double weightSave
           
private  CfgCell[][][] workCell
           
(package private) static double wristGain
           
(package private)  int[] xx
           
(package private)  int[] yy
           
(package private)  double zeroError
           
 
Constructor Summary
Object3d(java.lang.String s)
           
Object3d(java.lang.String s, int pipesidec, double piperad)
           
 
Method Summary
 void adduserPoints(Point3d p)
           
 void addWristData()
           
 void adjustPrecisionGrasp(double[] beta)
           
private  void advanceRotCnt()
           
 void chmod(int newstat)
           
 void clearTrajectory()
           
(package private)  void closeObjectFrame()
           
 int collisionRotate(Segment seg, double ang, Object3d o)
           
 void constrainedRotate(Segment seg, double ang)
           
 Reach createReachThread(java.lang.String com)
          Instantiates a reach thread and starts it.
 void disablePanels()
           
 void discardMerged()
           
 Gesture doGesture(java.lang.String nm)
          ERH2001: looks like only for .cfg gesture execution
private  boolean doneRotCnt()
           
 Reach doReach(Graspable ob, java.lang.String kind)
          ERH2001: Main reach/grasp starting entry.
 void drawSkel(java.awt.Graphics g)
           
 void drawSkel(java.awt.Graphics g, Segment seg)
           
 void drawSolid(java.awt.Graphics g)
           
 void drawSolid(java.awt.Graphics g, Segment seg)
           
 void drawWire(java.awt.Graphics g)
           
 void drawWire(java.awt.Graphics g, Segment seg)
           
 void enablePanels()
           
 void endInvKinMap()
           
 double estimateSize()
           
 void finalizeReach(java.lang.String com)
           
 double[] findJointAngles(int giveup)
          Inverse kinematics.
 int findSegment(java.lang.String s)
           
 Reach fireBabbleLearn()
           
 Reach fireExecution()
           
 Reach firePDFgrasp()
           
 Reach firePDFwristgrasp()
           
 Reach fireSilentSearch()
           
 Reach fireVisualSearch()
           
 int get_segIndex(java.lang.String name)
           
 int getActionSelection()
          1 return: original randomness 0 return: 0 randomness
 double[] getAngleList()
           
(package private)  Segment getJoint(java.lang.String name)
           
(package private)  int getSegmentIndex(java.lang.String name)
           
 Point3d[] getuserPoints()
           
private  double gradientDescent_arm(int N, double rate)
           
private  double gradientDescent_wrist(int N, double rate)
           
 double gradientDescent(int N, double lrate)
           
 boolean hitConstraint(Segment seg, double ang)
          checks if the joint constraint would be hit if rotated ang radians.
 boolean inside(Point3d p)
           
 void installCfg(java.lang.String nm)
          use a .cfg files destination configuration and install it
private  double jacobianTranspose(int N, double rate)
           
(package private)  boolean kill_ifActive()
           
 int lineIntersection(Point3d p, Point3d u, Plane[] PL, Point3d[] PN)
          returns the intersections (for now 2) of the object with the line passing through point p with direction vector u.
 CfgCell[][][] makeInvKinMap(int cellx, int celly, int cellz, Point3d start, Point3d end)
           
 void mergeObject(Object3d m)
           
 void moveto(double x, double y, double z)
           
 void moveto(Point3d R)
           
 double new_segmentCollision(Segment seg, Object3d o)
           
private  void newBabbleAttempt_init()
           
 void nextCell()
           
 void paintAllSurfaces(int fillc, int linec)
           
 void pdf_chmod(int newstat)
           
 void PDFcondKill()
           
private  void pickNoisyRotation(MotorPlan mp, double c)
           
private  void pickRotation(MotorPlan mp)
           
private  double pow(double x, double pw)
           
 void project()
           
(package private)  void project(Eye eye)
           
(package private)  boolean reachActive()
           
 void rect_moveto(double x, double y, double z)
           
 void rect_moveto(Point3d newposition)
           
 Point3d reinforceGrasp(Hand h, Object3d obj)
           
private  void resetRotCnt()
           
private  void resetRotCnt(int max)
           
 void restoreAngles(double[] teta)
           
 void restoreChildren(double[] init, java.lang.String s)
           
 void restoreChildren(java.lang.String s)
           
 double segmentCollision(Object3d o)
           
 int segmentIntersection(Segment seg, Plane[] pl, Point3d[] pn)
           
 void set2doffset(int ox, int oy)
           
 void setCell(double err)
           
 void setJointAngle(Segment seg, double ang)
           
 void setJointConstraint(Segment s, double min, double max)
           
 void setPlaneProperties()
           
 void setupObject()
           
(package private)  void showObjectFrame()
           
 int sideOF(Plane p)
          check whether the object is in either side of P.
 void sortPlanes(int mode)
           
 void startReach()
           
 void storeAngles(double[] teta)
           
 void tickBabble()
           
 void tickGesture(Gesture g, Spline[] jointpath, double speed)
           
 void tickPDFgrasp()
           
 void tickReachGesture(Reach r, Trajectory tr)
           
 void tickSilent(Reach r)
           
 void tickVisual(Reach r)
           
 void tickWrist(Hand h, MotorPlan mp)
           
 java.lang.String toggleActionSelection()
           
(package private)  void toggleObjectFrame()
           
 Trajectory trimTrajectory(double[] targetangles)
           
 void truncateChildren(java.lang.String s)
           
 void updateObjectDepth()
           
 void weighted_restoreAngles(double[] teta, double W)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

udef_i

public int[] udef_i

udef_ic

public int udef_ic

udef_d

public int[] udef_d

udef_dc

public int udef_dc

udef_P

public Point3d[] udef_P

udef_Pc

public int udef_Pc

userPoints

public java.util.Vector userPoints

hindex

public int[] hindex

hplist

public Plane[] hplist

hpc

public int hpc

objectCenter

public Point3d objectCenter

objectRadius

public double objectRadius

noshow

public boolean noshow

objdepth

public double objdepth
Object view depth

offx

public int offx

offy

public int offy

seg

Segment[] seg

segc

int segc

root

Segment root

jointpath

Spline[] jointpath

teta1

double[] teta1

teta2

double[] teta2

midteta

double[] midteta

lasttr

Trajectory lasttr

intemp

private Point3d intemp

workCell

private CfgCell[][][] workCell

clx

private int clx

cly

private int cly

clz

private int clz

maxclx

private int maxclx

maxcly

private int maxcly

maxclz

private int maxclz

start

private Point3d start

end

private Point3d end

endeff

private Segment endeff

sPN

static Point3d[] sPN

sPL

static Plane[] sPL

merged

Object3d merged

of

private ObjectFrame of

xx

int[] xx

yy

int[] yy

zeroError

double zeroError

betas

double[][] betas

reach_speed

public double reach_speed

reach_deltat

public double reach_deltat

reach_basetime

public double reach_basetime

time

double time

endtime

double endtime

basetimestep

double basetimestep

ntick

public int ntick

activeReachThread

public Reach activeReachThread

com

public java.lang.String com

search_mode

public int search_mode

VISUAL_SEARCH

static final int VISUAL_SEARCH

SILENT_SEARCH

static final int SILENT_SEARCH

EXECUTE

static final int EXECUTE

BABBLE

static final int BABBLE

PDFGRASP

static final int PDFGRASP

callexe

public boolean callexe

save

double[] save

chopped

boolean chopped

PDFgraspcINI

public int PDFgraspcINI

PDFwristgrasp

boolean PDFwristgrasp

PDFgraspc

int PDFgraspc

lasterr

public double lasterr

speed

double speed

kol

Segment kol

search_phase

private int search_phase

mapping

private boolean mapping

recordit

private boolean recordit

recognize

private boolean recognize

nslrun

private boolean nslrun

babble

private boolean babble

obj

Graspable obj

rtime

double rtime
Called when executing a stored trajectory.

bj1

Segment bj1

bj2

Segment bj2

bj3

Segment bj3

bj4

Segment bj4

babbleStatus

int babbleStatus

babble_REACH1ON

static int babble_REACH1ON

babble_REACH1OK

static int babble_REACH1OK

babble_REACH1FAIL

static int babble_REACH1FAIL

babble_REACH2ON

static int babble_REACH2ON

babble_REACH2OK

static int babble_REACH2OK

babble_REACH2FAIL

static int babble_REACH2FAIL

babble_GRASPON

static int babble_GRASPON

babble_GRASPOK

static int babble_GRASPOK

babble_GRASPFAIL

static int babble_GRASPFAIL

babble_ROTATEON

static int babble_ROTATEON

babble_ROTATEOK

static int babble_ROTATEOK

babble_ROTATEFAIL

static int babble_ROTATEFAIL

Reach2Target

java.lang.String Reach2Target

rotSave

public double rotSave

offSave

public double offSave

rotRandomness

double rotRandomness

offRandomness

double offRandomness

costThreshold

double costThreshold

negReinforcement

double negReinforcement

weightSave

double weightSave

cRATE

double cRATE

mp

MotorPlan mp

h

Hand h

parnode

ParamsNode parnode

params

java.lang.String[] params

wristGain

static double wristGain

newPDFgrasp

boolean newPDFgrasp

babbleZero

static double babbleZero

infoRate

static int infoRate

babbleGradIt

static int babbleGradIt

babbleReach1MaxTick

static int babbleReach1MaxTick

babbleReach2MaxTick

static int babbleReach2MaxTick

bab_ph_NONE

static int bab_ph_NONE

bab_ph_WRIST1

static int bab_ph_WRIST1

bab_ph_WRIST2

static int bab_ph_WRIST2

bab_ph_REACH1

static int bab_ph_REACH1

bab_ph_REACH2

static int bab_ph_REACH2

bab_ph_GRASP1

static int bab_ph_GRASP1

phaseStr

java.lang.String[] phaseStr

showInfo

boolean showInfo

infoStr

java.lang.String infoStr

infoStrC

int infoStrC

pdf_phase

int pdf_phase

babble_phase

int babble_phase

babble_steps

int babble_steps

babble_trials

int babble_trials

babble_succ

int babble_succ

reach1failc

int reach1failc

blockc

int blockc

newBabbleAttempt

boolean newBabbleAttempt

babbleOffset

Point3d babbleOffset

encloseTime

int encloseTime

lastOK

double[] lastOK

initialConfig

double[] initialConfig

reach1Config

double[] reach1Config

reach2Config

double[] reach2Config

rotateConfig

double[] rotateConfig

graspConfig

double[] graspConfig

bestConfig

double[] bestConfig

searchZ

double searchZ

goodZ

double goodZ

minTorque

double minTorque

minCost

double minCost

MAXREACH

int MAXREACH

MAXBABBLE

int MAXBABBLE

MAXROTATE

int MAXROTATE

location_trials

int location_trials

rotate_trials

int rotate_trials

MAXFINGER

int MAXFINGER

finger_trials

int finger_trials

JACOBIAN_th

double JACOBIAN_th

ordered_pick

public static final boolean ordered_pick

dis

double dis

slc

int slc

softcon

public static int softcon

l1

double l1

l2

double l2

J

double[][] J

dTeta

double[] dTeta
Constructor Detail

Object3d

public Object3d(java.lang.String s)

Object3d

public Object3d(java.lang.String s,
                int pipesidec,
                double piperad)
Method Detail

getuserPoints

public Point3d[] getuserPoints()

setPlaneProperties

public void setPlaneProperties()

estimateSize

public double estimateSize()

inside

public boolean inside(Point3d p)

adduserPoints

public void adduserPoints(Point3d p)

segmentCollision

public double segmentCollision(Object3d o)

new_segmentCollision

public double new_segmentCollision(Segment seg,
                                   Object3d o)

makeInvKinMap

public CfgCell[][][] makeInvKinMap(int cellx,
                                   int celly,
                                   int cellz,
                                   Point3d start,
                                   Point3d end)

sideOF

public int sideOF(Plane p)
check whether the object is in either side of P. 1: is normal side (check) -1:other side 0: means mixed (object intersects plane. Note that this is an approximation not all the vertex of the object is checked. Only the plane centers are used

startReach

public void startReach()

setCell

public void setCell(double err)

endInvKinMap

public void endInvKinMap()

nextCell

public void nextCell()

truncateChildren

public void truncateChildren(java.lang.String s)

segmentIntersection

public int segmentIntersection(Segment seg,
                               Plane[] pl,
                               Point3d[] pn)

lineIntersection

public int lineIntersection(Point3d p,
                            Point3d u,
                            Plane[] PL,
                            Point3d[] PN)
returns the intersections (for now 2) of the object with the line passing through point p with direction vector u.

restoreChildren

public void restoreChildren(java.lang.String s)

enablePanels

public void enablePanels()

disablePanels

public void disablePanels()

setJointConstraint

public void setJointConstraint(Segment s,
                               double min,
                               double max)

hitConstraint

public boolean hitConstraint(Segment seg,
                             double ang)
checks if the joint constraint would be hit if rotated ang radians.

constrainedRotate

public void constrainedRotate(Segment seg,
                              double ang)

collisionRotate

public int collisionRotate(Segment seg,
                           double ang,
                           Object3d o)

setJointAngle

public void setJointAngle(Segment seg,
                          double ang)

set2doffset

public void set2doffset(int ox,
                        int oy)

setupObject

public void setupObject()

paintAllSurfaces

public void paintAllSurfaces(int fillc,
                             int linec)

mergeObject

public void mergeObject(Object3d m)

discardMerged

public void discardMerged()

getAngleList

public double[] getAngleList()

showObjectFrame

void showObjectFrame()

closeObjectFrame

void closeObjectFrame()

toggleObjectFrame

void toggleObjectFrame()

getSegmentIndex

int getSegmentIndex(java.lang.String name)

getJoint

Segment getJoint(java.lang.String name)

project

void project(Eye eye)

updateObjectDepth

public void updateObjectDepth()

sortPlanes

public void sortPlanes(int mode)

drawWire

public void drawWire(java.awt.Graphics g,
                     Segment seg)

drawWire

public void drawWire(java.awt.Graphics g)

drawSolid

public void drawSolid(java.awt.Graphics g,
                      Segment seg)

drawSolid

public void drawSolid(java.awt.Graphics g)

drawSkel

public void drawSkel(java.awt.Graphics g)

drawSkel

public void drawSkel(java.awt.Graphics g,
                     Segment seg)

rect_moveto

public void rect_moveto(Point3d newposition)

rect_moveto

public void rect_moveto(double x,
                        double y,
                        double z)

moveto

public void moveto(double x,
                   double y,
                   double z)

moveto

public void moveto(Point3d R)

project

public void project()

installCfg

public void installCfg(java.lang.String nm)
use a .cfg files destination configuration and install it

doGesture

public Gesture doGesture(java.lang.String nm)
ERH2001: looks like only for .cfg gesture execution

tickGesture

public void tickGesture(Gesture g,
                        Spline[] jointpath,
                        double speed)

get_segIndex

public int get_segIndex(java.lang.String name)

adjustPrecisionGrasp

public void adjustPrecisionGrasp(double[] beta)

restoreChildren

public void restoreChildren(double[] init,
                            java.lang.String s)

restoreAngles

public void restoreAngles(double[] teta)

storeAngles

public void storeAngles(double[] teta)

weighted_restoreAngles

public void weighted_restoreAngles(double[] teta,
                                   double W)

fireSilentSearch

public Reach fireSilentSearch()

fireVisualSearch

public Reach fireVisualSearch()

firePDFwristgrasp

public Reach firePDFwristgrasp()

firePDFgrasp

public Reach firePDFgrasp()

fireBabbleLearn

public Reach fireBabbleLearn()

fireExecution

public Reach fireExecution()

createReachThread

public Reach createReachThread(java.lang.String com)
Instantiates a reach thread and starts it.

finalizeReach

public void finalizeReach(java.lang.String com)

reachActive

boolean reachActive()

kill_ifActive

boolean kill_ifActive()

trimTrajectory

public Trajectory trimTrajectory(double[] targetangles)

doReach

public Reach doReach(Graspable ob,
                     java.lang.String kind)
ERH2001: Main reach/grasp starting entry. All kinds of reaches, visearch, silet, execute, record etc. are started from here.

clearTrajectory

public void clearTrajectory()

tickReachGesture

public void tickReachGesture(Reach r,
                             Trajectory tr)

PDFcondKill

public void PDFcondKill()

tickWrist

public void tickWrist(Hand h,
                      MotorPlan mp)

tickPDFgrasp

public void tickPDFgrasp()

addWristData

public void addWristData()

pdf_chmod

public void pdf_chmod(int newstat)

newBabbleAttempt_init

private void newBabbleAttempt_init()

toggleActionSelection

public java.lang.String toggleActionSelection()

getActionSelection

public int getActionSelection()
1 return: original randomness 0 return: 0 randomness

tickBabble

public void tickBabble()

chmod

public void chmod(int newstat)

resetRotCnt

private void resetRotCnt(int max)

resetRotCnt

private void resetRotCnt()

advanceRotCnt

private void advanceRotCnt()

doneRotCnt

private boolean doneRotCnt()

pickRotation

private void pickRotation(MotorPlan mp)

pickNoisyRotation

private void pickNoisyRotation(MotorPlan mp,
                               double c)

reinforceGrasp

public Point3d reinforceGrasp(Hand h,
                              Object3d obj)

tickVisual

public void tickVisual(Reach r)

tickSilent

public void tickSilent(Reach r)

gradientDescent

public double gradientDescent(int N,
                              double lrate)

gradientDescent_wrist

private double gradientDescent_wrist(int N,
                                     double rate)

gradientDescent_arm

private double gradientDescent_arm(int N,
                                   double rate)

pow

private double pow(double x,
                   double pw)

jacobianTranspose

private double jacobianTranspose(int N,
                                 double rate)

findJointAngles

public double[] findJointAngles(int giveup)
Inverse kinematics. Find the joint angles given the target

findSegment

public int findSegment(java.lang.String s)