Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dynamixel_robot_gazebo
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
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
humanoides
common
ROS
dynamixel_robot_gazebo
Commits
11f629d5
Commit
11f629d5
authored
5 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Added the implementation for the simulation of the XL320 servo.
parent
94e5eff5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/dynamixel_robot_gazebo.cpp
+2
-2
2 additions, 2 deletions
src/dynamixel_robot_gazebo.cpp
src/dynamixel_servo.cpp
+67
-10
67 additions, 10 deletions
src/dynamixel_servo.cpp
with
69 additions
and
12 deletions
src/dynamixel_robot_gazebo.cpp
+
2
−
2
View file @
11f629d5
...
...
@@ -166,9 +166,9 @@ namespace dynamixel_robot_gazebo
try
{
dynamixel_nh
.
getParam
(
"protocol_version"
,
protocol
);
if
(
protocol
==
1
)
this
->
dyn_slave
=
new
CDynamixelSlaveSerial
(
root_nh
.
getNamespace
()
+
"_slave"
,
device_name
,
dyn_version1
);
this
->
dyn_slave
=
new
CDynamixelSlaveSerial
(
name
+
"_slave"
,
device_name
,
dyn_version1
);
else
if
(
protocol
==
2
)
this
->
dyn_slave
=
new
CDynamixelSlaveSerial
(
root_nh
.
getNamespace
()
+
"_slave"
,
device_name
,
dyn_version2
);
this
->
dyn_slave
=
new
CDynamixelSlaveSerial
(
name
+
"_slave"
,
device_name
,
dyn_version2
);
else
{
ROS_ERROR_STREAM
(
"Dynamixel gazebo plugin: Invalid protocol version"
);
...
...
This diff is collapsed.
Click to expand it.
src/dynamixel_servo.cpp
+
67
−
10
View file @
11f629d5
...
...
@@ -114,6 +114,11 @@ namespace dynamixel_robot_gazebo
}
else
if
(
model
==
"XL320"
)
{
this
->
encoder_res
=
1023
;
this
->
max_angle
=
300.0
;
this
->
gear_ratio
=
238.0
;
this
->
max_torque
=
0.39
;
this
->
max_speed
=
684.0
;
this
->
init_pid
(
joint_name
,
controller_nh
);
}
else
if
(
model
==
"XL430"
)
...
...
@@ -166,6 +171,12 @@ namespace dynamixel_robot_gazebo
*
((
unsigned
short
int
*
)
&
this
->
memory
[
82
])
=
gains
.
d_gain_
;
*
((
unsigned
short
int
*
)
&
this
->
memory
[
84
])
=
gains
.
d_gain_
;
}
else
if
(
this
->
model
==
"XL320"
)
{
this
->
memory
[
27
]
=
gains
.
d_gain_
;
this
->
memory
[
28
]
=
gains
.
i_gain_
;
this
->
memory
[
29
]
=
gains
.
p_gain_
;
}
}
}
...
...
@@ -326,6 +337,33 @@ namespace dynamixel_robot_gazebo
this
->
memory
[
35
]
=
3
;
}
}
else
if
(
model
==
"XL320"
)
{
this
->
memory
[
0
]
=
94
;
this
->
memory
[
1
]
=
1
;
this
->
memory
[
3
]
=
this
->
id
;
this
->
memory
[
4
]
=
1
;
this
->
memory
[
5
]
=
250
;
this
->
memory
[
8
]
=
255
;
this
->
memory
[
9
]
=
3
;
this
->
memory
[
11
]
=
2
;
this
->
memory
[
12
]
=
65
;
this
->
memory
[
13
]
=
60
;
this
->
memory
[
13
]
=
90
;
this
->
memory
[
15
]
=
255
;
this
->
memory
[
16
]
=
3
;
this
->
memory
[
17
]
=
2
;
this
->
memory
[
18
]
=
7
;
// initialize RAM
this
->
memory
[
27
]
=
0
;
this
->
memory
[
28
]
=
0
;
this
->
memory
[
29
]
=
32
;
this
->
memory
[
30
]
=
255
;
this
->
memory
[
31
]
=
1
;
this
->
memory
[
35
]
=
255
;
this
->
memory
[
36
]
=
3
;
this
->
memory
[
48
]
=
32
;
}
else
{
this
->
memory
[
7
]
=
this
->
id
;
...
...
@@ -419,6 +457,11 @@ namespace dynamixel_robot_gazebo
this
->
memory
[
36
]
=
value
&
0x000000FF
;
this
->
memory
[
37
]
=
(
value
>>
8
)
&
0x000000FF
;
}
else
if
(
this
->
model
==
"XL320"
)
{
this
->
memory
[
37
]
=
value
&
0x000000FF
;
this
->
memory
[
38
]
=
(
value
>>
8
)
&
0x000000FF
;
}
else
{
this
->
memory
[
132
]
=
value
&
0x000000FF
;
...
...
@@ -439,7 +482,7 @@ namespace dynamixel_robot_gazebo
this
->
memory
[
38
]
=
value
&
0x000000FF
;
this
->
memory
[
39
]
=
(
value
>>
8
)
&
0x000000FF
;
}
else
if
(
model
==
"MX12W"
)
else
if
(
model
==
"MX12W"
)
{
value
/=
0.916
;
this
->
memory
[
38
]
=
value
&
0x000000FF
;
...
...
@@ -451,6 +494,12 @@ namespace dynamixel_robot_gazebo
this
->
memory
[
38
]
=
value
&
0x000000FF
;
this
->
memory
[
39
]
=
(
value
>>
8
)
&
0x000000FF
;
}
else
if
(
this
->
model
==
"XL320"
)
{
value
/=
0.111
;
this
->
memory
[
39
]
=
value
&
0x000000FF
;
this
->
memory
[
40
]
=
(
value
>>
8
)
&
0x000000FF
;
}
else
{
value
/=
0.229
;
...
...
@@ -474,6 +523,11 @@ namespace dynamixel_robot_gazebo
this
->
memory
[
40
]
=
value
&
0x000000FF
;
this
->
memory
[
41
]
=
(
value
>>
8
)
&
0x000000FF
;
}
else
if
(
this
->
model
==
"XL320"
)
{
this
->
memory
[
41
]
=
value
&
0x000000FF
;
this
->
memory
[
42
]
=
(
value
>>
8
)
&
0x000000FF
;
}
else
{
this
->
memory
[
124
]
=
value
&
0x000000FF
;
...
...
@@ -486,7 +540,7 @@ namespace dynamixel_robot_gazebo
unsigned
int
value
=
0
;
double
angle
;
if
(
model
==
"AX12W"
||
model
==
"AX12A"
||
model
==
"AX18A"
||
model
==
"MX12W"
||
model
==
"MX28v1"
||
model
==
"MX64v1"
||
model
==
"MX106v1"
)
if
(
model
==
"AX12W"
||
model
==
"AX12A"
||
model
==
"AX18A"
||
model
==
"MX12W"
||
model
==
"MX28v1"
||
model
==
"MX64v1"
||
model
==
"MX106v1"
||
model
==
"XL320"
)
value
=
this
->
memory
[
30
]
+
(
this
->
memory
[
31
]
<<
8
);
else
value
=
this
->
memory
[
116
]
+
(
this
->
memory
[
133
]
<<
8
)
+
(
this
->
memory
[
134
]
<<
16
)
+
(
this
->
memory
[
135
]
<<
24
);
...
...
@@ -500,19 +554,19 @@ namespace dynamixel_robot_gazebo
unsigned
int
value
=
0
;
double
speed
;
if
(
model
==
"AX12W"
||
model
==
"AX12A"
||
model
==
"AX18A"
||
model
==
"MX12W"
||
model
==
"MX28v1"
||
model
==
"MX64v1"
||
model
==
"MX106v1"
)
if
(
model
==
"AX12W"
||
model
==
"AX12A"
||
model
==
"AX18A"
||
model
==
"MX12W"
||
model
==
"MX28v1"
||
model
==
"MX64v1"
||
model
==
"MX106v1"
||
model
==
"XL320"
)
{
this
->
memory
[
32
]
=
value
&
0x000000FF
;
this
->
memory
[
33
]
=
(
value
>>
8
)
&
0x000000FF
;
value
=
this
->
memory
[
32
];
value
+=
this
->
memory
[
33
]
<<
8
;
}
else
{
this
->
memory
[
104
]
=
value
&
0x000000FF
;
this
->
memory
[
105
]
=
(
value
>>
8
)
&
0x000000FF
;
this
->
memory
[
106
]
=
(
value
>>
16
)
&
0x000000FF
;
this
->
memory
[
107
]
=
(
value
>>
24
)
&
0x000000FF
;
value
=
this
->
memory
[
104
];
value
+=
this
->
memory
[
105
]
<<
8
;
value
+=
this
->
memory
[
106
]
<<
16
;
value
+=
this
->
memory
[
107
]
<<
24
;
}
if
(
model
==
"AX12W"
||
model
==
"AX12A"
||
model
==
"AX18A"
)
if
(
model
==
"AX12W"
||
model
==
"AX12A"
||
model
==
"AX18A"
||
model
==
"XL320"
)
value
*=
0.111
;
else
if
(
model
==
"MX12W"
)
value
*=
0.916
;
...
...
@@ -527,10 +581,12 @@ namespace dynamixel_robot_gazebo
void
CDynServo
::
on_ping
(
void
)
{
std
::
cout
<<
"device "
<<
(
int
)
this
->
id
<<
" pinged"
<<
std
::
endl
;
}
unsigned
char
CDynServo
::
on_read
(
unsigned
short
int
address
,
unsigned
short
int
length
,
unsigned
char
*
data
)
{
std
::
cout
<<
"device "
<<
(
int
)
this
->
id
<<
" read operation"
<<
std
::
endl
;
for
(
unsigned
int
i
=
0
;
i
<
length
;
i
++
)
data
[
i
]
=
this
->
memory
[
address
+
i
];
...
...
@@ -539,6 +595,7 @@ namespace dynamixel_robot_gazebo
unsigned
char
CDynServo
::
on_write
(
unsigned
short
int
address
,
unsigned
short
int
length
,
unsigned
char
*
data
)
{
std
::
cout
<<
"device "
<<
(
int
)
this
->
id
<<
" write operation"
<<
std
::
endl
;
for
(
unsigned
int
i
=
0
;
i
<
length
;
i
++
)
this
->
memory
[
address
+
i
]
=
data
[
i
];
return
0
;
...
...
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