Skip to content
Snippets Groups Projects
Commit 0d41a5ac authored by Nicolas Pronost's avatar Nicolas Pronost
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 1493 additions and 0 deletions
#pragma once
#include <Utils/Utils.h>
/**
A perturbation/alteration class contains information regarding the variable(s) that it is used to alter. If multiple variables
are altered by the same perturbation, then they are assumed to have the same initial value.
*/
class Perturbation {
public:
//this is a list of pointers to the values that need to be perturbed
DynamicArray<double*> variables;
//this is a copy of the original value of the variables above
double originalValue;
//and this is the name associated with the variables (mostly for debugging purposes)
char name[100];
//with each perturbation we will associate a weight - potentially useful for optimizations...
double weight;
public:
//constructor...
Perturbation(double* var, char *PName, double w);
//a copy constructor
Perturbation(const Perturbation& other);
//and a copy operator
Perturbation& operator = (const Perturbation& other);
//adds a variable to be affected by the same perturbation
void addVariable(double* newVar);
//this method sets the value passed in to all the variables that need to be perturbed
void setValue(double newValue);
//this method returns the value of the variables that are being altered
double getValue();
//and this method returns the default value
double getDefaultValue();
//this method restores the default value of all the variables
void resetVariables();
//returns the name
char* getName();
};
/**
A controller is defined by a sequence of parameters. This class provides an easy way of perturbing (i.e. altering) the value of some of these
parameters. This can be useful when testing different settings for a controller (for instance when computing gradients).
*/
class ControllerPerturbator{
public:
DynamicArray<Perturbation*> perturbations;
public:
//resets the perturbations
void resetPerturbations();
//applys a given perturbation to one of the variables being altered
void perturb(int which, double value);
//adds a new perturbation to the collection...
void addPerturbation(DynamicArray<double*> *vars, char* PName, double w);
//adds a new perturbation to the collection...
void addPerturbation(double *var, char* PName, double w);
//default constructor
ControllerPerturbator();
//destructor
~ControllerPerturbator(void);
//returns the list of perturbation values...
void getDeltaP(DynamicArray<double> *result);
//sets the perturbations...
void setDeltaP(DynamicArray<double> *deltaP);
};
%module(directors="1") Core
%begin %{
// VC++ issues those warnings when compiling templates
#pragma warning (disable : 4275 4251)
%}
%include "std_string.i"
%{
#include "SimGlobals.h"
#include "Character.h"
#include "BalanceFeedback.h"
#include "SimBiConState.h"
#include "Controller.h"
#include "PoseController.h"
#include "SimBiController.h"
#include "IKVMCController.h"
#include "WorldOracle.h"
#include "BehaviourController.h"
#include "TurnController.h"
#include "DuckController.h"
#include "TwoLinkIK.h"
%}
// SWIG compiler does not support VC++ declspec
#define GLUTILS_DECLSPEC
#define GLUTILS_TEMPLATE(x)
#define UTILS_DECLSPEC
#define UTILS_TEMPLATE(x)
#define MATHLIB_DECLSPEC
#define MATHLIB_TEMPLATE(x)
#define PHYSICS_DECLSPEC
#define PHYSICS_TEMPLATE(x)
#define CORE_DECLSPEC
#define CORE_TEMPLATE(x)
%feature("director") Controller::performPreTasks;
%feature("director") Controller::performPostTasks;
%apply SWIGTYPE *DISOWN { RigidBody* rigidBody_disown };
%apply SWIGTYPE *DISOWN { ArticulatedFigure* articulatedFigure_disown };
%apply SWIGTYPE *DISOWN { Character* character_disown };
%apply SWIGTYPE *DISOWN { SimBiController* controller_disown };
%apply SWIGTYPE *DISOWN { TrajectoryComponent* trajComp_disown };
%apply SWIGTYPE *DISOWN { ExternalForce* extForce_disown };
%apply SWIGTYPE *DISOWN { Trajectory* traj_disown };
%apply SWIGTYPE *DISOWN { SimBiConState* state_disown };
%apply SWIGTYPE *DISOWN { BalanceFeedback* feedback_disown };
%apply SWIGTYPE *DISOWN { Trajectory1d* traj1d_disown };
%apply SWIGTYPE *DISOWN { BehaviourController* behaviour_disown };
%import "../Utils/Utils.i"
%import "../Physics/Physics.i"
%import "../MathLib/MathLib.i"
%include "SimGlobals.h"
%include "Character.h"
%include "BalanceFeedback.h"
%include "SimBiConState.h"
%include "Controller.h"
%include "PoseController.h"
%include "SimBiController.h"
%include "IKVMCController.h"
%include "WorldOracle.h"
%include "BehaviourController.h"
%include "TurnController.h"
%include "DuckController.h"
%include "TwoLinkIK.h"
%inline %{
#include <Core/CoreDll.h>
#define CORE_CAST_TO( className ) CORE_DECLSPEC inline className* castTo##className(void* obj) { return (className*)obj; }
CORE_CAST_TO( Character )
CORE_CAST_TO( Controller )
CORE_CAST_TO( PoseController )
CORE_CAST_TO( SimBiController )
CORE_CAST_TO( IKVMCController )
CORE_CAST_TO( ControlParams )
CORE_CAST_TO( SimBiConState )
CORE_CAST_TO( ExternalForce )
CORE_CAST_TO( Trajectory )
CORE_CAST_TO( TrajectoryComponent )
CORE_CAST_TO( BalanceFeedback )
CORE_CAST_TO( LinearBalanceFeedback )
%}
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="Core"
ProjectGUID="{A13EC400-F9E0-4306-8EA2-1AC15457EF6B}"
RootNamespace="Core"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)binaries\$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
DeleteExtensionsOnClean="*.obj;*.ilk;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;*.meta;$(TargetPath);$(TargetDir)$(ProjectName).lib;$(TargetDir)$(ProjectName).pyc;$(TargetDir)$(ProjectName).py;$(TargetDir)_$(ProjectName).pyd"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="echo Compiling Python interface&#x0D;&#x0A;echo off&#x0D;&#x0A;..\..\lib\swigwin-1.3.39\swig.exe -python -c++ -o $(InputName)_wrap.cpp $(ProjectDir)$(ProjectName).i&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\lib\Python26\include;$(SolutionDir);$(SolutionDir)/ode-0.9/include;$(SolutionDir)/include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CORE_EXPORTS;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
DisableSpecificWarnings="4231"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\lib\Python26\libs\python26.lib opengl32.lib glu32.lib ..\..\lib\glew32.lib"
OutputFile="$(OutDir)\_$(ProjectName).pyd"
LinkIncremental="2"
IgnoreDefaultLibraryNames="LIBCMT"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="echo Creating python library&#x0D;&#x0A;move $(ProjectDir)$(ProjectName).py $(TargetDir)$(ProjectName).py&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)binaries\$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
DeleteExtensionsOnClean="*.obj;*.ilk;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;*.meta;$(TargetPath);$(TargetDir)$(ProjectName).lib;$(TargetDir)$(ProjectName).pyc;$(TargetDir)$(ProjectName).py;$(TargetDir)_$(ProjectName).pyd"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="echo Compiling Python interface&#x0D;&#x0A;echo off&#x0D;&#x0A;..\..\lib\swigwin-1.3.39\swig.exe -python -c++ -o $(InputName)_wrap.cpp $(ProjectDir)$(ProjectName).i&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\..\lib\Python26\include;$(SolutionDir);$(SolutionDir)/ode-0.9/include;$(SolutionDir)/include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CORE_EXPORTS;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
EnableEnhancedInstructionSet="2"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="0"
DisableSpecificWarnings="4231"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\lib\Python26\libs\python26.lib opengl32.lib glu32.lib ..\..\lib\glew32.lib"
OutputFile="$(OutDir)\_$(ProjectName).pyd"
LinkIncremental="1"
IgnoreDefaultLibraryNames="LIBCMT"
SubSystem="0"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="echo Creating python library&#x0D;&#x0A;move $(ProjectDir)$(ProjectName).py $(TargetDir)$(ProjectName).py&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\Character.cpp"
>
</File>
<File
RelativePath=".\SimGlobals.cpp"
>
</File>
<File
RelativePath=".\SimpleStyleParameters.cpp"
>
</File>
<File
RelativePath=".\TwoLinkIK.cpp"
>
</File>
<File
RelativePath=".\WorldOracle.cpp"
>
</File>
<Filter
Name="Control"
>
<File
RelativePath=".\ActionCollectionPolicy.cpp"
>
</File>
<File
RelativePath=".\BalanceFeedback.cpp"
>
</File>
<File
RelativePath=".\BehaviourController.cpp"
>
</File>
<File
RelativePath=".\BipV3BalanceController.cpp"
>
</File>
<File
RelativePath=".\CompositeController.cpp"
>
</File>
<File
RelativePath=".\Controller.cpp"
>
</File>
<File
RelativePath=".\ConUtils.cpp"
>
</File>
<File
RelativePath=".\DuckController.cpp"
>
</File>
<File
RelativePath=".\IKVMCController.cpp"
>
</File>
<File
RelativePath=".\PoseController.cpp"
>
</File>
<File
RelativePath=".\SimBiConState.cpp"
>
</File>
<File
RelativePath=".\SimBiController.cpp"
>
</File>
<File
RelativePath=".\SimpleControlPolicy.cpp"
>
</File>
<File
RelativePath=".\TurnController.cpp"
>
</File>
<File
RelativePath=".\VirtualModelController.cpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\Character.h"
>
</File>
<File
RelativePath=".\SimGlobals.h"
>
</File>
<File
RelativePath=".\SimpleStyleParameters.h"
>
</File>
<File
RelativePath=".\TwoLinkIK.h"
>
</File>
<File
RelativePath=".\WorldOracle.h"
>
</File>
<Filter
Name="Control"
>
<File
RelativePath=".\ActionCollectionPolicy.h"
>
</File>
<File
RelativePath=".\BalanceFeedback.h"
>
</File>
<File
RelativePath=".\BehaviourController.h"
>
</File>
<File
RelativePath=".\BipV3BalanceController.h"
>
</File>
<File
RelativePath=".\CompositeController.h"
>
</File>
<File
RelativePath=".\Controller.h"
>
</File>
<File
RelativePath=".\ConUtils.h"
>
</File>
<File
RelativePath=".\DuckController.h"
>
</File>
<File
RelativePath=".\ExtendedCharacterState.h"
>
</File>
<File
RelativePath=".\ExtReferenceFrame.h"
>
</File>
<File
RelativePath=".\IKVMCController.h"
>
</File>
<File
RelativePath=".\PoseController.h"
>
</File>
<File
RelativePath=".\SimBiConState.h"
>
</File>
<File
RelativePath=".\SimBiController.h"
>
</File>
<File
RelativePath=".\SimpleControlPolicy.h"
>
</File>
<File
RelativePath=".\TurnController.h"
>
</File>
<File
RelativePath=".\VirtualModelController.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="Static Files"
>
<File
RelativePath=".\Core_wrap.cpp"
>
</File>
<File
RelativePath=".\CoreDll.h"
>
</File>
</Filter>
<File
RelativePath=".\Core.i"
>
</File>
<File
RelativePath="..\Python\CoreTest.py"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A13EC400-F9E0-4306-8EA2-1AC15457EF6B}</ProjectGuid>
<RootNamespace>Core</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\PropertySheetSolutionGlobals.props" />
<Import Project="..\PropertySheetPythonGlobals.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\PropertySheetSolutionGlobals.props" />
<Import Project="..\PropertySheetPythonGlobals.props" />
<Import Project="..\PropertySheetPythonDebug.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>15.0.26919.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ExtensionsToDeleteOnClean>$(ExtensionsToDeleteOnClean)</ExtensionsToDeleteOnClean>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent />
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\lib\Python36\include;$(SolutionDir);$(SolutionDir)/ode-0.15.2/include;$(SolutionDir)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WINDLL;CORE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DisableSpecificWarnings>4231;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>freeglutd.lib;glew32.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Command>echo Compiling Python interface
echo off
..\..\lib\swigwin-3.0.12\swig.exe -python -c++ -o $(ProjectName)_wrap.cpp $(ProjectDir)$(ProjectName).i
</Command>
</PreBuildEvent>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\..\lib\Python36\include;$(SolutionDir);$(SolutionDir)/ode-0.15.2/include;$(SolutionDir)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WINDLL;CORE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4231;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
</ClCompile>
<Link>
<AdditionalDependencies>freeglut.lib;glew32.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<SubSystem>NotSet</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>echo Creating python library
move $(ProjectDir)$(ProjectName).py $(TargetDir)$(ProjectName).py
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="ActionCollectionPolicy.cpp" />
<ClCompile Include="BalanceFeedback.cpp" />
<ClCompile Include="BehaviourController.cpp" />
<ClCompile Include="BipV3BalanceController.cpp" />
<ClCompile Include="Character.cpp" />
<ClCompile Include="CompositeController.cpp" />
<ClCompile Include="Controller.cpp" />
<ClCompile Include="ConUtils.cpp" />
<ClCompile Include="Core_wrap.cpp" />
<ClCompile Include="DuckController.cpp" />
<ClCompile Include="IKVMCController.cpp" />
<ClCompile Include="PoseController.cpp" />
<ClCompile Include="SimBiConState.cpp" />
<ClCompile Include="SimBiController.cpp" />
<ClCompile Include="SimGlobals.cpp" />
<ClCompile Include="SimpleControlPolicy.cpp" />
<ClCompile Include="SimpleStyleParameters.cpp" />
<ClCompile Include="TurnController.cpp" />
<ClCompile Include="TwoLinkIK.cpp" />
<ClCompile Include="VirtualModelController.cpp" />
<ClCompile Include="WorldOracle.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="ActionCollectionPolicy.h" />
<ClInclude Include="BalanceFeedback.h" />
<ClInclude Include="BehaviourController.h" />
<ClInclude Include="BipV3BalanceController.h" />
<ClInclude Include="Character.h" />
<ClInclude Include="CompositeController.h" />
<ClInclude Include="Controller.h" />
<ClInclude Include="ConUtils.h" />
<ClInclude Include="CoreDll.h" />
<ClInclude Include="DuckController.h" />
<ClInclude Include="ExtendedCharacterState.h" />
<ClInclude Include="ExtReferenceFrame.h" />
<ClInclude Include="IKVMCController.h" />
<ClInclude Include="PoseController.h" />
<ClInclude Include="SimBiConState.h" />
<ClInclude Include="SimBiController.h" />
<ClInclude Include="SimGlobals.h" />
<ClInclude Include="SimpleControlPolicy.h" />
<ClInclude Include="SimpleStyleParameters.h" />
<ClInclude Include="TurnController.h" />
<ClInclude Include="TwoLinkIK.h" />
<ClInclude Include="VirtualModelController.h" />
<ClInclude Include="WorldOracle.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\Python\CoreTest.py" />
<None Include="Core.i" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GLUtils\GLUtils.vcxproj">
<Project>{75ef6911-0680-4935-b629-c63cdbe97d62}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\gsl\gsl.vcxproj">
<Project>{ddde1728-d156-46cd-bbc1-e6b3146f0ad1}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\MathLib\MathLib.vcxproj">
<Project>{8d8cbb41-fac7-419c-a7a9-34740a6c37cd}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\ode-0.15.2\ode.vcxproj">
<Project>{8bf304c4-6dd5-3440-802d-05fef6423b5e}</Project>
</ProjectReference>
<ProjectReference Include="..\Physics\Physics.vcxproj">
<Project>{d39405f1-f2b0-4a94-8c66-b4ba846f6e86}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\Utils\Utils.vcxproj">
<Project>{03c7e5de-55ea-49f9-ab6d-d0bd907487c6}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Source Files\Control">
<UniqueIdentifier>{d91f21a5-77b6-44db-a1ca-b2429ecad103}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Header Files\Control">
<UniqueIdentifier>{0d29a537-e9a1-497f-b875-78211b917fdf}</UniqueIdentifier>
</Filter>
<Filter Include="Static Files">
<UniqueIdentifier>{418266e3-d9b8-4123-9148-614cab1f0a5b}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Character.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SimGlobals.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SimpleStyleParameters.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TwoLinkIK.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="WorldOracle.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ActionCollectionPolicy.cpp">
<Filter>Source Files\Control</Filter>
</ClCompile>
<ClCompile Include="BalanceFeedback.cpp">
<Filter>Source Files\Control</Filter>
</ClCompile>
<ClCompile Include="BehaviourController.cpp">
<Filter>Source Files\Control</Filter>
</ClCompile>
<ClCompile Include="BipV3BalanceController.cpp">
<Filter>Source Files\Control</Filter>
</ClCompile>
<ClCompile Include="CompositeController.cpp">
<Filter>Source Files\Control</Filter>
</ClCompile>
<ClCompile Include="Controller.cpp">
<Filter>Source Files\Control</Filter>
</ClCompile>
<ClCompile Include="ConUtils.cpp">
<Filter>Source Files\Control</Filter>
</ClCompile>
<ClCompile Include="DuckController.cpp">
<Filter>Source Files\Control</Filter>
</ClCompile>
<ClCompile Include="IKVMCController.cpp">
<Filter>Source Files\Control</Filter>
</ClCompile>
<ClCompile Include="PoseController.cpp">
<Filter>Source Files\Control</Filter>
</ClCompile>
<ClCompile Include="SimBiConState.cpp">
<Filter>Source Files\Control</Filter>
</ClCompile>
<ClCompile Include="SimBiController.cpp">
<Filter>Source Files\Control</Filter>
</ClCompile>
<ClCompile Include="SimpleControlPolicy.cpp">
<Filter>Source Files\Control</Filter>
</ClCompile>
<ClCompile Include="TurnController.cpp">
<Filter>Source Files\Control</Filter>
</ClCompile>
<ClCompile Include="VirtualModelController.cpp">
<Filter>Source Files\Control</Filter>
</ClCompile>
<ClCompile Include="Core_wrap.cpp">
<Filter>Static Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Character.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SimGlobals.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SimpleStyleParameters.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TwoLinkIK.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="WorldOracle.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ActionCollectionPolicy.h">
<Filter>Header Files\Control</Filter>
</ClInclude>
<ClInclude Include="BalanceFeedback.h">
<Filter>Header Files\Control</Filter>
</ClInclude>
<ClInclude Include="BehaviourController.h">
<Filter>Header Files\Control</Filter>
</ClInclude>
<ClInclude Include="BipV3BalanceController.h">
<Filter>Header Files\Control</Filter>
</ClInclude>
<ClInclude Include="CompositeController.h">
<Filter>Header Files\Control</Filter>
</ClInclude>
<ClInclude Include="Controller.h">
<Filter>Header Files\Control</Filter>
</ClInclude>
<ClInclude Include="ConUtils.h">
<Filter>Header Files\Control</Filter>
</ClInclude>
<ClInclude Include="DuckController.h">
<Filter>Header Files\Control</Filter>
</ClInclude>
<ClInclude Include="ExtendedCharacterState.h">
<Filter>Header Files\Control</Filter>
</ClInclude>
<ClInclude Include="ExtReferenceFrame.h">
<Filter>Header Files\Control</Filter>
</ClInclude>
<ClInclude Include="IKVMCController.h">
<Filter>Header Files\Control</Filter>
</ClInclude>
<ClInclude Include="PoseController.h">
<Filter>Header Files\Control</Filter>
</ClInclude>
<ClInclude Include="SimBiConState.h">
<Filter>Header Files\Control</Filter>
</ClInclude>
<ClInclude Include="SimBiController.h">
<Filter>Header Files\Control</Filter>
</ClInclude>
<ClInclude Include="SimpleControlPolicy.h">
<Filter>Header Files\Control</Filter>
</ClInclude>
<ClInclude Include="TurnController.h">
<Filter>Header Files\Control</Filter>
</ClInclude>
<ClInclude Include="VirtualModelController.h">
<Filter>Header Files\Control</Filter>
</ClInclude>
<ClInclude Include="CoreDll.h">
<Filter>Static Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="Core.i" />
<None Include="..\Python\CoreTest.py" />
</ItemGroup>
</Project>
\ No newline at end of file
#pragma once
#ifndef CORE_DECLSPEC
#ifdef CORE_EXPORTS
#define CORE_DECLSPEC __declspec(dllexport)
#define CORE_TEMPLATE(x) template class __declspec(dllexport) x;
#else
#define CORE_DECLSPEC __declspec(dllimport)
#define CORE_TEMPLATE(x) template class __declspec(dllimport) x;
#endif
#endif
This diff is collapsed.
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.12
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
* changes to this file unless you know what you are doing--modify the SWIG
* interface file instead.
* ----------------------------------------------------------------------------- */
#ifndef SWIG_Core_WRAP_H_
#define SWIG_Core_WRAP_H_
#include <map>
#include <string>
#endif
#include "DuckController.h"
DuckController::DuckController(Character* b, IKVMCController* llc, WorldOracle* w) : BehaviourController(b, llc, w){
crouchLevel = 0;
clearanceHeight = 1.2;
}
DuckController::~DuckController(void){
}
/**
this method gets called at every simulation time step
*/
void DuckController::simStepPlan(double dt){
BehaviourController::simStepPlan(dt);
ArticulatedRigidBody* rb = bip->getARBByName("head");
if (rb->getCMPosition().y > clearanceHeight)
crouchLevel += dt/2;
// else
// crouchLevel -= dt/2;
boundToRange(&crouchLevel, 0, 1);
setUpperBodyPose(ubSagittalLean - crouchLevel * -1, ubCoronalLean - crouchLevel * -0.2, ubTwist);
setKneeBend(kneeBend - crouchLevel * -2);
}
/**
this method determines the degree to which the character should be panicking
*/
double DuckController::getPanicLevel(){
//be extra careful...
return 2 * BehaviourController::getPanicLevel();
}
#pragma once
#include <Core/BehaviourController.h>
class DuckController : public BehaviourController {
protected:
double crouchLevel;
double clearanceHeight;
public:
DuckController(Character* b, IKVMCController* llc, WorldOracle* w = NULL);
virtual ~DuckController(void);
/**
this method gets called at every simulation time step
*/
virtual void simStepPlan(double dt);
/**
this method determines the degree to which the character should be panicking
*/
virtual double getPanicLevel();
};
/*
* A Reference frame that can be used to express the target orientation of an articulated
* body driven by a controller.
*/
#pragma once
#include <Utils/Utils.h>
#include <MathLib/ReferenceFrame.h>
class ExtReferenceFrame {
public:
ReferenceFrame evaluate( const Quaternion& parentFrame, const Quaternion& characterFrame )
};
class ParentFrame : ExtReferenceFrame {
ReferenceFrame evaluate( const Quaternion& parentFrame, const Quaternion& characterFrame )
};
class CharacterFrame : ExtReferenceFrame {
};
\ No newline at end of file
#pragma once
#include <Utils/Utils.h>
#include <MathLib/Vector3d.h>
#include <MathLib/Quaternion.h>
#include <Core/Character.h>
/**
This class is used as a container for the full state of a character. It is used to be able to do things like the Value iteration algorithm,
where we need to continually restart simulations from specific character states. It holds the reduced-coordinates version of the state (that
will introduce some error because of numerical issues), the stance of the character when this state was recorded/stored, and also d and v as
vectors expressed in the relative coordinate frame of the character. Even tough d and v should be fully specified with the state and stance
information, we will store it anyway for easy access. We will also hold the quaternion that holds the transformation from the relative world
frame to the world frame (aka heading - this is just the twist around the world-axis vertical axis). This orientation can be used to go from
quantities represented in world coordinates to quantities represented in the relative world frame of the character.
*/
class ExtendedCharacterState{
public:
DynamicArray<double> state;
int stance;
Vector3d d;
Vector3d v;
Quaternion heading;
bool lostControl;
//also keep track of the step, as represented by the vector between the right foot and the left foot (or the negative of that depending on the situation)
Vector3d step;
public:
/**
Constructor - sets all the data members to values passed in as parameters
*/
ExtendedCharacterState(DynamicArray<double> state, int stance, Vector3d d, Vector3d v, Quaternion heading, Vector3d step){
this->state = state;
this->stance = stance;
this->d = d;
this->v = v;
this->heading = heading;
lostControl = false;
this->step = step;
}
/**
Constructor - sets all the data members to values passed in as parameters
*/
ExtendedCharacterState(DynamicArray<double> state){
this->state = state;
this->stance = 0;
this->d = Vector3d();
this->v = Vector3d();
this->heading = Quaternion();
lostControl = false;
this->step = Vector3d();
}
/**
make a copy of all the data members of the state passed in as a parameter
*/
ExtendedCharacterState(ExtendedCharacterState* other){
copyState(other);
}
inline void copyState(ExtendedCharacterState* other){
this->state = other->state;
this->stance = other->stance;
this->d = other->d;
this->v = other->v;
this->heading = other->heading;
this->lostControl = other->lostControl;
this->step = other->step;
}
/**
Default constructor - someone should set the data member values
*/
ExtendedCharacterState(){
lostControl = false;
this->stance = 0;
this->d = Vector3d();
this->v = Vector3d();
this->heading = Quaternion();
lostControl = false;
this->step = Vector3d();
}
/**
this contstructor initializes all the data members from a file
*/
ExtendedCharacterState(FILE* fp){
readFromFile(fp);
}
/**
write the contents of the state to a file
*/
void writeToFile(FILE* fp){
fprintf(fp, "%d\n", state.size());
for (uint i=0;i<state.size();i++)
fprintf(fp, "%lf ", state[i]);
fprintf(fp,"\n%d %lf %lf %lf %lf %lf %lf\n", stance, d.x, d.y, d.z, v.x, v.y, v.z);
fprintf(fp, "%lf %lf %lf %lf\n", heading.s, heading.v.x, heading.v.y, heading.v.z);
fprintf(fp,"%lf %lf %lf\n", step.x, step.y, step.z);
if (lostControl)
fprintf(fp, "0");
else
fprintf(fp, "1");
fprintf(fp,"\n");
}
/**
read the contents of the state from a file
*/
void readFromFile(FILE *fp){
int temp;
double temp2;
state.clear();
fscanf(fp, "%d", &temp);
for (int i=0;i<temp;i++){
fscanf(fp, "%lf ", &temp2);
state.push_back(temp2);
}
fscanf(fp,"%d %lf %lf %lf %lf %lf %lf", &stance, &d.x, &d.y, &d.z, &v.x, &v.y, &v.z);
fscanf(fp, "%lf %lf %lf %lf", &heading.s, &heading.v.x, &heading.v.y, &heading.v.z);
fscanf(fp,"%lf %lf %lf", &step.x, &step.y, &step.z);
fscanf(fp, "%d", &temp);
ReducedCharacterState rs(&this->state);
heading = computeHeading(rs.getOrientation());
lostControl = (temp == 0);
}
virtual ~ExtendedCharacterState(void){
}
/**
a bunch of getters
*/
inline Vector3d getD() const {return d;}
inline Vector3d getV() const {return v;}
inline int getStance() const {return stance;}
inline DynamicArray<double>* getStateReference() {return &state;}
inline Quaternion getHeading() const {return heading;}
inline bool hasLostControl() const {return lostControl;}
inline Vector3d getStep() const {return step;}
};
#include "HumanoidIKCharacter.h"
HumanoidIKCharacter::HumanoidIKCharacter(Character* bip){
this->biped = bip;
//populate the relevant data members
rightArm = new HumanoidIKArm(bip, "rElbow", "rShoulder");
leftArm = new HumanoidIKArm(bip, "lElbow", "lShoulder");
// setRightArmTarget(Point3d(0.6, 1.3, 0.3));
// leftArm->setIKOrientations(Point3d(0.6, 1.3, 0.3));
}
HumanoidIKCharacter::~HumanoidIKCharacter(void){
delete rightArm;
delete leftArm;
}
void HumanoidIKCharacter::setRightArmTarget(Point3d p){
rightArm->setIKOrientations(p);
leftArm->setIKOrientations(p);
}
This diff is collapsed.
This diff is collapsed.
#pragma once
#include <MathLib/Trajectory.h>
#include <Core/SimBiController.h>
#include <Core/VirtualModelController.h>
/**
Controller Inspired by Simbicon and Virtual Model Control ideas. Uses IK to control swing foot placement. It assumes
a pretty specilized character architecture: Legs look like this:
root -> hips (3 dof) -> knees (1 dof, around x-axis, for now) -> ankles (doesn't matter how many dofs) -> (may or may not have toes, etc).
An IKVMCController is a Simbicon Controller. The targets for the swing hip and swing knee are computed using IK, based on a target
foot location (which is given by the inverted pendulum prediction), and the stance ~hip, knee and ankle torques are computed in part
by the desired velocity of the CM. Gravity compensation can be added to any rb in the body (propagated to the root). Also, "torque bubbling"
can be added for any chain that starts at the root.
TODO:
- try out some stairs, slopes
- try some IK for the arm, while walking
- try some static balance, arms moving...
- get a less 'hacky' implementation of the desired foot placement position (at least in the sagittal plane).
- test out 'external' foot placement accuracy - DONE!
- make walk more natural - how much is simbicon, how much is T = J' * f for push-off? How much does the vertical trajectory of swing foot matter? - DONE!
- eliminate/reduce the torso/head wobbling. - DONE!
- stance leg/swing leg velocity/position control through T = J' * f - DONE!
- get some decent toe-off - Pretty much DONE!
- torque bubbling - DONE!
- gravity compensation - DONE!
- check to see why the crouched walk happens sometime - stance knee should be straight, shouldn't it? - DONE!
- check to see why swing hip initially goes inwards! - DONE!
- make sure character can walk in any direction - DONE!
- limit the extent to which stance ankle 'rolls' on the heel - DONE!
- how much should the strength of the root be? What works best?
- doesn't actually matter too much. 1 seems to work best, so we'll go with that.
- THINGS TO TRY STILL:
- try to somehow bring the upper body into the motion - maybe simulate the force being applied
to the CM - i.e. t = dpCM/dq * f, where CM now only takes into account the chain from the head/torso
to the stance foot - i don't know...
- upper body - can it be used to make it slow down/speed up/whatever faster?
- maybe com J'?
*/
class BehaviourController;
class IKVMCController: public SimBiController{
friend class TestApp3;
friend class TestApp4;
friend class BehaviourController;
private:
//keep track of the swing knee and swing hip
int swingKneeIndex;
Joint *swingKnee, *swingHip;
int lKneeIndex, rKneeIndex, lAnkleIndex, rAnkleIndex;
//keep track of the stance ankle, stance knee and stance hip
int stanceAnkleIndex, stanceKneeIndex, swingAnkleIndex;
//this is a controller that we will be using to compute gravity-cancelling torques
VirtualModelController* vmc;
//some feed-forward torque we want the root to see...
Vector3d ffRootTorque;
/**
determines if there are any heel/toe forces on the given RB
*/
void getForceInfoOn(RigidBody* rb, DynamicArray<ContactPoint> *cfs, bool* heelForce, bool* toeForce);
BehaviourController* behaviour;
public:
//desired velocity in the sagittal plane
double velDSagittal;
//desired velocity in the coronal plane...
double velDCoronal;
//this is a desired foot trajectory that we may wish to follow, expressed separately, for the 3 components,
//and relative to the current location of the CM
Trajectory1d swingFootTrajectorySagittal;
Trajectory1d swingFootTrajectoryCoronal;
Trajectory1d swingFootHeightTrajectory;
Trajectory1d swingFootTrajectoryDeltaSagittal;
Trajectory1d swingFootTrajectoryDeltaCoronal;
Trajectory1d swingFootTrajectoryDeltaHeight;
//this is the vector that specifies the plane of rotation for the swing leg, relative to the root...
Vector3d swingLegPlaneOfRotation;
//if the controller is in double-stance mode, then the swing foot won't have an IK target
bool doubleStanceMode;
//desired offset of the CM relative to the stance foot/midpoint of the feet
double comOffsetSagittal;
double comOffsetCoronal;
//this variable can be used to quickly alter the desired height, if panic ensues...
double panicHeight;
//and this should be used to add height for the leg (i.e. if it needs to step over an obstacle that wasn't planned for).
double unplannedForHeight;
public:
/**
constructor
*/
IKVMCController(Character* b);
/**
destructor
*/
~IKVMCController(void);
inline void setSwingFootTrajectoryDeltaSagittal( const Trajectory1d& traj ) {
swingFootTrajectoryDeltaSagittal.copy( traj );
notifyObservers();
}
inline const Trajectory1d& getSwingFootTrajectoryDeltaSagittal() const {
return swingFootTrajectoryDeltaSagittal;
}
inline void setSwingFootTrajectoryDeltaCoronal( const Trajectory1d& traj ) {
swingFootTrajectoryDeltaCoronal.copy( traj );
notifyObservers();
}
inline const Trajectory1d& getSwingFootTrajectoryDeltaCoronal() const {
return swingFootTrajectoryDeltaCoronal;
}
inline void setSwingFootTrajectoryDeltaHeight( const Trajectory1d& traj ) {
swingFootTrajectoryDeltaHeight.copy( traj );
notifyObservers();
}
inline const Trajectory1d& getSwingFootTrajectoryDeltaHeight() const {
return swingFootTrajectoryDeltaHeight;
}
inline Vector3d computeSwingFootDelta( double phiToUse = -1, int stanceToUse = -1 ) {
if( phiToUse < 0 )
phiToUse = phi;
if( phiToUse > 1 )
phiToUse = 1;
if( stanceToUse < 0 )
stanceToUse = stance;
if( stanceToUse > 1 )
stanceToUse = 1;
double sign = (stanceToUse==LEFT_STANCE)?1.0:-1.0;
return Vector3d(
swingFootTrajectoryDeltaCoronal.evaluate_catmull_rom(phiToUse) * sign,
swingFootTrajectoryDeltaHeight.evaluate_catmull_rom(phiToUse),
swingFootTrajectoryDeltaSagittal.evaluate_catmull_rom(phiToUse) );
}
void setBehaviour( BehaviourController* behaviour_disown ) {
if( this->behaviour != NULL )
throwError( "Behaviour already set!" );
this->behaviour = behaviour_disown;
}
BehaviourController* getBehaviour() { return behaviour; }
/**
returns the required stepping location, as predicted by the inverted pendulum model. The prediction is made
on the assumption that the character will come to a stop by taking a step at that location. The step location
is expressed in the character's frame coordinates.
*/
Vector3d computeIPStepLocation();
/**
This method is used to compute the target angles for the swing hip and swing knee that help
to ensure (approximately) precise foot-placement control.
*/
void computeIKSwingLegTargets(double dt);
/**
This method computes the desired target location for the swing ankle. It also returns an estimate of the desired
foot location some time dt later. This method returns the points expressed in world coordinates.
*/
// void getDesiredSwingAngleLocation(Point3d* target, Point3d* futureTarget, double dt);
/**
This method is used to compute the torques
*/
virtual void computeTorques(DynamicArray<ContactPoint> *cfs);
/**
This method returns a target for the location of the swing foot, based on some state information. It is assumed that the velocity v
is expressed in character-relative coordinates (i.e. the sagittal component is the z-component), while the com position, and the
initial swing foot position is expressed in world coordinates. The resulting desired foot position is also expressed in world coordinates.
*/
Point3d getSwingFootTargetLocation(double t, const Point3d& com, const Quaternion& charFrameToWorld);
/**
This method computes the torques that cancel out the effects of gravity,
for better tracking purposes
*/
void computeGravityCompensationTorques();
/**
updates the indexes of the swing and stance hip, knees and ankles
*/
void updateSwingAndStanceReferences();
/**
This method is used to compute the desired orientation and angular velocity for a parent RB and a child RB, relative to the grandparent RB and
parent RB repsectively. The input is:
- the index of the joint that connects the grandparent RB to the parent RB, and the index of the joint between parent and child
- the distance from the parent's joint with its parent to the location of the child's joint, expressed in parent coordinates
- two rotation normals - one that specifies the plane of rotation for the parent's joint, expressed in grandparent coords,
and the other specifies the plane of rotation between the parent and the child, expressed in parent's coordinates.
- The position of the end effector, expressed in child's coordinate frame
- The desired position of the end effector, expressed in world coordinates
- an estimate of the desired position of the end effector, in world coordinates, some dt later - used to compute desired angular velocities
*/
void computeIKQandW(int parentJIndex, int childJIndex, const Vector3d& parentAxis, const Vector3d& parentNormal, const Vector3d& childNormal, const Vector3d& childEndEffector, const Point3d& wP, bool computeAngVelocities, const Point3d& futureWP, double dt);
/**
This method is used to ensure that each RB sees the net torque that the PD controller computed for it.
Without it, an RB sees also the sum of -t of every child.
*/
void bubbleUpTorques();
/**
This method is used to compute torques for the stance leg that help achieve a desired speed in the sagittal and lateral planes
*/
void computeLegTorques(int ankleIndex, int kneeIndex, int hipIndex, DynamicArray<ContactPoint> *cfs);
void COMJT(DynamicArray<ContactPoint> *cfs);
/**
This method is used to compute the force that the COM of the character should be applying.
*/
Vector3d computeVirtualForce();
/**
This method returns performes some pre-processing on the virtual torque. The torque is assumed to be in world coordinates,
and it will remain in world coordinates.
*/
void preprocessAnkleVTorque(int ankleJointIndex, DynamicArray<ContactPoint> *cfs, Vector3d *ankleVTorque);
virtual void performPreTasks(double dt, DynamicArray<ContactPoint> *cfs);
// Returns true if it transitioned to a new state, false otherwise
virtual bool performPostTasks(double dt, DynamicArray<ContactPoint> *cfs);
};
#pragma once
#include <Core/CompositeController.h>
/**
This class is used to define an interface for policies that are to be used with composite controllers.
*/
class Policy{
protected:
//this is the composite controller that this policy operates on
CompositeController* con;
public:
/**
base constructor
*/
Policy(CompositeController* con){
this->con = con;
}
/**
destructor
*/
~Policy(void){
}
/**
this method should be implemented by specific types of policies, and it should set the primary (and secondary+interpolation value if needed)
controller to be run by the composite controller.
*/
virtual void applyAction() = 0;
};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment