Skip to content

Commit d791883

Browse files
committed
Start on position passthrough state.
1 parent 4b1892c commit d791883

File tree

2 files changed

+82
-1
lines changed

2 files changed

+82
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
package us.ihmc.commonWalkingControlModules.highLevelHumanoidControl.highLevelStates;
2+
3+
import us.ihmc.commonWalkingControlModules.configurations.HighLevelControllerParameters;
4+
import us.ihmc.commonWalkingControlModules.controllerCore.command.lowLevel.RootJointDesiredConfigurationData;
5+
import us.ihmc.commonWalkingControlModules.controllerCore.command.lowLevel.RootJointDesiredConfigurationDataReadOnly;
6+
import us.ihmc.commonWalkingControlModules.controllerCore.command.lowLevel.YoLowLevelOneDoFJointDesiredDataHolder;
7+
import us.ihmc.commonWalkingControlModules.momentumBasedController.HighLevelHumanoidControllerToolbox;
8+
import us.ihmc.communication.controllerAPI.CommandInputManager;
9+
import us.ihmc.humanoidRobotics.communication.controllerAPI.command.ArmTrajectoryCommand;
10+
import us.ihmc.humanoidRobotics.communication.packets.dataobjects.HighLevelControllerName;
11+
import us.ihmc.sensorProcessing.outputData.JointDesiredOutputListReadOnly;
12+
13+
import java.util.List;
14+
15+
/**
16+
* This controller state accepts controller API commands, manages the trajectories, but
17+
* passes the desired positions directly to the joint desired output list.
18+
*/
19+
public class PositionPassthroughControllerState extends HighLevelControllerState
20+
{
21+
private final static HighLevelControllerName controllerState = HighLevelControllerName.POSITION_PASSTHROUGH;
22+
private final CommandInputManager commandInputManager;
23+
private final YoLowLevelOneDoFJointDesiredDataHolder jointDesiredDataHolder;
24+
/** not used **/
25+
private final RootJointDesiredConfigurationData rootJointDesiredConfigurationData = new RootJointDesiredConfigurationData();
26+
27+
public PositionPassthroughControllerState(CommandInputManager commandInputManager,
28+
HighLevelHumanoidControllerToolbox controllerToolbox,
29+
HighLevelControllerParameters highLevelControllerParameters)
30+
{
31+
super(controllerState, highLevelControllerParameters, controllerToolbox.getControlledOneDoFJoints());
32+
33+
this.commandInputManager = commandInputManager;
34+
35+
jointDesiredDataHolder = new YoLowLevelOneDoFJointDesiredDataHolder(controllerToolbox.getControlledOneDoFJoints(),
36+
controllerToolbox.getYoVariableRegistry());
37+
}
38+
39+
@Override
40+
public void onEntry()
41+
{
42+
43+
}
44+
45+
@Override
46+
public void doAction(double timeInState)
47+
{
48+
List<ArmTrajectoryCommand> armTrajectoryCommands = commandInputManager.pollNewCommands(ArmTrajectoryCommand.class);
49+
50+
for (ArmTrajectoryCommand armTrajectoryCommand : armTrajectoryCommands)
51+
{
52+
for (int i = 0; i < armTrajectoryCommand.getJointspaceTrajectory().getNumberOfJoints(); i++)
53+
{
54+
55+
// jointDesiredDataHolder.setDesiredJointPosition();
56+
}
57+
}
58+
59+
60+
}
61+
62+
@Override
63+
public void onExit(double timeInState)
64+
{
65+
66+
}
67+
68+
@Override
69+
public JointDesiredOutputListReadOnly getOutputForLowLevelController()
70+
{
71+
return jointDesiredDataHolder;
72+
}
73+
74+
@Override
75+
public RootJointDesiredConfigurationDataReadOnly getOutputForRootJoint()
76+
{
77+
return rootJointDesiredConfigurationData;
78+
}
79+
}

ihmc-humanoid-robotics/src/main/java/us/ihmc/humanoidRobotics/communication/packets/dataobjects/HighLevelControllerName.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ public enum HighLevelControllerName
3434
@RosEnumValueDocumentation(documentation = "whole body force control employing IHMC fast walking algorithms")
3535
QUICKSTER,
3636
EXTERNAL_TRANSITION_STATE,
37-
EXTERNAL;
37+
EXTERNAL,
38+
@RosEnumValueDocumentation(documentation = "Accepts controller API commands, manages the trajectories, but passes the desired positions directly to the joint desired output list.")
39+
POSITION_PASSTHROUGH;
3840

3941

4042
public static final HighLevelControllerName[] values = values();

0 commit comments

Comments
 (0)