Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
jrl-walkgen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Guilhem Saurel
jrl-walkgen
Commits
d78197f3
Commit
d78197f3
authored
14 years ago
by
Olivier Stasse
Browse files
Options
Downloads
Patches
Plain Diff
Add SupportFSM object
parent
42d56159
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/PreviewControl/SupportFSM.cpp
+119
-0
119 additions, 0 deletions
src/PreviewControl/SupportFSM.cpp
src/PreviewControl/SupportFSM.h
+69
-0
69 additions, 0 deletions
src/PreviewControl/SupportFSM.h
with
188 additions
and
0 deletions
src/PreviewControl/SupportFSM.cpp
0 → 100644
+
119
−
0
View file @
d78197f3
/*
* Copyright 2010,
*
* Andrei Herdt
* Olivier Stasse
*
* JRL, CNRS/AIST
*
* This file is part of walkGenJrl.
* walkGenJrl is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* walkGenJrl is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
* You should have received a copy of the GNU Lesser General Public License
* along with walkGenJrl. If not, see <http://www.gnu.org/licenses/>.
*
* Research carried out within the scope of the
* Joint Japanese-French Robotics Laboratory (JRL)
*/
/* TODO 3: Restructure the class
* setSupportState.cpp
*/
#include
<iostream>
#include
<fstream>
#include
<PreviewControl/SupportFSM.h>
#include
<Debug.h>
using
namespace
PatternGeneratorJRL
;
using
namespace
std
;
SupportFSM
::
SupportFSM
(
const
double
&
SamplingPeriod
)
{
m_SSPeriod
=
0.8
;
//Duration of one step
m_DSDuration
=
1e9
;
//Duration of the DS phase
m_DSSSDuration
=
0.8
;
//TODO: setNumberOfStepsSSDS
m_NbOfStepsSSDS
=
200
;
m_T
=
SamplingPeriod
;
m_eps
=
0.00000001
;
m_FullDebug
=
0
;
}
SupportFSM
::~
SupportFSM
()
{
}
void
SupportFSM
::
setSupportState
(
const
double
&
Time
,
const
int
&
pi
,
SupportState_t
&
Support
,
const
ReferenceAbsoluteVelocity
&
RefVel
)
{
Support
.
StateChanged
=
false
;
m_ReferenceGiven
=
false
;
if
(
fabs
(
RefVel
.
x
)
>
0
||
fabs
(
RefVel
.
y
)
>
0
)
m_ReferenceGiven
=
true
;
if
(
m_ReferenceGiven
==
true
&&
Support
.
Phase
==
0
&&
(
Support
.
TimeLimit
-
Time
-
m_eps
)
>
m_DSSSDuration
)
{
Support
.
TimeLimit
=
Time
+
m_DSSSDuration
;
}
//FSM
if
(
Time
+
m_eps
+
pi
*
m_T
>=
Support
.
TimeLimit
)
{
//SS->DS
if
(
Support
.
Phase
==
1
&&
m_ReferenceGiven
==
false
&&
Support
.
StepsLeft
==
0
)
{
Support
.
Phase
=
0
;
Support
.
TimeLimit
=
Time
+
pi
*
m_T
+
m_DSDuration
;
Support
.
StateChanged
=
true
;
}
//DS->SS
else
if
(
Support
.
Phase
==
0
&&
m_ReferenceGiven
==
true
)
{
Support
.
Phase
=
1
;
Support
.
TimeLimit
=
Time
+
pi
*
m_T
+
m_SSPeriod
;
Support
.
StepsLeft
=
m_NbOfStepsSSDS
;
Support
.
StateChanged
=
true
;
}
//SS->SS
else
if
(((
Support
.
Phase
==
1
)
&&
(
Support
.
StepsLeft
>
0
))
||
((
Support
.
StepsLeft
==
0
)
&&
(
m_ReferenceGiven
==
true
)))
{
Support
.
Foot
=
-
1
*
Support
.
Foot
;
Support
.
StateChanged
=
true
;
Support
.
TimeLimit
=
Time
+
pi
*
m_T
+
m_SSPeriod
;
Support
.
StepNumber
++
;
Support
.
SSSS
=
1
;
if
(
m_ReferenceGiven
==
false
)
Support
.
StepsLeft
=
Support
.
StepsLeft
-
1
;
}
}
if
(
m_FullDebug
>
0
)
{
ofstream
aof
;
aof
.
open
(
"SupportStates.dat"
,
ios
::
app
);
aof
<<
"Time: "
<<
Time
<<
" PrwTime: "
<<
Time
+
pi
*
m_T
<<
" CSF: "
<<
Support
.
Foot
<<
" CTL: "
<<
Support
.
TimeLimit
<<
" SL: "
<<
Support
.
StepsLeft
<<
" *SF: "
<<
Support
.
Foot
<<
" SN: "
<<
Support
.
StepNumber
;
aof
<<
endl
;
aof
.
close
();
}
}
This diff is collapsed.
Click to expand it.
src/PreviewControl/SupportFSM.h
0 → 100644
+
69
−
0
View file @
d78197f3
/*
* Copyright 2010,
*
* Andrei Herdt
* Olivier Stasse
*
* JRL, CNRS/AIST
*
* This file is part of walkGenJrl.
* walkGenJrl is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* walkGenJrl is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
* You should have received a copy of the GNU Lesser General Public License
* along with walkGenJrl. If not, see <http://www.gnu.org/licenses/>.
*
* Research carried out within the scope of the
* Joint Japanese-French Robotics Laboratory (JRL)
*/
/* This object provides the finite state machine to determine the support parameters. */
#ifndef _SUPPORT_FSM_
#define _SUPPORT_FSM_
#include
<walkGenJrl/PGTypes.h>
namespace
PatternGeneratorJRL
{
class
SupportFSM
{
public:
/*! Constructor */
SupportFSM
(
const
double
&
SamplingPeriod
);
/*! Destructor */
~
SupportFSM
();
/*! \brief Initialize the previewed state. */
void
setSupportState
(
const
double
&
Time
,
const
int
&
pi
,
SupportState_t
&
Support
,
const
ReferenceAbsoluteVelocity
&
RefVel
);
///*! \brief Numerical precision */
double
m_eps
;
/*! \brief constants for the durations in the support phases */
double
m_DSDuration
,
m_SSPeriod
,
m_DSSSDuration
;
//Number of steps done before DS
unsigned
int
m_NbOfStepsSSDS
;
private:
/*! \Brief Sampling duration */
double
m_T
;
bool
m_ReferenceGiven
;
int
m_FullDebug
;
};
};
#endif
/* _SUPPORT_FSM_ */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment