diff --git a/scs2-bullet-simulation/build.gradle.kts b/scs2-bullet-simulation/build.gradle.kts index 8746d430..a630b684 100644 --- a/scs2-bullet-simulation/build.gradle.kts +++ b/scs2-bullet-simulation/build.gradle.kts @@ -17,10 +17,10 @@ mainDependencies { api("us.ihmc:scs2-definition:source") api("us.ihmc:scs2-shared-memory:source") api("us.ihmc:scs2-session:source") - api("us.ihmc:euclid-frame-shape:0.21.0") + api("us.ihmc:euclid-frame-shape:0.22.2") api("us.ihmc:ihmc-messager:0.2.0") - api("us.ihmc:ihmc-yovariables:0.12.2") - api("us.ihmc:mecano-yovariables:17-0.18.1") + api("us.ihmc:ihmc-yovariables:0.13.3") + api("us.ihmc:mecano-yovariables:17-0.19.0") apiBytedecoNatives("javacpp") apiBytedecoNatives("bullet", "3.25-") diff --git a/scs2-definition/build.gradle.kts b/scs2-definition/build.gradle.kts index 96c163fe..545552ba 100644 --- a/scs2-definition/build.gradle.kts +++ b/scs2-definition/build.gradle.kts @@ -11,12 +11,12 @@ ihmc { } mainDependencies { - api("us.ihmc:euclid:0.21.0") - api("us.ihmc:euclid-shape:0.21.0") - api("us.ihmc:euclid-frame:0.21.0") - api("us.ihmc:ihmc-commons:0.32.0") - api("us.ihmc:ihmc-yovariables:0.12.2") - api("us.ihmc:mecano:17-0.18.1") + api("us.ihmc:euclid:0.22.2") + api("us.ihmc:euclid-shape:0.22.2") + api("us.ihmc:euclid-frame:0.22.2") + api("us.ihmc:ihmc-commons:0.34.0") + api("us.ihmc:ihmc-yovariables:0.13.3") + api("us.ihmc:mecano:17-0.19.0") } testDependencies { diff --git a/scs2-definition/src/main/java/us/ihmc/scs2/definition/SCS2DefinitionTools.java b/scs2-definition/src/main/java/us/ihmc/scs2/definition/SCS2DefinitionTools.java new file mode 100644 index 00000000..c24ba116 --- /dev/null +++ b/scs2-definition/src/main/java/us/ihmc/scs2/definition/SCS2DefinitionTools.java @@ -0,0 +1,52 @@ +package us.ihmc.scs2.definition; + +import us.ihmc.scs2.definition.collision.CollisionShapeDefinition; +import us.ihmc.scs2.definition.robot.CrossFourBarJointDefinition; +import us.ihmc.scs2.definition.robot.JointDefinition; +import us.ihmc.scs2.definition.robot.RigidBodyDefinition; +import us.ihmc.scs2.definition.robot.RobotDefinition; +import us.ihmc.scs2.definition.visual.MaterialDefinition; +import us.ihmc.scs2.definition.visual.VisualDefinition; + +import java.util.List; +import java.util.function.Consumer; + +public class SCS2DefinitionTools +{ + public static void forEachRigidBodyDefinitionIncludingFourBars(RigidBodyDefinition start, Consumer rigidBodyConsumer) + { + RobotDefinition.forEachRigidBodyDefinition(start, body -> + { + rigidBodyConsumer.accept(body); + for (JointDefinition childrenJoint : body.getChildrenJoints()) + { + if (childrenJoint instanceof CrossFourBarJointDefinition fourBarJointDefinition) + { + rigidBodyConsumer.accept(fourBarJointDefinition.getBodyBC()); + rigidBodyConsumer.accept(fourBarJointDefinition.getBodyDA()); + } + } + }); + } + + public static void addCollisionVisualsToRobot(RobotDefinition robotDefinition, MaterialDefinition material) + { + robotDefinition.forEachRigidBodyDefinition(rigidBody -> addCollisionVisualsToRigidBodyDefinition(rigidBody, material)); + } + + public static void addCollisionVisualsToRigidBodyDefinition(RigidBodyDefinition rigidBodyDefinition, MaterialDefinition material) + { + if (rigidBodyDefinition == null) + return; + List collisionShapeDefinitions = rigidBodyDefinition.getCollisionShapeDefinitions(); + if (collisionShapeDefinitions == null) + return; + + for (CollisionShapeDefinition collisionShapeDefinition : collisionShapeDefinitions) + { + rigidBodyDefinition.addVisualDefinition(new VisualDefinition(collisionShapeDefinition.getOriginPose(), + collisionShapeDefinition.getGeometryDefinition(), + material)); + } + } +} diff --git a/scs2-definition/src/main/java/us/ihmc/scs2/definition/yoGraphic/SCS2YoGraphicHolder.java b/scs2-definition/src/main/java/us/ihmc/scs2/definition/yoGraphic/SCS2YoGraphicHolder.java new file mode 100644 index 00000000..b75c6426 --- /dev/null +++ b/scs2-definition/src/main/java/us/ihmc/scs2/definition/yoGraphic/SCS2YoGraphicHolder.java @@ -0,0 +1,125 @@ +package us.ihmc.scs2.definition.yoGraphic; + +import us.ihmc.yoVariables.registry.YoRegistry; +import us.ihmc.yoVariables.variable.YoVariable; +import us.ihmc.scs2.definition.SCS2DefinitionTools; + +/** + * This interface was initially created to bind classes that can create SCS2 yoGraphics, such that: + * + *

+ * SCS2 yoGraphic framework differs from SCS1 yoGraphic framework in a few aspects: + *

+ *

+ * + * @author Sylvain Bertrand + */ +public interface SCS2YoGraphicHolder +{ + /** + * The intended implementation for this method is: + * + *

+ * Useful notes: + *

+ *

+ * + * @return the yoGraphics to be visualized in the SCS GUI. + */ + YoGraphicDefinition getSCS2YoGraphics(); +} diff --git a/scs2-session-visualizer-jfx/build.gradle.kts b/scs2-session-visualizer-jfx/build.gradle.kts index 88cbd6c2..e47ed48c 100644 --- a/scs2-session-visualizer-jfx/build.gradle.kts +++ b/scs2-session-visualizer-jfx/build.gradle.kts @@ -27,9 +27,9 @@ mainDependencies { api(ihmc.javaFXModule("fxml", javaFXVersion)) api(ihmc.javaFXModule("swing", javaFXVersion)) - api("us.ihmc:euclid:0.21.0") - api("us.ihmc:euclid-shape:0.21.0") - api("us.ihmc:euclid-frame:0.21.0") + api("us.ihmc:euclid:0.22.2") + api("us.ihmc:euclid-shape:0.22.2") + api("us.ihmc:euclid-frame:0.22.2") api("us.ihmc:ihmc-graphics-description:0.25.1") api("us.ihmc:ihmc-video-codecs:2.1.6") api("us.ihmc:ihmc-javafx-extensions:17-0.2.1") @@ -218,4 +218,4 @@ fun addVSyncLinuxHackForJavaFXApp(sourceFolder: String, javafxappname: String) launchScriptFile.delete() launchScriptFile.writeText(originalScript) -} \ No newline at end of file +} diff --git a/scs2-shared-memory/build.gradle.kts b/scs2-shared-memory/build.gradle.kts index 3da76831..07bbe49d 100644 --- a/scs2-shared-memory/build.gradle.kts +++ b/scs2-shared-memory/build.gradle.kts @@ -12,9 +12,9 @@ ihmc { mainDependencies { api("us.ihmc:scs2-definition:source") - api("us.ihmc:euclid:0.21.0") - api("us.ihmc:euclid-frame:0.21.0") - api("us.ihmc:ihmc-yovariables:0.12.2") + api("us.ihmc:euclid:0.22.2") + api("us.ihmc:euclid-frame:0.22.2") + api("us.ihmc:ihmc-yovariables:0.13.3") api("us.hebi.matlab.mat:mfl-core:0.5.7") } diff --git a/scs2-simulation/build.gradle.kts b/scs2-simulation/build.gradle.kts index 72f61fbb..905bd784 100644 --- a/scs2-simulation/build.gradle.kts +++ b/scs2-simulation/build.gradle.kts @@ -14,9 +14,9 @@ mainDependencies { api("us.ihmc:scs2-definition:source") api("us.ihmc:scs2-shared-memory:source") api("us.ihmc:scs2-session:source") - api("us.ihmc:euclid-frame-shape:0.21.0") + api("us.ihmc:euclid-frame-shape:0.22.2") api("us.ihmc:ihmc-messager:0.2.0") - api("us.ihmc:mecano-yovariables:17-0.18.1") + api("us.ihmc:mecano-yovariables:17-0.19.0") } testDependencies { diff --git a/scs2-symbolic/build.gradle.kts b/scs2-symbolic/build.gradle.kts index a6823339..48bf49e8 100644 --- a/scs2-symbolic/build.gradle.kts +++ b/scs2-symbolic/build.gradle.kts @@ -14,9 +14,9 @@ mainDependencies { api("us.ihmc:scs2-definition:source") api("us.ihmc:scs2-shared-memory:source") - api("us.ihmc:euclid:0.21.0") - api("us.ihmc:euclid-frame:0.21.0") - api("us.ihmc:ihmc-yovariables:0.12.2") + api("us.ihmc:euclid:0.22.2") + api("us.ihmc:euclid-frame:0.22.2") + api("us.ihmc:ihmc-yovariables:0.13.3") } testDependencies {