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

Feature rdx-val integration #409

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public ROS2SyncedRobotModel(DRCRobotModel robotModel, ROS2NodeInterface ros2Node
this(robotModel, ros2Node, robotModel.createFullRobotModel());
}

public ROS2SyncedRobotModel(DRCRobotModel robotModel, ROS2NodeInterface ros2Node, boolean enforceUniqueReferenceFrames)
{
this(robotModel, ros2Node, robotModel.createFullRobotModel(enforceUniqueReferenceFrames));
}

public ROS2SyncedRobotModel(DRCRobotModel robotModel, ROS2NodeInterface ros2Node, FullHumanoidRobotModel fullRobotModel)
{
super(robotModel, fullRobotModel, robotModel.getHandModels(), robotModel.getSensorInformation());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

public interface RobotVersion
{
default boolean hasHead()
{
return true;
}

default boolean hasArm(RobotSide robotSide)
{
return false;
Expand All @@ -14,11 +19,6 @@ default boolean hasBothArms()
return hasArm(RobotSide.LEFT) && hasArm(RobotSide.RIGHT);
}

default boolean hasHead()
{
return true;
}

default boolean hasSakeGripperJoints(RobotSide side)
{
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1934,6 +1934,12 @@ public MovingReferenceFrame getChestFrame()
{
return null;
}

@Override
public MovingReferenceFrame getHeadFrame()
{
return null;
}
}

public static class ForcePointController implements RobotController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,17 @@ public RDXDualBlackflyProjection(HumanoidReferenceFrames currentRobotFrames)
{
this.baseUI = RDXBaseUI.getInstance();
this.robotZUpFrame = currentRobotFrames.getMidFootZUpGroundFrame();
robotCameraFrames.set(currentRobotFrames::getSituationalAwarenessCameraFrame);
robotCameraFrames.set(currentRobotFrames::getStereoCameraFrame);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed to stereo camera, as it's a better description of what those cameras are. Especially considering that we are dropping the blackflies

RigidBodyTransform stereoMidPoint = new RigidBodyTransform();
MovingReferenceFrame chestFrame = currentRobotFrames.getChestFrame();
stereoMidPoint.interpolate(currentRobotFrames.getSituationalAwarenessCameraFrame(RobotSide.LEFT).getTransformToDesiredFrame(chestFrame),
currentRobotFrames.getSituationalAwarenessCameraFrame(RobotSide.RIGHT).getTransformToDesiredFrame(chestFrame),
stereoMidPoint.interpolate(currentRobotFrames.getStereoCameraFrame(RobotSide.LEFT).getTransformToDesiredFrame(chestFrame),
currentRobotFrames.getStereoCameraFrame(RobotSide.RIGHT).getTransformToDesiredFrame(chestFrame),
0.5);
stereoMidPointFrame = ReferenceFrameTools.constructFrameWithUnchangingTransformToParent("StereoMidPoint", chestFrame, stereoMidPoint);
for (RobotSide side : RobotSide.values)
{
RigidBodyTransform cameraToStereoMidPoint = currentRobotFrames.getSituationalAwarenessCameraFrame(side).getTransformToDesiredFrame(chestFrame);
RigidBodyTransform cameraToStereoMidPoint = currentRobotFrames.getStereoCameraFrame(side).getTransformToDesiredFrame(chestFrame);
cameraToStereoMidPoint.invert();
cameraToStereoMidPoint.multiply(stereoMidPoint);
cameraToStereoMidPoint.invert();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public static RDXHighLevelDepthSensorSimulator createOusterLidar(ReferenceFrame

public static RDXHighLevelDepthSensorSimulator createBlackflyFisheye(ROS2SyncedRobotModel syncedRobot)
{
return createBlackflyFisheye(syncedRobot.getReferenceFrames().getSituationalAwarenessCameraFrame(RobotSide.RIGHT), syncedRobot::getTimestamp);
return createBlackflyFisheye(syncedRobot.getReferenceFrames().getStereoCameraFrame(RobotSide.RIGHT), syncedRobot::getTimestamp);
}

public static RDXHighLevelDepthSensorSimulator createBlackflyFisheyeImageOnlyNoComms(ReferenceFrame sensorFrame)
Expand Down Expand Up @@ -229,7 +229,7 @@ public static RDXHighLevelDepthSensorSimulator createChestRightBlackflyForObject
double maxRange = 5.0;
RDXHighLevelDepthSensorSimulator highLevelDepthSensorSimulator
= new RDXHighLevelDepthSensorSimulator("Blackfly Right for Object Detection",
referenceFrames.getSituationalAwarenessCameraFrame(RobotSide.RIGHT),
referenceFrames.getStereoCameraFrame(RobotSide.RIGHT),
timeSupplier,
verticalFOV,
imageWidth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,6 @@ public void update(boolean interactablesEnabled)
boolean desiredHandPoseChanged = false;
for (RobotSide side : interactableHands.sides())
{
if (syncedRobot.getHandWrenchCalculators().get(side) == null)
continue;

// wrench expressed in wrist pitch body fixed-frame
if (interactableHands.get(side).getEstimatedHandWrenchArrows().getShow() != showWrench)
interactableHands.get(side).getEstimatedHandWrenchArrows().setShow(showWrench);
interactableHands.get(side).updateEstimatedWrench(syncedRobot.getHandWrenchCalculators().get(side).getFilteredWrench());

if (!interactableHands.get(side).isDeleted())
{
armIKSolvers.get(side).update(syncedRobot.getReferenceFrames().getChestFrame(), interactableHands.get(side).getControlReferenceFrame());
Expand All @@ -171,6 +163,14 @@ public void update(boolean interactablesEnabled)
desiredHandPoseChanged |= armIKSolvers.get(side).getDesiredHandControlPoseChanged();
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed bug, if the wrench calculator is null, it will skip the armIKSolver part. This means that the IK for the selectable hand didn't work if the robot has no hand


if (syncedRobot.getHandWrenchCalculators().get(side) == null)
continue;

// wrench expressed in wrist pitch body fixed-frame
if (interactableHands.get(side).getEstimatedHandWrenchArrows().getShow() != showWrench)
interactableHands.get(side).getEstimatedHandWrenchArrows().setShow(showWrench);
interactableHands.get(side).updateEstimatedWrench(syncedRobot.getHandWrenchCalculators().get(side).getFilteredWrench());
}

// The following puts the solver on a thread as to not slow down the UI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,15 @@ public RDXInteractableHand(RobotSide side,
ForceSensorDefinition[] forceSensorDefinitions = fullRobotModel.getForceSensorDefinitions();
for (int i = 0; i < forceSensorDefinitions.length; i++)
{
if (wristForceSensorNames.containsKey(side) && wristForceSensorNames.get(side).equals(forceSensorDefinitions[i].getSensorName()))
if (wristForceSensorNames != null)
{
// wristWrenchArrows.put(side, new RDXSpatialVectorArrows(forceSensorDefinitions[i].getSensorFrame(), i));
sensorWristWrenchArrows = new RDXSpatialVectorArrows(forceSensorDefinitions[i].getSensorFrame(),
yoVariableClientHelper,
side.getLowerCaseName() + "WristSensor");
if (wristForceSensorNames.containsKey(side) && wristForceSensorNames.get(side).equals(forceSensorDefinitions[i].getSensorName()))
{
// wristWrenchArrows.put(side, new RDXSpatialVectorArrows(forceSensorDefinitions[i].getSensorFrame(), i));
sensorWristWrenchArrows = new RDXSpatialVectorArrows(forceSensorDefinitions[i].getSensorFrame(),
yoVariableClientHelper,
side.getLowerCaseName() + "WristSensor");
}
}
}
ReferenceFrame afterLastWristJointFrame = fullRobotModel.getEndEffectorFrame(side, LimbName.ARM);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public static String getModelFileName(RigidBodyDefinition rigidBodyDefinition)
}
if (modelFileGeometryDefinition == null || modelFileGeometryDefinition.getFileName() == null)
{
LogTools.error("Interactables need a model file or implementation of shape visuals");
LogTools.error("Interactables for {} need a model file or implementation of shape visuals", rigidBodyDefinition.getName());
return null;
}
return modelFileGeometryDefinition.getFileName();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public RDXRobotCollidable(FrameShape3DReadOnly shape,
linkFrame = syncedLinkFrame;

RigidBodyTransform collisionToLinkFrameTransform = new RigidBodyTransform();
collisionShapeFrame = new MutableReferenceFrame("collisionShapeFrame" + rigidBodyName, linkFrame);
collisionShapeFrame = new MutableReferenceFrame("collisionShapeFrame" + rigidBodyName + collidableIndex, linkFrame);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need the index for robots like valkyrie which have multiple collidables per single rigid body

mouseCollidable = new MouseCollidable(this.shape);
vrPickRayCollidable = new MouseCollidable(this.shape);
Expand Down
Loading
Loading