本文整理了Java中us.ihmc.simulationconstructionset.SimulationConstructionSet.setTime()
方法的一些代码示例,展示了SimulationConstructionSet.setTime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SimulationConstructionSet.setTime()
方法的具体详情如下:
包路径:us.ihmc.simulationconstructionset.SimulationConstructionSet
类名称:SimulationConstructionSet
方法名:setTime
暂无
代码示例来源:origin: us.ihmc/RobotDataCommunication
@Override
public void receivedTimestampAndData(long timestamp, ByteBuffer buffer)
{
long delay = TimeTools.nanoSecondsToMillis(lastTimestamp - timestamp);
delayValue.setText(delayFormat.format(delay));
if (recording)
{
for (int i = 0; i < jointUpdaters.size(); i++)
{
jointUpdaters.get(i).update();
}
scs.setTime(TimeTools.nanoSecondstoSeconds(timestamp));
scs.tickAndUpdate();
}
}
代码示例来源:origin: us.ihmc/IHMCRobotDataVisualizer
@Override
public void receivedTimestampAndData(long timestamp, ByteBuffer buffer)
{
long delay = TimeTools.nanoSecondsToMillis(lastTimestamp - timestamp);
delayValue.setText(delayFormat.format(delay));
if (recording)
{
for (int i = 0; i < jointUpdaters.size(); i++)
{
jointUpdaters.get(i).update();
}
scs.setTime(TimeTools.nanoSecondstoSeconds(timestamp));
scs.tickAndUpdate();
}
}
代码示例来源:origin: us.ihmc/ihmc-robot-data-visualizer
@Override
public void receivedTimestampAndData(long timestamp)
{
if(++counter % displayOneInNPackets == 0)
{
long delay = Conversions.nanosecondsToMilliseconds(lastTimestamp - timestamp);
delayValue.setText(delayFormat.format(delay));
for (int i = 0; i < jointUpdaters.size(); i++)
{
jointUpdaters.get(i).update();
}
scs.setTime(Conversions.nanosecondsToSeconds(timestamp));
updateLocalVariables();
scs.tickAndUpdate();
}
}
代码示例来源:origin: us.ihmc/ihmc-footstep-planning-test
@Override
public void tickAndUpdate()
{
scs.setTime(time.getDoubleValue());
scs.tickAndUpdate();
time.add(1.0);
}
代码示例来源:origin: us.ihmc/IHMCAvatarInterfaces
public void variableChanged(YoVariable yoVariable)
{
System.out.println("Load Sequence Listener");
JFileChooser chooser = new JFileChooser(new File("PoseSequences"));
int approveOption = chooser.showOpenDialog(null);
if (approveOption != JFileChooser.APPROVE_OPTION)
{
System.err.println("Can not load selected file :" + chooser.getName());
return;
}
File selectedFile = chooser.getSelectedFile();
PlaybackPoseSequence sequence = new PlaybackPoseSequence(fullRobotModelForSlider);
PlaybackPoseSequenceReader.appendFromFile(sequence, selectedFile);
double startTime = 0.0;
double time = startTime;
double dt = controlDT;
interpolator.startSequencePlayback(sequence, startTime);
while (!interpolator.isDone())
{
time = time + dt;
scs.setTime(time);
scs.tickAndUpdate();
}
}
}
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces
public void notifyOfVariableChange(YoVariable yoVariable)
{
System.out.println("Load Sequence Listener");
JFileChooser chooser = new JFileChooser(new File("PoseSequences"));
int approveOption = chooser.showOpenDialog(null);
if (approveOption != JFileChooser.APPROVE_OPTION)
{
System.err.println("Can not load selected file :" + chooser.getName());
return;
}
File selectedFile = chooser.getSelectedFile();
PlaybackPoseSequence sequence = new PlaybackPoseSequence(fullRobotModelForSlider);
PlaybackPoseSequenceReader.appendFromFile(sequence, selectedFile);
double startTime = 0.0;
double time = startTime;
double dt = controlDT;
interpolator.startSequencePlayback(sequence, startTime);
while (!interpolator.isDone())
{
time = time + dt;
scs.setTime(time);
scs.tickAndUpdate();
}
}
}
代码示例来源:origin: us.ihmc/DarpaRoboticsChallenge
public void variableChanged(YoVariable yoVariable)
{
System.out.println("Load Sequence Listener");
JFileChooser chooser = new JFileChooser(new File("PoseSequences"));
int approveOption = chooser.showOpenDialog(null);
if (approveOption != JFileChooser.APPROVE_OPTION)
{
System.err.println("Can not load selected file :" + chooser.getName());
return;
}
File selectedFile = chooser.getSelectedFile();
PlaybackPoseSequence sequence = new PlaybackPoseSequence(fullRobotModelForSlider);
PlaybackPoseSequenceReader.appendFromFile(sequence, selectedFile);
double startTime = 0.0;
double time = startTime;
double dt = controlDT;
interpolator.startSequencePlayback(sequence, startTime);
while (!interpolator.isDone())
{
time = time + dt;
scs.setTime(time);
scs.tickAndUpdate();
}
}
}
代码示例来源:origin: us.ihmc/IHMCAvatarInterfaces
public void variableChanged(YoVariable yoVariable)
{
PlaybackPose pose = new PlaybackPose(fullRobotModelForSlider, sdfRobot);
if (previousPose != null)
{
if (pose.epsilonEquals(previousPose, 1e-3, 1.0))
{
return;
}
}
System.out.println("Adding pose to sequence list: " + pose);
posePlaybackRobotPoseSequence.addPose(pose);
// FramePoint location = new FramePoint(ReferenceFrame.getWorldFrame(), Math.random(), Math.random(), Math.random());
// balls.setBall(location);
double dt = 0.01;
double morphTime = 1.0;
for (double time = 0.0; time < morphTime; time = time + dt)
{
scs.setTime(time);
scs.tickAndUpdate();
}
previousPose = pose;
}
代码示例来源:origin: us.ihmc/DarpaRoboticsChallenge
public void variableChanged(YoVariable yoVariable)
{
PlaybackPose pose = new PlaybackPose(fullRobotModelForSlider, sdfRobot);
if (previousPose != null)
{
if (pose.epsilonEquals(previousPose, 1e-3, 1.0))
{
return;
}
}
System.out.println("Adding pose to sequence list: " + pose);
posePlaybackRobotPoseSequence.addPose(pose);
// FramePoint location = new FramePoint(ReferenceFrame.getWorldFrame(), Math.random(), Math.random(), Math.random());
// balls.setBall(location);
double dt = 0.01;
double morphTime = 1.0;
for (double time = 0.0; time < morphTime; time = time + dt)
{
scs.setTime(time);
scs.tickAndUpdate();
}
previousPose = pose;
}
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces
public void notifyOfVariableChange(YoVariable yoVariable)
{
PlaybackPose pose = new PlaybackPose(fullRobotModelForSlider, sdfRobot);
if (previousPose != null)
{
if (pose.epsilonEquals(previousPose, 1e-3, 1.0))
{
return;
}
}
System.out.println("Adding pose to sequence list: " + pose);
posePlaybackRobotPoseSequence.addPose(pose);
// FramePoint location = new FramePoint(ReferenceFrame.getWorldFrame(), Math.random(), Math.random(), Math.random());
// balls.setBall(location);
double dt = 0.01;
double morphTime = 1.0;
for (double time = 0.0; time < morphTime; time = time + dt)
{
scs.setTime(time);
scs.tickAndUpdate();
}
previousPose = pose;
}
代码示例来源:origin: us.ihmc/ihmc-footstep-planning-test
public void addPlanarRegionsList(PlanarRegionsList planarRegions, AppearanceDefinition... appearances)
{
Graphics3DObject graphics3DObject = new Graphics3DObject();
Graphics3DObjectTools.addPlanarRegionsList(graphics3DObject, planarRegions, appearances);
scs.addStaticLinkGraphics(graphics3DObject);
scs.setTime(scs.getTime() + 1.0);
scs.tickAndUpdate();
}
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces
private void playLoadedSequence()
{
PlaybackPose morphedPose = interpolator.getPose(frameByframeTime);
while (!interpolator.isDone())
{
frameByframeTime = frameByframeTime + controlDT;
morphedPose = interpolator.getPose(frameByframeTime);
previousPose = morphedPose;
scs.setTime(frameByframeTime);
scs.tickAndUpdate();
//morphedPose.setRobotAtPose(sdfRobot);//don't update scs while playing back and connected to gazebo to avoid slider actuation delays
{
System.out.println("pose #: " + frameByframePoseNumber++ + " \t pausing for " + interpolator.getNextTransitionTimeDelay());
if (playOnlyOnePose)
{
morphedPose.setRobotAtPose(sdfRobot);// make sure scs ends in last pose
return;
}
}
ThreadTools.sleep((long) (controlDT * 1000));
}
morphedPose.setRobotAtPose(sdfRobot);// make sure scs ends in last pose
System.out.println("End of Play back");
}
代码示例来源:origin: us.ihmc/IHMCAvatarInterfaces
private void playLoadedSequence()
{
PlaybackPose morphedPose = interpolator.getPose(frameByframeTime);
while (!interpolator.isDone())
{
frameByframeTime = frameByframeTime + controlDT;
morphedPose = interpolator.getPose(frameByframeTime);
previousPose = morphedPose;
scs.setTime(frameByframeTime);
scs.tickAndUpdate();
//morphedPose.setRobotAtPose(sdfRobot);//don't update scs while playing back and connected to gazebo to avoid slider actuation delays
{
System.out.println("pose #: " + frameByframePoseNumber++ + " \t pausing for " + interpolator.getNextTransitionTimeDelay());
if (playOnlyOnePose)
{
morphedPose.setRobotAtPose(sdfRobot);// make sure scs ends in last pose
return;
}
}
ThreadTools.sleep((long) (controlDT * 1000));
}
morphedPose.setRobotAtPose(sdfRobot);// make sure scs ends in last pose
System.out.println("End of Play back");
}
代码示例来源:origin: us.ihmc/ihmc-footstep-planning-test
public void addPolygon(RigidBodyTransform transform, ConvexPolygon2D polygon, AppearanceDefinition appearance)
{
Graphics3DObject graphics3DObject = new Graphics3DObject();
graphics3DObject.transform(transform);
graphics3DObject.addPolygon(polygon, appearance);
scs.addStaticLinkGraphics(graphics3DObject);
scs.setTime(scs.getTime() + 1.0);
scs.tickAndUpdate();
}
代码示例来源:origin: us.ihmc/DarpaRoboticsChallenge
private void playLoadedSequence()
{
PlaybackPose morphedPose = interpolator.getPose(frameByframeTime);
while (!interpolator.isDone())
{
frameByframeTime = frameByframeTime + controlDT;
morphedPose = interpolator.getPose(frameByframeTime);
previousPose = morphedPose;
scs.setTime(frameByframeTime);
scs.tickAndUpdate();
//morphedPose.setRobotAtPose(sdfRobot);//don't update scs while playing back and connected to gazebo to avoid slider actuation delays
{
System.out.println("pose #: " + frameByframePoseNumber++ + " \t pausing for " + interpolator.getNextTransitionTimeDelay());
if (playOnlyOnePose)
{
morphedPose.setRobotAtPose(sdfRobot);// make sure scs ends in last pose
return;
}
}
ThreadTools.sleep((long) (controlDT * 1000));
}
morphedPose.setRobotAtPose(sdfRobot);// make sure scs ends in last pose
System.out.println("End of Play back");
}
代码示例来源:origin: us.ihmc/DarpaRoboticsChallenge
scs.setTime(time);
scs.tickAndUpdate();
代码示例来源:origin: us.ihmc/IHMCAvatarInterfaces
scs.setTime(time);
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces
scs.setTime(time);
代码示例来源:origin: us.ihmc/DarpaRoboticsChallenge
scs.setTime(time);
代码示例来源:origin: us.ihmc/simulation-construction-set-test
@Test// timeout = 30000
public void testTimingMethods() throws AWTException
{
scs.setDT(simulateDT, recordFrequency);
double simulateDTFromSCS = scs.getDT();
assertEquals(simulateDT, simulateDTFromSCS, epsilon);
scs.setRecordDT(recordDT);
double recordFreqFromSCS = scs.getRecordFreq();
assertEquals(recordFreq, recordFreqFromSCS, epsilon);
scs.setPlaybackRealTimeRate(realTimeRate);
double realTimeRateFromSCS = scs.getPlaybackRealTimeRate();
assertEquals(realTimeRate, realTimeRateFromSCS, epsilon);
scs.setPlaybackDesiredFrameRate(frameRate);
double frameRateFromSCS = scs.getPlaybackFrameRate();
assertEquals(recomputedSecondsPerFrameRate, frameRateFromSCS, epsilon);
int ticksPerCycle = computeTicksPerPlayCycle(simulateDT, recordFreq, realTimeRate, frameRate);
double ticksPerCycleFromSCS = scs.getTicksPerPlayCycle();
assertEquals(ticksPerCycle, ticksPerCycleFromSCS, epsilon);
scs.setTime(Math.PI);
double timeFromSCS = scs.getTime();
assertEquals(Math.PI, timeFromSCS, epsilon);
}
内容来源于网络,如有侵权,请联系作者删除!