Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stm32_libraries
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
tools
stm32_libraries
Commits
9b2d34e1
Commit
9b2d34e1
authored
4 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Solved some bugs in the protocol version conversion functions.
parent
ae2588e8
No related branches found
No related tags found
1 merge request
!12
Ubuntu 18 04
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dynamixel_base/src/dynamixel.c
+17
-6
17 additions, 6 deletions
dynamixel_base/src/dynamixel.c
dynamixel_base/src/dynamixel2.c
+20
-6
20 additions, 6 deletions
dynamixel_base/src/dynamixel2.c
with
37 additions
and
12 deletions
dynamixel_base/src/dynamixel.c
+
17
−
6
View file @
9b2d34e1
...
@@ -51,10 +51,21 @@ unsigned char dyn_convert_v2_inst_packet(unsigned char *source, unsigned char *d
...
@@ -51,10 +51,21 @@ unsigned char dyn_convert_v2_inst_packet(unsigned char *source, unsigned char *d
destination
[
DYN_HEADER_OFF
]
=
0xFF
;
destination
[
DYN_HEADER_OFF
]
=
0xFF
;
destination
[
DYN_HEADER_OFF
+
1
]
=
0xFF
;
destination
[
DYN_HEADER_OFF
+
1
]
=
0xFF
;
destination
[
DYN_ID_OFF
]
=
source
[
DYN2_ID_OFF
];
destination
[
DYN_ID_OFF
]
=
source
[
DYN2_ID_OFF
];
destination
[
DYN_LENGTH_OFF
]
=
source
[
DYN2_LENGTH_OFF
];
destination
[
DYN_LENGTH_OFF
]
=
2
;
//
source[DYN2_LENGTH_OFF];
destination
[
DYN_INST_OFF
]
=
source
[
DYN2_INST_OFF
];
destination
[
DYN_INST_OFF
]
=
source
[
DYN2_INST_OFF
];
for
(
i
=
0
;
i
<
destination
[
DYN_LENGTH_OFF
];
i
++
)
switch
(
source
[
DYN2_INST_OFF
])
destination
[
DYN_DATA_OFF
+
i
]
=
source
[
DYN2_DATA_OFF
+
i
];
{
case
DYN_PING
:
break
;
case
DYN_READ
:
destination
[
DYN_DATA_OFF
]
=
source
[
DYN2_DATA_OFF
];
destination
[
DYN_DATA_OFF
+
1
]
=
source
[
DYN2_DATA_OFF
+
2
];
destination
[
DYN_LENGTH_OFF
]
+=
2
;
break
;
case
DYN_WRITE
:
destination
[
DYN_DATA_OFF
]
=
source
[
DYN2_DATA_OFF
];
for
(
i
=
0
;
i
<
source
[
DYN2_DATA_OFF
]
-
5
;
i
++
)
destination
[
DYN_DATA_OFF
+
1
+
i
]
=
source
[
DYN2_DATA_OFF
+
2
+
i
];
destination
[
DYN_LENGTH_OFF
]
+=
source
[
DYN2_DATA_OFF
]
-
4
;
break
;
}
dyn_set_checksum
(
destination
);
dyn_set_checksum
(
destination
);
return
0x01
;
return
0x01
;
}
}
...
@@ -247,10 +258,10 @@ unsigned char dyn_convert_v2_status_packet(unsigned char *source, unsigned char
...
@@ -247,10 +258,10 @@ unsigned char dyn_convert_v2_status_packet(unsigned char *source, unsigned char
destination
[
DYN_HEADER_OFF
]
=
0xFF
;
destination
[
DYN_HEADER_OFF
]
=
0xFF
;
destination
[
DYN_HEADER_OFF
+
1
]
=
0xFF
;
destination
[
DYN_HEADER_OFF
+
1
]
=
0xFF
;
destination
[
DYN_ID_OFF
]
=
source
[
DYN2_ID_OFF
];
destination
[
DYN_ID_OFF
]
=
source
[
DYN2_ID_OFF
];
destination
[
DYN_LENGTH_OFF
]
=
source
[
DYN2_LENGTH_OFF
];
destination
[
DYN_LENGTH_OFF
]
=
source
[
DYN2_LENGTH_OFF
]
-
2
;
destination
[
DYN_ERROR_OFF
]
=
source
[
DYN2_ERROR_OFF
];
destination
[
DYN_ERROR_OFF
]
=
source
[
DYN2_ERROR_OFF
];
for
(
i
=
0
;
i
<
destination
[
DYN_LENGTH_OFF
];
i
++
)
for
(
i
=
0
;
i
<
destination
[
DYN_LENGTH_OFF
]
-
2
;
i
++
)
destination
[
DYN_DATA_OFF
+
i
]
=
source
[
DYN2_DATA_OFF
+
i
];
destination
[
DYN_DATA_OFF
+
i
]
=
source
[
DYN2_DATA_OFF
+
1
+
i
];
dyn_set_checksum
(
destination
);
dyn_set_checksum
(
destination
);
return
0x01
;
return
0x01
;
}
}
...
...
This diff is collapsed.
Click to expand it.
dynamixel_base/src/dynamixel2.c
+
20
−
6
View file @
9b2d34e1
...
@@ -88,11 +88,25 @@ unsigned char dyn2_convert_v1_inst_packet(unsigned char *source, unsigned char *
...
@@ -88,11 +88,25 @@ unsigned char dyn2_convert_v1_inst_packet(unsigned char *source, unsigned char *
destination
[
DYN2_HEADER_OFF
+
2
]
=
0xFD
;
destination
[
DYN2_HEADER_OFF
+
2
]
=
0xFD
;
destination
[
DYN2_RESERVED
]
=
0x00
;
destination
[
DYN2_RESERVED
]
=
0x00
;
destination
[
DYN2_ID_OFF
]
=
source
[
DYN_ID_OFF
];
destination
[
DYN2_ID_OFF
]
=
source
[
DYN_ID_OFF
];
destination
[
DYN2_LENGTH_OFF
]
=
source
[
DYN_LENGTH_OFF
];
destination
[
DYN2_LENGTH_OFF
]
=
3
;
//
source[DYN_LENGTH_OFF];
destination
[
DYN2_LENGTH_OFF
+
1
]
=
0x00
;
destination
[
DYN2_LENGTH_OFF
+
1
]
=
0x00
;
destination
[
DYN2_INST_OFF
]
=
source
[
DYN_INST_OFF
];
destination
[
DYN2_INST_OFF
]
=
source
[
DYN_INST_OFF
];
for
(
i
=
0
;
i
<
source
[
DYN_LENGTH_OFF
];
i
++
)
switch
(
source
[
DYN_INST_OFF
])
destination
[
DYN2_DATA_OFF
+
i
]
=
source
[
DYN_DATA_OFF
+
i
];
{
case
DYN_PING
:
break
;
case
DYN_READ
:
destination
[
DYN2_DATA_OFF
]
=
source
[
DYN_DATA_OFF
];
destination
[
DYN2_DATA_OFF
+
1
]
=
0x00
;
destination
[
DYN2_DATA_OFF
+
2
]
=
source
[
DYN_DATA_OFF
+
1
];
destination
[
DYN2_DATA_OFF
+
3
]
=
0x00
;
(
*
((
unsigned
short
int
*
)
&
destination
[
DYN2_LENGTH_OFF
]))
+=
4
;
break
;
case
DYN_WRITE
:
destination
[
DYN2_DATA_OFF
]
=
source
[
DYN_DATA_OFF
];
destination
[
DYN2_DATA_OFF
+
1
]
=
0x00
;
for
(
i
=
0
;
i
<
source
[
DYN_LENGTH_OFF
]
-
3
;
i
++
)
destination
[
DYN2_DATA_OFF
+
2
+
i
]
=
source
[
DYN_DATA_OFF
+
1
+
i
];
(
*
((
unsigned
short
int
*
)
&
destination
[
DYN2_LENGTH_OFF
]))
+=
source
[
DYN_LENGTH_OFF
]
-
1
;
break
;
}
dyn2_set_checksum
(
destination
);
dyn2_set_checksum
(
destination
);
return
0x01
;
return
0x01
;
...
@@ -417,12 +431,12 @@ unsigned char dyn2_convert_v1_status_packet(TDynInstruction inst,unsigned char *
...
@@ -417,12 +431,12 @@ unsigned char dyn2_convert_v1_status_packet(TDynInstruction inst,unsigned char *
destination
[
DYN2_HEADER_OFF
+
2
]
=
0xFD
;
destination
[
DYN2_HEADER_OFF
+
2
]
=
0xFD
;
destination
[
DYN2_RESERVED
]
=
0x00
;
destination
[
DYN2_RESERVED
]
=
0x00
;
destination
[
DYN2_ID_OFF
]
=
source
[
DYN_ID_OFF
];
destination
[
DYN2_ID_OFF
]
=
source
[
DYN_ID_OFF
];
destination
[
DYN2_LENGTH_OFF
]
=
source
[
DYN_LENGTH_OFF
];
destination
[
DYN2_LENGTH_OFF
]
=
source
[
DYN_LENGTH_OFF
]
+
2
;
destination
[
DYN2_LENGTH_OFF
+
1
]
=
0x00
;
destination
[
DYN2_LENGTH_OFF
+
1
]
=
0x00
;
destination
[
DYN2_INST_OFF
]
=
inst
;
destination
[
DYN2_INST_OFF
]
=
inst
;
destination
[
DYN2_ERROR_OFF
]
=
source
[
DYN_ERROR_OFF
];
destination
[
DYN2_ERROR_OFF
]
=
source
[
DYN_ERROR_OFF
];
for
(
i
=
0
;
i
<
source
[
DYN_LENGTH_OFF
];
i
++
)
for
(
i
=
0
;
i
<
destination
[
DYN
2
_LENGTH_OFF
]
-
4
;
i
++
)
destination
[
DYN2_DATA_OFF
+
i
]
=
source
[
DYN_DATA_OFF
+
i
];
destination
[
DYN2_DATA_OFF
+
1
+
i
]
=
source
[
DYN_DATA_OFF
+
i
];
dyn2_set_checksum
(
destination
);
dyn2_set_checksum
(
destination
);
return
0x01
;
return
0x01
;
...
...
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