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
3fb2b37e
Commit
3fb2b37e
authored
14 years ago
by
Florent Lamiraux
Browse files
Options
Downloads
Patches
Plain Diff
Add command AddFeature in sot::Task
* src/task/task-command.h: new, * src/task/task.cpp.
parent
b74d1d57
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/task/task-command.h
+62
-0
62 additions, 0 deletions
src/task/task-command.h
src/task/task.cpp
+19
-2
19 additions, 2 deletions
src/task/task.cpp
with
81 additions
and
2 deletions
src/task/task-command.h
0 → 100644
+
62
−
0
View file @
3fb2b37e
/*
* Copyright 2010,
* Florent Lamiraux
*
* CNRS
*
* 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 TASK_COMMAND_H
#define TASK_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
{
namespace
task
{
using
::
dynamicgraph
::
command
::
Command
;
using
::
dynamicgraph
::
command
::
Value
;
// Command AddFeature
class
AddFeature
:
public
Command
{
public:
virtual
~
AddFeature
()
{}
/// Create command and store it in Entity
/// \param entity instance of Entity owning this command
/// \param docstring documentation of the command
AddFeature
(
Task
&
entity
,
const
std
::
string
&
docstring
)
:
Command
(
entity
,
boost
::
assign
::
list_of
(
Value
::
STRING
),
docstring
)
{
}
virtual
Value
doExecute
()
{
Task
&
task
=
static_cast
<
Task
&>
(
owner
());
std
::
vector
<
Value
>
values
=
getParameterValues
();
std
::
string
featureName
=
values
[
0
].
value
();
FeatureAbstract
&
feature
=
sotPool
.
getFeature
(
featureName
);
task
.
addFeature
(
feature
);
// return void
return
Value
();
}
};
// class AddFeature
}
// namespace task
}
// namespace command
}
//namespace sot
#endif //TASK_COMMAND_H
This diff is collapsed.
Click to expand it.
src/task/task.cpp
+
19
−
2
View file @
3fb2b37e
...
...
@@ -25,11 +25,14 @@
/* SOT */
#include
<sot-core/task.h>
#include
<sot-core/debug.h>
#include
<sot-core/pool.h>
#include
"../src/task/task-command.h"
using
namespace
std
;
using
namespace
sot
;
using
namespace
dynamicgraph
;
#include
<sot-core/factory.h>
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN
(
Task
,
"Task"
);
...
...
@@ -63,6 +66,21 @@ Task( const std::string& n )
signalRegistration
(
controlGainSIN
<<
dampingGainSINOUT
<<
controlSelectionSIN
<<
errorSOUT
);
//
// Commands
//
std
::
string
docstring
;
// AddFeature
docstring
=
"
\n
"
"
\n
"
" Add a feature to the task
\n
"
"
\n
"
" Input:
\n
"
" - name of the feature
\n
"
"
\n
"
;
addCommand
(
"add"
,
new
command
::
task
::
AddFeature
(
*
this
,
docstring
));
}
...
...
@@ -307,7 +325,6 @@ display( std::ostream& os ) const
/* --- PARAMS --------------------------------------------------------------- */
/* --- PARAMS --------------------------------------------------------------- */
/* --- PARAMS --------------------------------------------------------------- */
#include
<sot-core/pool.h>
static
void
readListIdx
(
std
::
istringstream
&
cmdArgs
,
unsigned
int
&
idx_beg
,
unsigned
int
&
idx_end
,
...
...
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