Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
robotis_motion_pages
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
robotis_motion_pages
Commits
1c153697
Commit
1c153697
authored
11 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Added a new input parameter to specify the desired output filename.
Adapted the program to the new features of the robotis_mtn library.
parent
845b4886
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/bioloid_motion_pages.cpp
+8
-3
8 additions, 3 deletions
src/bioloid_motion_pages.cpp
src/stm32_src_mtn.cpp
+13
-5
13 additions, 5 deletions
src/stm32_src_mtn.cpp
with
21 additions
and
8 deletions
src/bioloid_motion_pages.cpp
+
8
−
3
View file @
1c153697
...
...
@@ -18,9 +18,9 @@ int main(const int argc,char *argv[])
CRobotisPage
page
;
CRobotisStep
step
;
if
(
argc
!=
2
)
if
(
argc
!=
3
)
{
std
::
cout
<<
"A motion file
must be provided
(either .mtn or .bin)"
<<
std
::
endl
;
std
::
cout
<<
"A motion file (either .mtn or .bin)
and the output filename must be provided
"
<<
std
::
endl
;
return
(
EXIT_FAILURE
);
}
else
...
...
@@ -41,6 +41,11 @@ int main(const int argc,char *argv[])
std
::
cout
<<
"Invalid file format. Supported formats are .mtn and .bin."
<<
std
::
endl
;
return
(
EXIT_FAILURE
);
}
if
(
strstr
(
argv
[
2
],
".c"
)
==
NULL
)
{
std
::
cout
<<
"Invalid output file format. Supported format is .c."
<<
std
::
endl
;
return
(
EXIT_FAILURE
);
}
}
catch
(
CMtnException
&
e
){
std
::
cout
<<
e
.
what
()
<<
std
::
endl
;
}
...
...
@@ -70,7 +75,7 @@ int main(const int argc,char *argv[])
}
}
source
.
load_motions
(
motions
);
source
.
generate_src_file
(
std
::
string
(
"test_src.c"
));
source
.
generate_src_file
(
std
::
string
(
argv
[
2
]
));
return
(
EXIT_SUCCESS
);
}
...
...
This diff is collapsed.
Click to expand it.
src/stm32_src_mtn.cpp
+
13
−
5
View file @
1c153697
...
...
@@ -68,7 +68,8 @@ void CSTM32SrcMtn::write_word_vector(std::ofstream &file,const std::vector<unsig
unsigned
char
CSTM32SrcMtn
::
compute_checksum
(
CRobotisPage
&
page
)
{
std
::
vector
<
unsigned
short
int
>
angles
;
std
::
vector
<
unsigned
char
>
compliance
;
std
::
vector
<
unsigned
char
>
cw_compliance
;
std
::
vector
<
unsigned
char
>
ccw_compliance
;
unsigned
char
checksum
=
0x00
;
unsigned
int
i
=
0
,
j
=
0
;
CRobotisStep
step
;
...
...
@@ -88,9 +89,12 @@ unsigned char CSTM32SrcMtn::compute_checksum(CRobotisPage &page)
checksum
+=
(
unsigned
char
)
page
.
get_inertial
();
checksum
+=
(
unsigned
char
)
page
.
get_next_page
();
checksum
+=
(
unsigned
char
)
page
.
get_exit_page
();
compliance
=
page
.
get_compliances
();
for
(
i
=
0
;
i
<
compliance
.
size
();
i
++
)
checksum
+=
compliance
[
i
];
cw_compliance
=
page
.
get_cw_compliances
();
ccw_compliance
=
page
.
get_ccw_compliances
();
for
(
i
=
0
;
i
<
cw_compliance
.
size
();
i
++
)
{
checksum
+=
(
cw_compliance
[
i
]
<<
4
)
+
ccw_compliance
[
i
];
}
for
(
i
=
0
;
i
<
page
.
get_num_steps
();
i
++
)
{
step
=
page
.
get_step
(
i
);
...
...
@@ -152,7 +156,11 @@ void CSTM32SrcMtn::generate_src_file(const std::string &filename)
this
->
write_byte_vector
(
file
,
std
::
vector
<
unsigned
char
>
(
4
,
0
),
3
);
this
->
write_byte_vector
(
file
,
std
::
vector
<
unsigned
char
>
(
1
,
this
->
compute_checksum
(
page
)),
3
);
byte_vector
.
resize
(
PAGE_MAX_NUM_SERVOS
);
memcpy
(
byte_vector
.
data
(),
page
.
get_compliances
().
data
(),
page
.
get_compliances
().
size
());
for
(
j
=
0
;
j
<
page
.
get_cw_compliances
().
size
();
j
++
)
{
byte_vector
[
j
]
=
page
.
get_cw_compliance
(
j
)
<<
4
;
byte_vector
[
j
]
|=
page
.
get_ccw_compliance
(
j
);
}
this
->
write_byte_vector
(
file
,
byte_vector
,
3
);
this
->
write_byte_vector
(
file
,
std
::
vector
<
unsigned
char
>
(
1
,
0
),
3
,
true
);
file
<<
" },"
<<
std
::
endl
;
// header end
...
...
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