|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectshady.common.ShadyCommon
shady.sim.ShadySim
shady.sim.multi.MemberShadySim
public class MemberShadySim
MemberShady simulator implementation.
Copyright (C) 2006 Marsette A. Vona, III
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
| Nested Class Summary | |
|---|---|
protected class |
MemberShadySim.MemberGripperMotion
Extends MemberShadySim.MemberGripperMotion to synchronize on multiShadySim
while ShadySim.Motion.stepping if we have one. |
protected class |
MemberShadySim.MemberRotateMotion
Extends MemberShadySim.MemberRotateMotion to synchronize on multiShadySim
while ShadySim.Motion.stepping if we have one and to MultiEnvironment.place() as necessary. |
| Nested classes/interfaces inherited from class shady.sim.ShadySim |
|---|
ShadySim.BarrelMotion, ShadySim.GripperMotion, ShadySim.Motion, ShadySim.RotateMotion, ShadySim.ShadeMotion, ShadySim.SimultaneousMotion |
| Field Summary | |
|---|---|
private static java.lang.String |
cvsid
CVS id. |
protected int |
index
Our index in multiShadySim. |
protected MultiShadySimAPI |
multiShadySim
The MultiShadySim of which we're a member. |
| Fields inherited from class shady.sim.ShadySim |
|---|
discreteMode, SLEEP_GRANULARITY, STEP_TIME |
| Fields inherited from interface shady.common.ShadyCommonAPI |
|---|
CLOSED_STATE, COLLISION, ESTOP, GRIPPER_CLOSE, GRIPPER_OPEN, GRIPPER_OPERATION_TARGET_STATE, IMPLEMENTATION_FAULT, LEFT, LOW_BATTERY, MOTION_LIMIT, OPEN_STATE, OVER_CURRENT, OVER_TEMP, RIGHT, TILT, TIMEOUT, UNALIGNED, UNKNOWN, WOULD_COLLIDE, WOULD_DUEL, WOULD_MOTION_LIMIT, WOULD_TILT |
| Constructor Summary | |
|---|---|
MemberShadySim()
Create a MemberShadySim with no pose. |
|
MemberShadySim(ShadyPose pose)
Create a MemberShadySim with a given pose. |
|
| Method Summary | |
|---|---|
boolean |
bothGrippersClosed()
Check whether both grippers are closed. |
protected void |
closeGripperPost(int barrel,
Point.OnSegment gripPoint)
Last part of ShadyCommon.closeGripper(int, Point.OnSegment). |
protected void |
closeGripperPostImpl(int barrel,
Point.OnSegment gripPoint)
Implementation of openGripperPost(int), separated so that we can
synchronize on multiShadySim if we have one. |
int |
getIndex()
Get the zero-based index of this member in its MultiShady. |
MultiShadyCommonAPI |
getMultiShady()
Get the MultiShady to which this MemberShady belongs. |
protected vona.time.Clock |
makeClock()
Instantiate ShadyCommon.clock. |
protected ShadySim.GripperMotion |
makeGripperMotion(int barrel,
double ds)
Make a GripperMotion for ShadySim.reallySetGripper(int, double). |
protected ShadySim.RotateMotion |
makeRotateMotion(int barrel,
double dt)
Make a RotateMotion for ShadySim.reallyRotateBarrel(int, double). |
protected java.lang.Thread |
makeUpdateThread()
Instantiate ShadyCommon.updateThread. |
protected void |
openGripperPost(int barrel)
Last part of ShadyCommon.openGripper(int). |
protected void |
openGripperPostImpl(int barrel)
Implementation of openGripperPost(int), separated so that we can
synchronize on multiShadySim if we have one. |
protected int |
rotateBarrelPost(int barrel,
double dt,
double energy,
double time)
Third part of ShadyCommon.rotateBarrel(int, double). |
(package private) void |
setClockFromMulti(vona.time.Clock clock)
Hook so MultiShadySim can set our ShadyCommon.clock from its
constructor. |
void |
setIndex(int index)
Set the zero-based index of this member in its MultiShady. |
void |
setMultiShady(MultiShadyCommonAPI multiShady)
Set the MultiShady to which this MemberShady belongs. |
boolean |
setPose(ShadyPose newPose)
Set the mechanism pose (by copy). |
protected boolean |
setPoseImpl(ShadyPose newPose)
Implementation of setPose(shady.common.ShadyPose), separated so that we can
synchronize on multiShadySim if we have one. |
(package private) void |
updateFromMulti(double dt)
Update from MultiShadySim. |
protected boolean |
wouldDuel(boolean enableFault)
Check whether the barrels would duel on rotation. |
| Methods inherited from class shady.sim.ShadySim |
|---|
chargeBattery, doSimultaneousMotion, getAccel, getDiscreteMode, getGripperTime, getRotateBarrelTime, getRotateShadeTime, getShadyTime, pause, reallyRotateBarrel, reallyRotateShade, reallySetGripper, rechargeBattery, reset, rotateBarrel, rotateShade, setAccel, setDiscreteMode, setGripper, shadySleep, stop, unPause |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface shady.common.multi.MemberShadyCommonAPI |
|---|
setFault |
| Methods inherited from interface shady.sim.ShadySimAPI |
|---|
chargeBattery, getAccel, getDiscreteMode, getShadyTime, pause, rechargeBattery, setAccel, setDiscreteMode, shadySleep, unPause |
| Field Detail |
|---|
private static final java.lang.String cvsid
CVS id.
protected int index
Our index in multiShadySim.
protected MultiShadySimAPI multiShadySim
The MultiShadySim of which we're a member.
| Constructor Detail |
|---|
public MemberShadySim(ShadyPose pose)
Create a MemberShadySim with a given pose.
pose - the posepublic MemberShadySim()
Create a MemberShadySim with no pose.
| Method Detail |
|---|
public void setIndex(int index)
Set the zero-based index of this member in its MultiShady.
setIndex in interface MemberShadyCommonAPIindex - the zero-based index of this member in its MultiShady, or -1
to unsetpublic int getIndex()
Get the zero-based index of this member in its MultiShady.
getIndex in interface MemberShadyCommonAPIpublic void setMultiShady(MultiShadyCommonAPI multiShady)
Set the MultiShady to which this MemberShady belongs.
This impl requires multiShady to be a MultiShadySimAPI.
setMultiShady in interface MemberShadyCommonAPImultiShady - the MultiShady to which this MemberShady belongs, null
to unsetpublic MultiShadyCommonAPI getMultiShady()
Get the MultiShady to which this MemberShady belongs.
getMultiShady in interface MemberShadyCommonAPIpublic boolean bothGrippersClosed()
Check whether both grippers are closed.
bothGrippersClosed in interface MemberShadyCommonAPIprotected boolean wouldDuel(boolean enableFault)
Check whether the barrels would duel on rotation.
This impl considers a duel to be when both grippers are closed on
grounded MultiSegments.
wouldDuel in class ShadyCommonenableFault - whether to set a ShadyCommonAPI.WOULD_DUEL fault if the
barrels would duel and not ShadyCommon.wouldDuelOverride
protected ShadySim.RotateMotion makeRotateMotion(int barrel,
double dt)
Make a RotateMotion for ShadySim.reallyRotateBarrel(int, double).
This is a hook so subclasses can also subclass RotateMotion.
Params same as the ShadySim.RotateMotion constr.
This impl returns a new MemberShadySim.MemberRotateMotion.
makeRotateMotion in class ShadySimbarrel and
dt
protected int rotateBarrelPost(int barrel,
double dt,
double energy,
double time)
Third part of ShadyCommon.rotateBarrel(int, double).
Updates ShadyCommon.accountingInfo, and if any rotation occurred with the
distal gripper open, and we have a pose, unsets ShadyPose.distalPoint.
Extends superclass impl to MultiEnvironment.place() if we have a
valid pose, some rotation was performed, and bothGrippersClosed().
rotateBarrelPost in class ShadyCommonbarrel - same as for ShadyCommon.rotateBarrel(int, double)dt - the movement in degrees of barrelenergy - the energy used while rotating in Joules, or -1 if
unavailabletime - the time spent rotating in seconds
protected ShadySim.GripperMotion makeGripperMotion(int barrel,
double ds)
Make a GripperMotion for ShadySim.reallySetGripper(int, double).
This is a hook so subclasses can also subclass GripperMotion.
Params same as the ShadySim.GripperMotion constr.
This impl returns a new MemberShadySim.MemberGripperMotion.
makeGripperMotion in class ShadySimbarrel and
ds
protected void closeGripperPost(int barrel,
Point.OnSegment gripPoint)
Last part of ShadyCommon.closeGripper(int, Point.OnSegment).
If we have a pose and we just closed the distal barrel, then update
ShadyCommon.pose's ShadyPose.distalPoint.
Extends superclass impl to synchronize on multiShadySim if we
have one and to update the connectivity graph and MultiEnvironment.place().
closeGripperPost in class ShadyCommonbarrel - same as for ShadyCommon.closeGripper(int, Point.OnSegment)gripPoint - same as for ShadyCommon.closeGripper(int, Point.OnSegment)
protected void closeGripperPostImpl(int barrel,
Point.OnSegment gripPoint)
Implementation of openGripperPost(int), separated so that we can
synchronize on multiShadySim if we have one.
protected void openGripperPost(int barrel)
Last part of ShadyCommon.openGripper(int).
Conjugates ShadyCommon.pose if any and if necessary.
Extends superclass impl to synchronize on multiShadySim if we
have one and to update the connectivity graph and call MultiEnvironment.place().
openGripperPost in class ShadyCommonbarrel - same as for ShadyCommon.openGripper(int)protected void openGripperPostImpl(int barrel)
Implementation of openGripperPost(int), separated so that we can
synchronize on multiShadySim if we have one.
public boolean setPose(ShadyPose newPose)
Set the mechanism pose (by copy).
Note that if the distal barrel is closed after setting
newPose that newPose.distalPoint and
newPose.invertDistalSense must be valid and
consistent.
Extends superclass impl to synchronize on multiShadySim if we
have one and to update the connectivity graph.
setPose in interface ShadyCommonAPIsetPose in class ShadyCommonnewPose - the pose to set, null for none. State will be copied only
if pose and pose.state are not null.
protected boolean setPoseImpl(ShadyPose newPose)
Implementation of setPose(shady.common.ShadyPose), separated so that we can
synchronize on multiShadySim if we have one.
void updateFromMulti(double dt)
Update from MultiShadySim.
dt - time since last update in accelsecondsprotected vona.time.Clock makeClock()
Instantiate ShadyCommon.clock.
This is a hook to allow subclasses to implement the clock differently.
This impl just returns a new Clock.
This impl returns a new SuperClock.
Members reference the MultiShady's clock, so this impl returns null.
makeClock in class ShadySimvoid setClockFromMulti(vona.time.Clock clock)
Hook so MultiShadySim can set our ShadyCommon.clock from its
constructor.
protected java.lang.Thread makeUpdateThread()
Instantiate ShadyCommon.updateThread.
Default impl assumes we have a ShadyCommon.clock and returns a new
vona.time.AccelTime.PeriodicThread from ShadyCommon.clock that
calls ShadyCommon.update(double) with period ShadyCommon.getUpdateTime().
This is a hook to allow subclasses to implement the update thread differently.
Members don't have their own update threads, so this impl returns null.
makeUpdateThread in class ShadyCommon
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||