Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iri_twist_to_manual_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
mobile_robotics
ADC
ADC_2018
iri_twist_to_manual_control
Commits
b334faec
Commit
b334faec
authored
8 years ago
by
Fernando Herrero
Browse files
Options
Downloads
Patches
Plain Diff
twist_to_manual_control: allow to enable/disable speed and sterring sign or direction
parent
ed29b1ff
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cfg/TwistToManualControl.cfg
+3
-0
3 additions, 0 deletions
cfg/TwistToManualControl.cfg
launch/node.launch
+5
-2
5 additions, 2 deletions
launch/node.launch
src/twist_to_manual_control_alg_node.cpp
+21
-4
21 additions, 4 deletions
src/twist_to_manual_control_alg_node.cpp
with
29 additions
and
6 deletions
cfg/TwistToManualControl.cfg
+
3
−
0
View file @
b334faec
...
@@ -49,6 +49,9 @@ gen.add("speed_max", int_t, 0, "Maximum speed value", 500, -1000, 1000
...
@@ -49,6 +49,9 @@ gen.add("speed_max", int_t, 0, "Maximum speed value", 500, -1000, 1000
gen.add("linear_sat_min",
double_t, 0, "Maximum linear speed value to take into account", -0.5, -5.0, 5.0)
gen.add("linear_sat_min",
double_t, 0, "Maximum linear speed value to take into account", -0.5, -5.0, 5.0)
gen.add("linear_sat_max",
double_t, 0, "Minimum linear speed value to take into account", 0.5, -5.0, 5.0)
gen.add("linear_sat_max",
double_t, 0, "Minimum linear speed value to take into account", 0.5, -5.0, 5.0)
gen.add("invert_speed",
bool_t, 0, "Invert speed signum", False)
gen.add("invert_steering",
bool_t, 0, "Invert steering direction", False)
...
...
This diff is collapsed.
Click to expand it.
launch/node.launch
+
5
−
2
View file @
b334faec
...
@@ -13,8 +13,8 @@
...
@@ -13,8 +13,8 @@
<remap from="~steering" to="/manual_control/steering"/>
<remap from="~steering" to="/manual_control/steering"/>
<remap from="~speed" to="/manual_control/speed"/>
<remap from="~speed" to="/manual_control/speed"/>
<param name="steering_min" value="
45
"/>
<param name="steering_min" value="
70
"/>
<param name="steering_max" value="1
35
"/>
<param name="steering_max" value="1
10
"/>
<param name="angular_sat_min" value="-0.5"/>
<param name="angular_sat_min" value="-0.5"/>
<param name="angular_sat_max" value="0.5"/>
<param name="angular_sat_max" value="0.5"/>
...
@@ -24,6 +24,9 @@
...
@@ -24,6 +24,9 @@
<param name="linear_sat_min" value="-1.0"/>
<param name="linear_sat_min" value="-1.0"/>
<param name="linear_sat_max" value="1.0"/>
<param name="linear_sat_max" value="1.0"/>
<param name="invert_speed" value="True"/>
<param name="invert_steering" value="True"/>
</node>
</node>
<!-- </group>-->
<!-- </group>-->
...
...
This diff is collapsed.
Click to expand it.
src/twist_to_manual_control_alg_node.cpp
+
21
−
4
View file @
b334faec
...
@@ -59,6 +59,8 @@ void TwistToManualControlAlgNode::mainNodeThread(void)
...
@@ -59,6 +59,8 @@ void TwistToManualControlAlgNode::mainNodeThread(void)
/* [subscriber callbacks] */
/* [subscriber callbacks] */
void
TwistToManualControlAlgNode
::
cmd_vel_callback
(
const
geometry_msgs
::
Twist
::
ConstPtr
&
msg
)
void
TwistToManualControlAlgNode
::
cmd_vel_callback
(
const
geometry_msgs
::
Twist
::
ConstPtr
&
msg
)
{
{
double
min
;
double
max
;
//ROS_INFO("TwistToManualControlAlgNode::cmd_vel_callback: New Message Received");
//ROS_INFO("TwistToManualControlAlgNode::cmd_vel_callback: New Message Received");
//use appropiate mutex to shared variables if necessary
//use appropiate mutex to shared variables if necessary
...
@@ -73,7 +75,17 @@ void TwistToManualControlAlgNode::cmd_vel_callback(const geometry_msgs::Twist::C
...
@@ -73,7 +75,17 @@ void TwistToManualControlAlgNode::cmd_vel_callback(const geometry_msgs::Twist::C
if
(
angular
<
this
->
config_
.
angular_sat_min
)
if
(
angular
<
this
->
config_
.
angular_sat_min
)
angular
=
this
->
config_
.
angular_sat_min
;
angular
=
this
->
config_
.
angular_sat_min
;
int
steering
=
(((
angular
-
this
->
config_
.
angular_sat_min
)
*
(
this
->
config_
.
steering_max
-
this
->
config_
.
steering_min
))
/
(
this
->
config_
.
angular_sat_max
-
this
->
config_
.
angular_sat_min
))
+
this
->
config_
.
steering_min
;
if
(
!
this
->
config_
.
invert_steering
)
{
min
=
this
->
config_
.
steering_min
;
max
=
this
->
config_
.
steering_max
;
}
else
{
min
=
this
->
config_
.
steering_max
;
max
=
this
->
config_
.
steering_min
;
}
int
steering
=
(((
angular
-
this
->
config_
.
angular_sat_min
)
*
(
max
-
min
))
/
(
this
->
config_
.
angular_sat_max
-
this
->
config_
.
angular_sat_min
))
+
min
;
double
linear
=
msg
->
linear
.
x
;
double
linear
=
msg
->
linear
.
x
;
if
(
linear
>
this
->
config_
.
linear_sat_max
)
if
(
linear
>
this
->
config_
.
linear_sat_max
)
...
@@ -81,12 +93,17 @@ void TwistToManualControlAlgNode::cmd_vel_callback(const geometry_msgs::Twist::C
...
@@ -81,12 +93,17 @@ void TwistToManualControlAlgNode::cmd_vel_callback(const geometry_msgs::Twist::C
if
(
linear
<
this
->
config_
.
linear_sat_min
)
if
(
linear
<
this
->
config_
.
linear_sat_min
)
linear
=
this
->
config_
.
linear_sat_min
;
linear
=
this
->
config_
.
linear_sat_min
;
int
speed
=
(((
linear
-
this
->
config_
.
linear_sat_min
)
*
(
this
->
config_
.
speed_max
-
this
->
config_
.
speed_min
))
/
(
this
->
config_
.
linear_sat_max
-
this
->
config_
.
linear_sat_min
))
+
this
->
config_
.
speed_min
;
min
=
this
->
config_
.
speed_min
;
max
=
this
->
config_
.
speed_max
;
int
speed
=
(((
linear
-
this
->
config_
.
linear_sat_min
)
*
(
max
-
min
))
/
(
this
->
config_
.
linear_sat_max
-
this
->
config_
.
linear_sat_min
))
+
min
;
this
->
steering_Int16_msg_
.
data
=
steering
;
this
->
steering_Int16_msg_
.
data
=
steering
;
this
->
speed_Int16_msg_
.
data
=
speed
;
if
(
this
->
config_
.
invert_speed
)
this
->
speed_Int16_msg_
.
data
=
-
speed
;
else
this
->
speed_Int16_msg_
.
data
=
speed
;
this
->
steering_publisher_
.
publish
(
this
->
steering_Int16_msg_
);
this
->
steering_publisher_
.
publish
(
this
->
steering_Int16_msg_
);
this
->
speed_publisher_
.
publish
(
this
->
speed_Int16_msg_
);
this
->
speed_publisher_
.
publish
(
this
->
speed_Int16_msg_
);
...
...
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