Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draw log data to SVG for papers #376

Draft
wants to merge 44 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
47318ae
Add SCS 2 log data processor and generate SVG file of CoM trajectory.
calvertdw Sep 26, 2024
c6432ae
Plot the CoM trajectory and get it loading in Inkscape.
calvertdw Sep 27, 2024
8de4e95
Flip Y, plot footsteps.
calvertdw Sep 27, 2024
e18bb4a
Use better method for detecting footsteps and separate SVG from data …
calvertdw Sep 27, 2024
baaf7c5
Add a UI to manage logs.
calvertdw Sep 30, 2024
aa0e2e9
Making progress on log scrubber.
calvertdw Sep 30, 2024
dd61220
Iterate on log data processing.
calvertdw Oct 1, 2024
4069c74
Clean up code to add more stuff.
calvertdw Oct 2, 2024
c344d3e
Add working counter mismatch & number of walks.
calvertdw Oct 2, 2024
7ae7804
Rename foot state class.
calvertdw Oct 2, 2024
4a6c66f
Separating walks.
calvertdw Oct 2, 2024
e8fafa7
Load stats after writing them.
calvertdw Oct 2, 2024
c77c0d8
Fix stop processing.
calvertdw Oct 2, 2024
9638cef
Add process all button.
calvertdw Oct 2, 2024
fdd6185
Print and layout.
calvertdw Oct 4, 2024
ecd8cf5
Fix up SVG rendering.
calvertdw Oct 4, 2024
f110271
Improve plot visuals and plot ICP
calvertdw Oct 4, 2024
19c0454
Add arm joint positions.
calvertdw Oct 7, 2024
e5f32fe
Adding joint tracker.
calvertdw Oct 7, 2024
5571199
Sort log directories.
calvertdw Oct 7, 2024
a527407
Add legend.
calvertdw Oct 7, 2024
db1cb5e
Extract overhead SVG plot.
calvertdw Oct 7, 2024
95aef81
Homogenize naming.
calvertdw Oct 7, 2024
34dcd52
Add matplotlib4j
calvertdw Oct 7, 2024
4afa32f
Add times, save CSV pelvis poses, fix process all bug.
calvertdw Oct 8, 2024
55226f2
Draw footstep indexes.
calvertdw Oct 9, 2024
36b2de6
Work on extracting pelvis progress w.r.t. door frame.
calvertdw Oct 9, 2024
15ee213
Finish up on door progress plots.
calvertdw Oct 9, 2024
3d8fb45
Gather hand frames.
calvertdw Oct 12, 2024
f1317f5
Record hand poses to CSV.
calvertdw Oct 13, 2024
39d54a6
Plot hand data.
calvertdw Oct 13, 2024
1e0e58c
Drawing behavior tree to SVG.
calvertdw Oct 13, 2024
68ed862
Drawing behavior trees to SVG.
calvertdw Oct 13, 2024
bec497b
Drawing action sequence SVG.
calvertdw Oct 14, 2024
650f848
Lay out the concurrency.
calvertdw Oct 14, 2024
3ef8e25
Cascade the sequence.
calvertdw Oct 14, 2024
8ef5303
A few edits of SVG stuff.
calvertdw Oct 15, 2024
79fc0f3
Restructuring SVG to prepare to draw it differently.
calvertdw Oct 25, 2024
da2076f
Add node depth method.
calvertdw Oct 25, 2024
865d135
Add code before removing commented code.
calvertdw Oct 25, 2024
ce8de0c
Tool to get child index.
calvertdw Oct 25, 2024
cedec80
Building figures that fit in paper.
calvertdw Oct 25, 2024
439ed46
Start adding timeline of concurrent actions.
calvertdw Oct 25, 2024
385fd28
Code for not drawing the boxes.
calvertdw Oct 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ihmc-avatar-interfaces/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ mainDependencies {
api("com.martiansoftware:jsap:2.1")
api("org.apache.poi:poi:3.15") // I/O library for xls files.
api("com.hierynomus:sshj:0.32.0")
api("org.jfree:org.jfree.svg:5.0.6")
api("com.github.sh0nk:matplotlib4j:0.5.0")

api("us.ihmc:mecano-graphviz:17-0.18.1")
api("us.ihmc:scs2-bullet-simulation:17-0.27.3")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package us.ihmc.avatar.logProcessor;

import us.ihmc.yoVariables.variable.YoEnum;

public class SCS2LogEnum<E extends Enum<E>>
{
private final YoEnum<?> yoEnum;
private final Class<E> enumType;
private E lastValue = null;

public SCS2LogEnum(YoEnum<?> yoEnum, Class<E> enumType)
{
this.yoEnum = yoEnum;
this.enumType = enumType;
}

public E getValue()
{
for (E enumConstant : enumType.getEnumConstants())
{
if (yoEnum.getStringValue().equals(enumConstant.name()))
{
return enumConstant;
}
}

return null;
}

public boolean changedFrom(E fromValue)
{
return lastValue == fromValue && getValue() != fromValue;
}

public boolean changedTo(E toValue)
{
return getValue() == toValue && lastValue != toValue;
}

public void postUpdate()
{
E currentValue = getValue();
lastValue = currentValue;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package us.ihmc.avatar.logProcessor;

import us.ihmc.commonWalkingControlModules.controlModules.foot.FootControlModule.ConstraintType;
import us.ihmc.euclid.tuple2D.Point2D;
import us.ihmc.log.LogTools;
import us.ihmc.robotics.robotSide.RobotSide;
import us.ihmc.yoVariables.registry.YoRegistry;
import us.ihmc.yoVariables.variable.YoVariable;

import java.util.ArrayList;

public class SCS2LogFootState
{
private final RobotSide side;
private final SCS2LogEnum<ConstraintType> yoFootState;
private boolean newStep = false;
private double fullSupportTime = Double.NaN;
private YoVariable footPolygon_0_x ;
private YoVariable footPolygon_0_y ;
private YoVariable footPolygon_1_x ;
private YoVariable footPolygon_1_y ;
private YoVariable footPolygon_2_x ;
private YoVariable footPolygon_2_y ;
private YoVariable footPolygon_3_x ;
private YoVariable footPolygon_3_y ;
private final ArrayList<SCS2LogFootstep> footsteps = new ArrayList<>();
private final double comPlotProximityToFootsteps = 5.0;

public SCS2LogFootState(RobotSide side, SCS2LogEnum<ConstraintType> yoFootState, YoRegistry rootRegistry)
{
this.side = side;
this.yoFootState = yoFootState;

String highLevelController = "root.main.DRCControllerThread.DRCMomentumBasedController.HumanoidHighLevelControllerManager.";
String footPolygonPrefix = highLevelController + "HighLevelHumanoidControllerToolbox.BipedSupportPolygons.";
footPolygon_0_x = rootRegistry.findVariable(footPolygonPrefix + "%sFootPolygon_0_x".formatted(side.getLowerCaseName()));
footPolygon_0_y = rootRegistry.findVariable(footPolygonPrefix + "%sFootPolygon_0_y".formatted(side.getLowerCaseName()));
footPolygon_1_x = rootRegistry.findVariable(footPolygonPrefix + "%sFootPolygon_1_x".formatted(side.getLowerCaseName()));
footPolygon_1_y = rootRegistry.findVariable(footPolygonPrefix + "%sFootPolygon_1_y".formatted(side.getLowerCaseName()));
footPolygon_2_x = rootRegistry.findVariable(footPolygonPrefix + "%sFootPolygon_2_x".formatted(side.getLowerCaseName()));
footPolygon_2_y = rootRegistry.findVariable(footPolygonPrefix + "%sFootPolygon_2_y".formatted(side.getLowerCaseName()));
footPolygon_3_x = rootRegistry.findVariable(footPolygonPrefix + "%sFootPolygon_3_x".formatted(side.getLowerCaseName()));
footPolygon_3_y = rootRegistry.findVariable(footPolygonPrefix + "%sFootPolygon_3_y".formatted(side.getLowerCaseName()));
}

public boolean afterRead(double currentTime)
{
if (yoFootState.changedTo(ConstraintType.FULL))
{
newStep = true;
fullSupportTime = currentTime;
}
yoFootState.postUpdate();

if (newStep && currentTime - fullSupportTime > 0.1)
{
LogTools.info("%s step at %s".formatted(side.getPascalCaseName(), new Point2D(footPolygon_0_x.getValueAsDouble(), footPolygon_0_y.getValueAsDouble())));
footsteps.add(new SCS2LogFootstep(currentTime, side, new double[] {footPolygon_0_x.getValueAsDouble(),
footPolygon_1_x.getValueAsDouble(),
footPolygon_2_x.getValueAsDouble(),
footPolygon_3_x.getValueAsDouble(),
footPolygon_0_y.getValueAsDouble(),
footPolygon_1_y.getValueAsDouble(),
footPolygon_2_y.getValueAsDouble(),
footPolygon_3_y.getValueAsDouble()}));
newStep = false;
}

// recent footstep
return !Double.isNaN(fullSupportTime) && currentTime - fullSupportTime < comPlotProximityToFootsteps;
}

public ArrayList<SCS2LogFootstep> getFootsteps()
{
return footsteps;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package us.ihmc.avatar.logProcessor;

import us.ihmc.robotics.robotSide.RobotSide;

public class SCS2LogFootstep
{
private final double time;
private final RobotSide side;
private final double[] polygon;

public SCS2LogFootstep(double time, RobotSide side, double[] polygon)
{
this.time = time;
this.side = side;
this.polygon = polygon.clone();
}

public double getTime()
{
return time;
}

public RobotSide getSide()
{
return side;
}

public double[] getPolygon()
{
return polygon;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package us.ihmc.avatar.logProcessor;

import us.ihmc.yoVariables.variable.YoDouble;

public class SCS2LogJointTracker
{
private final YoDouble jointPosition;

public SCS2LogJointTracker(YoDouble jointPosition)
{
this.jointPosition = jointPosition;
}

public void update()
{

}
}
Loading
Loading