Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
labrobotica
drivers
dynamixel
Commits
cd5cdf04
Commit
cd5cdf04
authored
Sep 22, 2018
by
Sergi Hernandez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified the slave example to simulate an RX28 Servo.
parent
e024ac80
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
src/examples/test_dynamixel_slave.cpp
src/examples/test_dynamixel_slave.cpp
+17
-0
No files found.
src/examples/test_dynamixel_slave.cpp
View file @
cd5cdf04
...
...
@@ -3,6 +3,16 @@
#include <iostream>
#include <boost/bind.hpp>
#define SERVO_MEMORY_SIZE 50
unsigned
char
rx28_servo_data
[
SERVO_MEMORY_SIZE
]
=
{
0x1c
,
0x00
,
0x00
,
0x01
,
0x22
,
0xFA
,
0x00
,
0x00
,
0xFF
,
0x03
,
0x00
,
0x50
,
0x3C
,
0xBE
,
0xFF
,
0x03
,
0x02
,
0x24
,
0x24
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x01
,
0x01
,
0x20
,
0x20
,
0x00
,
0x00
,
0x00
,
0x00
,
0xFF
,
0x03
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x78
,
0x19
,
0x00
,
0x00
,
0x00
,
0x00
,
0x20
,
0x00
};
std
::
string
serial
=
"A400gavm"
;
void
on_ping
(
void
)
...
...
@@ -12,7 +22,11 @@ void on_ping(void)
unsigned
char
on_read
(
unsigned
short
int
address
,
unsigned
short
int
length
,
unsigned
char
*
data
)
{
unsigned
char
num
;
std
::
cout
<<
"read operation at address "
<<
address
<<
" with length "
<<
length
<<
std
::
endl
;
for
(
unsigned
int
i
=
address
,
num
=
0
;
i
<
address
+
length
||
i
<
SERVO_MEMORY_SIZE
;
i
++
,
num
++
)
data
[
num
]
=
rx28_servo_data
[
i
];
return
0x00
;
}
...
...
@@ -21,6 +35,9 @@ unsigned char on_write(unsigned short int address, unsigned short int length, un
{
std
::
cout
<<
"wrirte operation at address "
<<
address
<<
" with length "
<<
length
<<
std
::
endl
;
for
(
unsigned
int
i
=
address
,
num
=
0
;
i
<
address
+
length
||
i
<
SERVO_MEMORY_SIZE
;
i
++
,
num
++
)
rx28_servo_data
[
i
]
=
data
[
num
];
return
0x00
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment