Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90434623
walkOneLeg.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 1, 15:20
Size
1 KB
Mime Type
text/x-c
Expires
Sun, Nov 3, 15:20 (2 d)
Engine
blob
Format
Raw Data
Handle
22073654
Attached To
R6622 liboncilla
walkOneLeg.cpp
View Options
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <math.h>
#include <ctime>
#include <boost/thread/recursive_mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/timer.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/program_options.hpp>
#include "Oncilla.h"
#include "OncillaSynchronizer.h"
using
namespace
std
;
using
namespace
boost
;
using
namespace
boost
::
program_options
;
using
namespace
rci
;
using
namespace
rci
::
oncilla
;
int
main
(
int
ac
,
char
**
av
)
{
unsigned
int
cycleTimeMs
=
50
;
double
amplitude
=
1.0
;
double
offset
=
0.0
;
double
frequency
=
1
;
/**
* Handle command line options
*/
options_description
desc
(
"Allowed options"
);
desc
.
add_options
()(
"help"
,
"Produce help message"
)(
"frequency"
,
value
<
double
>
(),
"Frequency of oscillation in Hertz"
)(
"amplitude"
,
value
<
double
>
(),
"Amplitude of the sine"
)(
"offset"
,
value
<
double
>
(),
"Offset to the output value"
);
variables_map
vm
;
store
(
parse_command_line
(
ac
,
av
,
desc
),
vm
);
notify
(
vm
);
if
(
vm
.
count
(
"help"
))
{
cout
<<
desc
<<
"
\n
"
;
return
1
;
}
if
(
vm
.
count
(
"frequency"
))
{
frequency
=
vm
[
"frequency"
].
as
<
double
>
();
}
cout
<<
"Frequency set to "
<<
frequency
<<
" Hertz.
\n
"
;
if
(
vm
.
count
(
"amplitude"
))
{
amplitude
=
vm
[
"amplitude"
].
as
<
double
>
();
}
cout
<<
"Amplitude set to "
<<
amplitude
<<
".
\n
"
;
if
(
vm
.
count
(
"offset"
))
{
offset
=
vm
[
"offset"
].
as
<
double
>
();
}
cout
<<
"Offset set to "
<<
offset
<<
".
\n
"
;
OncillaSynchronizerPtr
s
=
OncillaSynchronizerPtr
(
new
OncillaSynchronizer
());
Oncilla
o
;
return
EXIT_SUCCESS
;
}
Event Timeline
Log In to Comment