Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sot-core
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
Show more breadcrumbs
Stack Of Tasks
sot-core
Commits
85a8d1fd
Commit
85a8d1fd
authored
14 years ago
by
Nicolas Mansard
Browse files
Options
Downloads
Patches
Plain Diff
Modify the writting of new-style commands.
parent
ae3db436
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/sot-core/robot-simu.h
+1
-1
1 addition, 1 deletion
include/sot-core/robot-simu.h
src/tools/robot-simu-command.h
+0
-59
0 additions, 59 deletions
src/tools/robot-simu-command.h
src/tools/robot-simu.cpp
+10
-10
10 additions, 10 deletions
src/tools/robot-simu.cpp
with
11 additions
and
70 deletions
include/sot-core/robot-simu.h
+
1
−
1
View file @
85a8d1fd
...
...
@@ -83,7 +83,7 @@ class SOTROBOTSIMU_EXPORT RobotSimu
void
setStateSize
(
const
unsigned
int
&
size
);
void
setState
(
const
ml
::
Vector
&
st
);
void
increment
(
const
double
dt
=
5e-2
);
void
increment
(
const
double
&
dt
=
5e-2
);
...
...
This diff is collapsed.
Click to expand it.
src/tools/robot-simu-command.h
deleted
100644 → 0
+
0
−
59
View file @
ae3db436
/*
* Copyright 2010,
* Florent Lamiraux
*
* CNRS/AIST
*
* This file is part of sot-core.
* sot-core 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.
* sot-core 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 Lesser General Public License for more details. You should
* have received a copy of the GNU Lesser General Public License along
* with sot-core. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ROBOT_SIMU_COMMAND_H
#define ROBOT_SIMU_COMMAND_H
#include
<boost/assign/list_of.hpp>
#include
<dynamic-graph/command.h>
#include
<dynamic-graph/command-setter.h>
#include
<dynamic-graph/command-getter.h>
namespace
sot
{
namespace
command
{
using
::
dynamicgraph
::
command
::
Command
;
using
::
dynamicgraph
::
command
::
Value
;
// Command Increment
class
Increment
:
public
Command
{
public:
virtual
~
Increment
()
{}
/// Create command and store it in Entity
/// \param entity instance of Entity owning this command
/// \param docstring documentation of the command
Increment
(
RobotSimu
&
entity
,
const
std
::
string
&
docstring
)
:
Command
(
entity
,
boost
::
assign
::
list_of
(
Value
::
DOUBLE
),
docstring
)
{
}
virtual
Value
doExecute
()
{
RobotSimu
&
rs
=
static_cast
<
RobotSimu
&>
(
owner
());
std
::
vector
<
Value
>
values
=
getParameterValues
();
double
timeStep
=
values
[
0
].
value
();
rs
.
increment
(
timeStep
);
// return void
return
Value
();
}
};
// class Increment
}
// namespace command
}
//namespace sot
#endif //ROBOT_SIMU_COMMAND_H
This diff is collapsed.
Click to expand it.
src/tools/robot-simu.cpp
+
10
−
10
View file @
85a8d1fd
...
...
@@ -31,6 +31,7 @@
using
namespace
std
;
#include
<dynamic-graph/factory.h>
#include
<dynamic-graph/command-bind.h>
using
namespace
sot
;
using
namespace
dynamicgraph
;
...
...
@@ -121,7 +122,7 @@ RobotSimu( const std::string& n )
,
motorcontrolSOUT
(
"RobotSimu("
+
n
+
")::output(vector)::motorcontrol"
)
,
ZMPPreviousControllerSOUT
(
"RobotSimu("
+
n
+
")::output(vector)::zmppreviouscontroller"
)
{
/* ---
FORCE
S --- */
/* ---
SIGNAL
S --- */
for
(
int
i
=
0
;
i
<
4
;
++
i
){
withForceSignals
[
i
]
=
false
;
}
forcesSOUT
[
0
]
=
new
Signal
<
ml
::
Vector
,
int
>
(
"OpenHRP::output(vector6)::forceRLEG"
);
...
...
@@ -137,11 +138,10 @@ RobotSimu( const std::string& n )
<<
previousControlSOUT
<<
pseudoTorqueSOUT
<<
motorcontrolSOUT
<<
ZMPPreviousControllerSOUT
);
state
.
fill
(
.0
);
stateSOUT
.
setConstant
(
state
);
//
// Commands
//
/* --- Commands --- */
std
::
string
docstring
;
/
/ I
ncrement
/
* Command i
ncrement
. */
docstring
=
"
\n
"
" Integrate dynamics for time step provided as input
\n
"
...
...
@@ -149,16 +149,16 @@ RobotSimu( const std::string& n )
" take one floating point number as input
\n
"
"
\n
"
;
addCommand
(
"increment"
,
new
command
::
Increment
(
*
this
,
docstring
));
/
/
setStateSize
::
dynamicgraph
::
command
::
makeCommandVoid1
(
*
this
,
&
RobotSimu
::
increment
,
docstring
));
/
* Command
setStateSize
. */
docstring
=
"
\n
"
" Set size of state vector
\n
"
"
\n
"
;
addCommand
(
"resize"
,
new
::
dynamicgraph
::
command
::
Setter
<
RobotSimu
,
unsigned
>
new
::
dynamicgraph
::
command
::
Setter
<
RobotSimu
,
unsigned
int
>
(
*
this
,
&
RobotSimu
::
setStateSize
,
docstring
));
/
/ set
/
* Command set. */
docstring
=
"
\n
"
" Set state vector value
\n
"
...
...
@@ -190,7 +190,7 @@ setState( const ml::Vector& st )
}
void
RobotSimu
::
increment
(
const
double
dt
)
increment
(
const
double
&
dt
)
{
sotDEBUG
(
25
)
<<
"Time : "
<<
controlSIN
.
getTime
()
+
1
<<
std
::
endl
;
...
...
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