Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dynamixel_motor_cont
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
Service Desk
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
labrobotica
drivers
dynamixel_motor_cont
Commits
0098bd86
Commit
0098bd86
authored
13 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Added an example for the open loop control of a group
parent
7f6e0030
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/examples/test_dynamixel_motor_group_open_loop.cpp
+64
-0
64 additions, 0 deletions
src/examples/test_dynamixel_motor_group_open_loop.cpp
with
64 additions
and
0 deletions
src/examples/test_dynamixel_motor_group_open_loop.cpp
0 → 100755
+
64
−
0
View file @
0098bd86
#include
"dynamixelexceptions.h"
#include
"dynamixelserver.h"
#include
"eventserver.h"
#include
"exceptions.h"
#include
"dynamixel_motor_group.h"
#include
"dynamixel_motor.h"
#include
<iostream>
#include
<math.h>
std
::
string
cont1_name
=
"AX-12+_1"
;
std
::
string
cont2_name
=
"AX-12+_2"
;
std
::
string
cont3_name
=
"AX-12+_3"
;
std
::
string
cont4_name
=
"AX-12+_4"
;
std
::
string
group_name
=
"GROUP1"
;
int
main
(
int
argc
,
char
*
argv
[])
{
CDynamixelServer
*
dyn_server
=
CDynamixelServer
::
instance
();
std
::
vector
<
float
>
pos
(
2
),
vel
(
2
),
acc
(
2
);
CDynamixelMotor
*
cont1
,
*
cont2
,
*
cont3
,
*
cont4
;
CDynamixelMotorGroup
*
group
;
int
dir
=
1
,
i
=
0
;
try
{
if
(
dyn_server
->
get_num_buses
()
>
0
)
{
cont1
=
new
CDynamixelMotor
(
cont1_name
,
0
,
1000000
,
21
);
cont2
=
new
CDynamixelMotor
(
cont2_name
,
0
,
1000000
,
11
);
cont1
->
set_compliance_slope
(
254
,
254
);
cont1
->
set_punch
(
4
);
cont1
->
set_compliance_margin
(
1
,
1
);
cont2
->
set_compliance_slope
(
254
,
254
);
cont2
->
set_punch
(
16
);
cont2
->
set_compliance_margin
(
1
,
1
);
group
=
new
CDynamixelMotorGroup
(
group_name
);
group
->
add_motor_control
(
cont1
);
group
->
add_motor_control
(
cont2
);
group
->
use_open_loop_control
();
pos
[
0
]
=
512
;
pos
[
1
]
=
512
;
group
->
move
(
pos
,
vel
,
acc
);
sleep
(
5
);
for
(;;)
{
std
::
cout
<<
pos
[
0
]
<<
std
::
endl
;
if
(
pos
[
0
]
>=
700
)
dir
=-
1
;
else
if
(
pos
[
0
]
<=
300
)
dir
=
1
;
for
(
i
=
0
;
i
<
pos
.
size
();
i
++
)
{
pos
[
i
]
+=
5
*
dir
;
}
group
->
move
(
pos
,
vel
,
acc
);
usleep
(
20000
);
}
}
}
catch
(
CException
&
e
){
std
::
cout
<<
e
.
what
()
<<
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