Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arm_control
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
tv3
arm
arm_control
Commits
6f464e5d
Commit
6f464e5d
authored
5 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Added two buttons to increase and decrease the maximum speed.
parent
cc3f764b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/arm_control.h
+2
-1
2 additions, 1 deletion
include/arm_control.h
src/arm_control.cpp
+21
-6
21 additions, 6 deletions
src/arm_control.cpp
src/examples/arm_control_test.cpp
+0
-1
0 additions, 1 deletion
src/examples/arm_control_test.cpp
with
23 additions
and
8 deletions
include/arm_control.h
+
2
−
1
View file @
6f464e5d
...
...
@@ -48,7 +48,8 @@ class CArmControl
void
move
(
unsigned
int
axis_id
,
double
torque
);
void
stop
(
void
);
// stored poses
void
set_poses_max_speed
(
double
max
);
void
increase_max_speed
(
void
);
void
decrease_max_speed
(
void
);
void
load_poses
(
const
std
::
string
&
filename
);
void
save_poses
(
const
std
::
string
&
filename
);
void
update_pose
(
unsigned
int
pose_id
);
...
...
This diff is collapsed.
Click to expand it.
src/arm_control.cpp
+
21
−
6
View file @
6f464e5d
...
...
@@ -19,6 +19,12 @@ void button_callback(void *param,unsigned int button_id,bool level)
try
{
switch
(
button_id
)
{
case
4
:
if
(
level
)
arm
->
increase_max_speed
();
break
;
case
6
:
if
(
level
)
arm
->
decrease_max_speed
();
break
;
case
8
:
if
(
level
)
arm
->
enable_torque
(
false
);
else
...
...
@@ -126,6 +132,8 @@ CArmControl::CArmControl(const std::string &joy_device,std::string &dyn_serial,
for
(
unsigned
int
i
=
0
;
i
<
this
->
joy
.
get_num_buttons
();
i
++
)
this
->
current_button_state
[
i
]
=
this
->
joy
.
get_button_state
(
i
);
// assign callbacks
this
->
joy
.
enable_button_callback
(
4
,
button_callback
,
this
);
this
->
joy
.
enable_button_callback
(
6
,
button_callback
,
this
);
this
->
joy
.
enable_button_callback
(
8
,
button_callback
,
this
);
this
->
joy
.
enable_button_callback
(
10
,
button_callback
,
this
);
this
->
joy
.
enable_button_callback
(
12
,
button_callback
,
this
);
...
...
@@ -345,13 +353,20 @@ void CArmControl::stop(void)
this
->
motors
[
ROLL
]
->
move_absolute_angle
(
pos
,
50.0
);
}
void
CArmControl
::
set_po
se
s
_max_speed
(
double
max
)
void
CArmControl
::
increa
se_max_speed
(
void
)
{
if
(
max
>
100.0
)
max
=
0.0
;
else
if
(
max
<
10.0
)
max
=
10.0
;
this
->
max_speed
=
max
;
this
->
max_speed
+=
10.0
;
if
(
this
->
max_speed
>
100.0
)
this
->
max_speed
=
100.0
;
std
::
cout
<<
"speed: "
<<
this
->
max_speed
<<
std
::
endl
;
}
void
CArmControl
::
decrease_max_speed
(
void
)
{
this
->
max_speed
-=
10.0
;
if
(
this
->
max_speed
<
10.0
)
this
->
max_speed
=
10.0
;
std
::
cout
<<
"speed: "
<<
this
->
max_speed
<<
std
::
endl
;
}
void
CArmControl
::
load_poses
(
const
std
::
string
&
filename
)
...
...
This diff is collapsed.
Click to expand it.
src/examples/arm_control_test.cpp
+
0
−
1
View file @
6f464e5d
...
...
@@ -11,7 +11,6 @@ int main(int argc, char *argv[])
CArmControl
arm
(
joy_device
,
dyn_serial
,
1000000
,
6
,
5
,
4
);
arm
.
load_poses
(
"/home/sergi/Downloads/arm_control/src/xml/poses.xml"
);
arm
.
set_poses_max_speed
(
50.0
);
arm
.
set_max_angles
(
PAN
,
90.0
,
-
90.0
);
arm
.
set_max_angles
(
TILT
,
90.0
,
-
90.0
);
arm
.
set_max_angles
(
ROLL
,
90.0
,
-
90.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