chrisl8 / ArloBot

ROS Package for a Parallax ArloBot Robot
https://log.voidshipephemeral.space/Arlobot/ArloBot+Build+Index
MIT License
39 stars 27 forks source link

The Arlobot software does not presently appear to support Bluetooth Gamepads #188

Closed TCIII closed 1 year ago

TCIII commented 2 years ago

@chrisl8,

Issue: The Arlobot software presently only supports the MS Xbox 360 gamepad which requires a proprietary USB wireless receiver (WiFi) and is no longer in production.

Solution: The Xbox One and One/S and the PS4/5 gamepads all use Bluetooth and are compatible with all Laptops and SBCs like the Rpi and Nano. Provide an alternate Arlobot Bluetooth interface for newer Xbox and PS gamepads.

TCIII

chrisl8 commented 2 years ago

Some breadcrumbs:

It uses the ROS joy package so any joystick that it will support should work.

The configuration is in xbox360_teleop.launch

If you can edit that file such that another joystick works, and you feel this is useful to future users, please post the new file here and then I can sort out how to "automate" the easy use for new users of that or other joysticks.

TCIII commented 2 years ago

@chrisl8,

Like webcams, the gamepads have different device names.

The Xbox 360 device name is "Xbox 360 Wireless Receiver" while the Xbox One is "Xbox Wireless Controller" so you need to provide a way in "personalDataForBehavior.json" to change the name of the device.

Tom C

chrisl8 commented 2 years ago

@TCIII

Oh cool. I have a bunch of controllers around. I should try them all out and see if there is a good way to auto detect any joystick connected to the system rather than requiring a specific call out in the configuration.

Leave this open and I'll look into that eventually.

I hadn't thought about it until now, but connecting a joystick to my other projects would be nice, and if I get this code to do it, then I could use it.

TCIII commented 2 years ago

@chrisl8,

I have moved the Xbox One gamepad non-functionality to a separate issue.

Tom C

TCIII commented 2 years ago

@chrisl8,

For those Arlobot users who want to use the Xbox One gamepad to remotely drive your robot around, here are a few observations concerning using the Xbox One gamepad:

I presently have my Xbox One paired and connected with the Ubuntu MATE (focal 20.04) OS.

I had to change "Xbox 360 Wireless Receiver" to "Xbox Wireless Controller" in 'find_xbox_controller.sh' otherwise my Xbox One is not detected.

Run either of the following to verify your Xbox is detected by the Ubuntu OS:

thomas@thomas-desktop:~$ find_xbox_controller.sh /dev/input/js0

thomas@thomas-desktop:~$ ls -l /dev/input/js* crw-rw-r--+ 1 root input 13, 0 Jan 17 16:11 /dev/input/js0

According to the ROS Joy Tutorial, the -r should be -rw and suggest running 'sudo chmod a+rw /dev/input/jsX' to correct the issue. I have not tried to do so since my Xbox One controller is working correctly.

I installed (sudo apt-get install joystick) and used jstest to verify the gamepad hex keycodes and found the following:

Xbox One:

Left joystick vertical axis: 1

Left joystick horizontal axis: 0

Left button: 6

Right button; 7

Xbox 360 Wireless Game Controller:

From the /opt/ros/noetic/share/teleop_twist_joy/config/xbox.config.yaml file:

Left thumbstick vertical: 1

Left thumbstick horizontal; 0

So both the Xbox One and Xbox 360 joystick (thumbstick) hex keycodes are in agreement.

Left trigger: 5

Right trigger: 4

So the Xbox One and Xbox 360 trigger button hex keycodes are not in agreement, but it doesn't seem to matter. The left bumper button must be depressed to allow the left joystick to function to control speed (.7) and direction. The right bumper button must be depressed for turbo speed (1.5).

Tom C

chrisl8 commented 2 years ago

@TCIII Which model Xbox One controller are you using?

I have tried two different models and as far as I can tell it is not possible to connect an Xbox One controller via Bluetooth to a Linux system.

It juts enters into a loop of connecting and disconnecting and never works, which is what many others also report: https://github.com/atar-axis/xpadneo/issues/295

TCIII commented 2 years ago

@chrisl8,

I am using both an XBox One and an XBox One/S. Both are BT and work fine with all versions of Linux.

You have to turnoff ertm to get the connection to stop doing that.

Have you had a chance to move ahead with the docking station project?

TCIII

TCIII commented 2 years ago

@chrisl8,

I have found the ROS default value for the joystick dead zone of 0.1 to cause ArloBot to abruptly jump forward if the gamepad joystick is not judiciously pushed slowly forward to start ArloBot moving in the forward direction. In other words the default 0.1 dead zone value is like a step function when applying forward joystick motion and can cause the DHB-10 motor controller to go into overcurrent when the batteries are low. The ROS dead zone value along with the maximum forward velocity can be adjusted in the /opt/ros/noetic/ directory, however changes to those two value will cause any ArloBot software updates to fail.

Regards, TCIII