Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow default values even if axis_linear is defined #34

Open
wants to merge 1 commit into
base: indigo-devel
Choose a base branch
from

Conversation

dave992
Copy link

@dave992 dave992 commented Feb 4, 2020

Potential fix for #33

Currently, default scale values are not used if a non-default axis is used for either axis_linear or axis_angular. As a result, the cmd_vel topic will only command velocities of 0 for the affected axes.

By removing the if-statement, the default values are still taken into account if another axis is used.

@@ -74,30 +74,14 @@ TeleopTwistJoy::TeleopTwistJoy(ros::NodeHandle* nh, ros::NodeHandle* nh_param)
nh_param->param<int>("enable_button", pimpl_->enable_button, 0);
nh_param->param<int>("enable_turbo_button", pimpl_->enable_turbo_button, -1);

if (nh_param->getParam("axis_linear", pimpl_->axis_linear_map))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dave992 this checks if the param is a map .

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It however does not ensure that all parameters of the map are set (in this case scale_linear and scale_linear_turbo), or alternatively provide any default value in case they are missing.

In teleop_ps4.yaml it only sets the yaw axis for example. It then does check for both scale_linear and scale_linear_turbo, but as they do not exist they use the value resulting from the initialization of the pimpl_ object. This does not correspond to the default values that are used when the axis_linear is not set.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants