Setting maximum speed through controller

asked 2019-12-06 04:45:07 -0600

0novanta gravatar image

updated 2019-12-06 05:30:38 -0600

Hi, I'd like to be able to set a maximum velocity by pressing a specified button on a Logitech controller. So far I've been able to understand that a joy_node node takes raw input from the controller and in stores those values in a std_msg/Joy, then a teleop_node takes those messages as input and reads a config file as teleop.yaml, which looks like this:

  x: 1
  y: 0
  x: 0.75
  y: 0.75
  yaw: 2
  yaw: 1.57
enable_button: 5
enable_turbo_button: 7
  x: 1.20
  y: 1.20
  yaw: 6.28

I'd like to add few parameters, to be able to switch to a slow speed mode that activates when the button 0 (in the Logitech controller is button number 1, which is X on a Xbox One controller):

slow_vel_button: 0
  x: 0.25
  y: 0.25
  yaw: 2

The problem is, that I don't know how to make this. It seems to me that the easiest way would be to modify the teleop_node but I cannot do it since I only have the executable in /opt/ros/melodic/share/teleop_twist_joy. So I was thinking about writing another node that subscribe to std_msg/Joy and that dynamically changes teleop.yaml with the values that I want but I have no idea if that is doable or if there are easier and safer ways to do this.

I run ros on a Ubuntu Mate on a Raspberry.

Thanks for the help!

edit retag flag offensive close merge delete