How to use the default joystick?


#1

I can get the magni to move with a usb keyboard. but it’s really not convenient.

the documentation claims a logitech joypad works out of the box. But i dont have it. Besides, it’s another joypad that is delivered with the magni (see picture below).
there was no usb dongle delivered with the joypad and the manual in chinese does not help much.

I tried using the first bluetooth dongle i found. I did successfully pair with it. I can see that /dev/input/js0 is indeed there where i’m paired with it. I can see that the /teleop_twist_joy node is running. but the motors do not move at all regardless of what i do on the joypad/joystick.

maybe I should change the params in logitech.yaml (or maybe create another yaml file and another launch file using it)

how can i get that joypad to move the magni ?

thanks


#2
ubuntu@ubiquityrobot:~$ bluetoothctl
[NEW] Controller 00:1A:7D:DA:71:13 ubiquityrobot #1 [default]
[NEW] Controller AA:AA:AA:AA:AA:AA ubiquityrobot
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# agent on
Agent registered
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:1A:7D:DA:71:13 Discovering: yes
[NEW] Device FF:FF:95:01:43:E7 Magicsee R1
[bluetooth]# pair FF:FF:95:01:43:E7
Attempting to pair with FF:FF:95:01:43:E7
[CHG] Device FF:FF:95:01:43:E7 Connected: yes
[CHG] Device FF:FF:95:01:43:E7 UUIDs: 00001800-0000-1000-8000-00805f9b34fb
[CHG] Device FF:FF:95:01:43:E7 UUIDs: 00001801-0000-1000-8000-00805f9b34fb
[CHG] Device FF:FF:95:01:43:E7 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb
[CHG] Device FF:FF:95:01:43:E7 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb
[CHG] Device FF:FF:95:01:43:E7 UUIDs: 00001812-0000-1000-8000-00805f9b34fb
[CHG] Device FF:FF:95:01:43:E7 Paired: yes
Pairing successful
[CHG] Device FF:FF:95:01:43:E7 Modalias: usb:v248Ap8266d3634
[Magicsee R1       ]# trust FF:FF:95:01:43:E7
[CHG] Device FF:FF:95:01:43:E7 Trusted: yes
Changing FF:FF:95:01:43:E7 trust succeeded
[Magicsee R1       ]#


ubuntu@ubiquityrobot:~$ lsusb
Bus 001 Device 006: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 004: ID 413c:2107 Dell Computer Corp.
Bus 001 Device 005: ID 046d:c077 Logitech, Inc. M105 Optical Mouse
Bus 001 Device 007: ID 0424:7800 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
ubuntu@ubiquityrobot:~$



root@ubiquityrobot:~# rostopic list
/battery_state
/cmd_vel
/diagnostics
/joint_states
/joy
/left_error
/motor_node/parameter_descriptions
/motor_node/parameter_updates
/odom
/right_error
/rosout
/rosout_agg
/statistics
/tf
/tf2_web_republisher/cancel
/tf2_web_republisher/feedback
/tf2_web_republisher/goal
/tf2_web_republisher/result
/tf2_web_republisher/status
/tf_static
/ubiquity_velocity_controller/parameter_descriptions
/ubiquity_velocity_controller/parameter_updates
root@ubiquityrobot:~# rosnode list
/controller_spawner
/joint_state_publisher
/joy_node
/motor_node
/robot_state_publisher
/rosbridge_ws/rosapi
/rosbridge_ws/rosbridge_websocket
/rosbridge_wss/rosapi
/rosbridge_wss/rosbridge_websocket
/rosout
/teleop_twist_joy
/tf2_web_republisher
root@ubiquityrobot:~#


ubuntu@ubiquityrobot:~$ ll /dev/input/
total 0
drwxr-xr-x  4 root root     260 Aug  9 15:55 ./
drwxr-xr-x 14 root root    3600 Aug  9 15:55 ../
drwxr-xr-x  2 root root     100 Feb 11  2016 by-id/
drwxr-xr-x  2 root root     140 Feb 11  2016 by-path/
crw-rw----  1 root input 13, 64 Feb 11  2016 event0
crw-rw----  1 root input 13, 65 Feb 11  2016 event1
crw-rw----  1 root input 13, 66 Feb 11  2016 event2
crw-rw----  1 root input 13, 67 Feb 11  2016 event3
crw-rw----  1 root input 13, 68 Aug  9 15:55 event4
crw-rw----  1 root input 13,  0 Aug  9 15:55 js0
crw-rw----  1 root input 13, 63 Feb 11  2016 mice
crw-rw----  1 root input 13, 32 Feb 11  2016 mouse0
crw-rw----  1 root input 13, 33 Aug  9 15:55 mouse1
ubuntu@ubiquityrobot:~$

[edit]
looks like the joypad manufacturer page is
http://www.magicsees.com/prod_view.aspx?TypeId=10&Id=175&FId=t3:10:3
However, there isn’t anything usefull there.

using jstest, i can indeed see some events : namely the two button on the front (OK and BACK i guess). but i see no event listed for the 4 others buttons and nothing for the joypad axes either…

ubuntu@ubiquityrobot:~$ jstest --event /dev/input/js0
Driver version is 2.1.0.
Joystick (Magicsee R1       ) has 2 axes (X, Y)
and 15 buttons (BtnX, BtnY, BtnZ, BtnTL, BtnTR, BtnTL2, BtnTR2, BtnSelect, BtnStart, BtnMode, BtnThumbL, BtnThumbR, LeftBtn, RightBtn, MiddleBtn).
Testing ... (interrupt to exit)
Event: type 129, time 1345750, number 0, value 0
Event: type 129, time 1345750, number 1, value 0
Event: type 129, time 1345750, number 2, value 0
Event: type 129, time 1345750, number 3, value 0
Event: type 129, time 1345750, number 4, value 0
Event: type 129, time 1345750, number 5, value 0
Event: type 129, time 1345750, number 6, value 0
Event: type 129, time 1345750, number 7, value 0
Event: type 129, time 1345750, number 8, value 0
Event: type 129, time 1345750, number 9, value 0
Event: type 129, time 1345750, number 10, value 0
Event: type 129, time 1345750, number 11, value 0
Event: type 129, time 1345750, number 12, value 0
Event: type 129, time 1345750, number 13, value 0
Event: type 129, time 1345750, number 14, value 0
Event: type 130, time 1345750, number 0, value 0
Event: type 130, time 1345750, number 1, value 0
Event: type 1, time 1353210, number 1, value 1
Event: type 1, time 1353330, number 1, value 0
Event: type 1, time 1353490, number 1, value 1
Event: type 1, time 1353690, number 1, value 0
Event: type 1, time 1353810, number 1, value 1
Event: type 1, time 1353930, number 1, value 0
Event: type 1, time 1353970, number 1, value 1
Event: type 1, time 1354050, number 1, value 0
Event: type 1, time 1354090, number 0, value 1
Event: type 1, time 1354210, number 0, value 0
Event: type 1, time 1354290, number 0, value 1
Event: type 1, time 1354330, number 0, value 0
Event: type 1, time 1354410, number 0, value 1
Event: type 1, time 1354490, number 0, value 0
Event: type 1, time 1354570, number 0, value 1
Event: type 1, time 1354650, number 0, value 0
Event: type 1, time 1354690, number 0, value 1
Event: type 1, time 1354850, number 0, value 0
Event: type 1, time 1361610, number 0, value 1
Event: type 1, time 1361730, number 0, value 0
Event: type 1, time 1361730, number 1, value 1
Event: type 1, time 1361970, number 1, value 0
Event: type 1, time 1362010, number 0, value 1
Event: type 1, time 1362050, number 0, value 0
Event: type 1, time 1362050, number 1, value 1
Event: type 1, time 1362250, number 0, value 1
Event: type 1, time 1362250, number 1, value 0
Event: type 1, time 1362290, number 0, value 0
Event: type 1, time 1362290, number 1, value 1
Event: type 1, time 1362490, number 1, value 0
Event: type 1, time 1362530, number 0, value 1
Event: type 1, time 1362610, number 0, value 0
Event: type 1, time 1362610, number 1, value 1
Event: type 1, time 1362690, number 0, value 1
Event: type 1, time 1362690, number 1, value 0
Event: type 1, time 1362770, number 0, value 0
Event: type 1, time 1362810, number 0, value 1
Event: type 1, time 1362890, number 0, value 0
Event: type 1, time 1363130, number 0, value 1
Event: type 1, time 1363210, number 0, value 0
Event: type 1, time 1363290, number 0, value 1
Event: type 1, time 1363370, number 0, value 0
Event: type 1, time 1363450, number 0, value 1
Event: type 1, time 1363770, number 0, value 0
Event: type 1, time 1363850, number 1, value 1
Event: type 1, time 1363930, number 1, value 0
Event: type 1, time 1364010, number 1, value 1
Event: type 1, time 1364130, number 1, value 0
Event: type 1, time 1364170, number 1, value 1
Event: type 1, time 1364290, number 1, value 0
Event: type 1, time 1364370, number 1, value 1
Event: type 1, time 1364490, number 1, value 0
Event: type 1, time 1364570, number 1, value 1
Event: type 1, time 1364730, number 0, value 1
Event: type 1, time 1364730, number 1, value 0
Event: type 1, time 1364770, number 0, value 0
Event: type 1, time 1364770, number 1, value 1
Event: type 1, time 1365090, number 1, value 0
Event: type 1, time 1366050, number 1, value 1
Event: type 1, time 1366210, number 1, value 0
Event: type 1, time 1366250, number 1, value 1
Event: type 1, time 1366410, number 1, value 0
Event: type 1, time 1366490, number 0, value 1
Event: type 1, time 1366810, number 0, value 0
Event: type 1, time 1366850, number 1, value 1
Event: type 1, time 1366970, number 0, value 1
Event: type 1, time 1366970, number 1, value 0
Event: type 1, time 1367050, number 0, value 0
Event: type 1, time 1367050, number 1, value 1
Event: type 1, time 1367170, number 0, value 1
Event: type 1, time 1367170, number 1, value 0
Event: type 1, time 1367250, number 0, value 0
^C

#3

eentually google pointed me to https://github.com/UbiquityRobotics/bt_joystick
:frowning:

anyway, I git cloned it in
/opt/ros/kinetic/share

then tried to install dependancies.
sudo apt install libbluetooth-dev # does work
pip install gattlib # fail. see bellow

i’m stuck with pip install issues. i hope i did not break my system. pip install is scary.

from my view the default image should work with the default joypad :frowning:

root@ubiquityrobot:/opt/ros/kinetic/share# git clone https://github.com/UbiquityRobotics/bt_joystick.git
Cloning into 'bt_joystick'...
remote: Counting objects: 25, done.
remote: Total 25 (delta 0), reused 0 (delta 0), pack-reused 25
Unpacking objects: 100% (25/25), done.
Checking connectivity... done.
root@ubiquityrobot:/opt/ros/kinetic/share# roslaunch bt_joystick/
.git/   launch/ nodes/  param/
root@ubiquityrobot:/opt/ros/kinetic/share# roslaunch bt_joystick bt_joystick_node.launch
... logging to /root/.ros/log/aac414fa-9bec-11e8-bfe6-9bceaaae476e/roslaunch-ubiquityrobot-4096.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ubiquityrobot.local:35679/

SUMMARY
========

PARAMETERS
 * /bt_joystick/angular_rotate_rate: 0.4
 * /bt_joystick/angular_straight_rate: 0.0
 * /bt_joystick/angular_turning_rate: 0.3
 * /bt_joystick/bt_mac_address: FF:FF:80:06:6C:59
 * /bt_joystick/speed_fwd_normal: 0.1
 * /bt_joystick/speed_fwd_turning: 0.1
 * /bt_joystick/speed_rev_normal: -0.1
 * /bt_joystick/speed_stopped: 0.0
 * /bt_joystick/speed_turbo_multiplier: 1.75
 * /rosdistro: kinetic
 * /rosversion: 1.12.13

NODES
  /
    bt_joystick (bt_joystick/bt_joystick.py)

ROS_MASTER_URI=http://ubiquityrobot.local:11311

process[bt_joystick-1]: started with pid [4113]
Traceback (most recent call last):
  File "/opt/ros/kinetic/share/bt_joystick/nodes/bt_joystick.py", line 53, in <module>
    from gattlib   import GATTRequester
ImportError: No module named gattlib
[bt_joystick-1] process has died [pid 4113, exit code 1, cmd /opt/ros/kinetic/share/bt_joystick/nodes/bt_joystick.py __name:=bt_joystick __log:=/root/.ros/log/aac414fa-9bec-11e8-bfe6-9bceaaae476e/bt_joystick-1.log].
log file: /root/.ros/log/aac414fa-9bec-11e8-bfe6-9bceaaae476e/bt_joystick-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done
root@ubiquityrobot:/opt/ros/kinetic/share# apt install libbluetooth-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  libbluetooth-dev
0 upgraded, 1 newly installed, 0 to remove and 151 not upgraded.
Need to get 163 kB of archives.
After this operation, 477 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/ubuntu-pi-flavour-makers/ppa/ubuntu xenial/main armhf libbluetooth-dev armhf 5.41-0ubuntu3~xenial1.1 [163 kB]
Fetched 163 kB in 0s (514 kB/s)
Selecting previously unselected package libbluetooth-dev.
(Reading database ... 178136 files and directories currently installed.)
Preparing to unpack .../libbluetooth-dev_5.41-0ubuntu3~xenial1.1_armhf.deb ...
Unpacking libbluetooth-dev (5.41-0ubuntu3~xenial1.1) ...
Setting up libbluetooth-dev (5.41-0ubuntu3~xenial1.1) ...
root@ubiquityrobot:/opt/ros/kinetic/share# pip install gattlib
Collecting gattlib
  Downloading https://files.pythonhosted.org/packages/be/2f/5b1aecec551b42b59d8b399ad444b5672972efb590ca83d784dbe616a3e1/gattlib-0.20150805.tar.gz (1.7MB)
    100% |████████████████████████████████| 1.7MB 141kB/s
    Complete output from command python setup.py egg_info:
    Package glib-2.0 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `glib-2.0.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'glib-2.0' found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-HFbELX/gattlib/setup.py", line 12, in <module>
        "pkg-config --cflags glib-2.0".split()).decode('utf-8')
      File "/usr/lib/python2.7/subprocess.py", line 574, in check_output
        raise CalledProcessError(retcode, cmd, output=output)
    subprocess.CalledProcessError: Command '['pkg-config', '--cflags', 'glib-2.0']' returned non-zero exit status 1

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-HFbELX/gattlib/
You are using pip version 8.1.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
root@ubiquityrobot:/opt/ros/kinetic/share# pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 170kB/s
Installing collected packages: pip
  Found existing installation: pip 8.1.1
    Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed pip-18.0
root@ubiquityrobot:/opt/ros/kinetic/share# pip install gattlib
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main
root@ubiquityrobot:/opt/ros/kinetic/share# roslaunch bt_joystick bt_joystick_node.launch
... logging to /root/.ros/log/aac414fa-9bec-11e8-bfe6-9bceaaae476e/roslaunch-ubiquityrobot-4214.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ubiquityrobot.local:34009/

SUMMARY
========

PARAMETERS
 * /bt_joystick/angular_rotate_rate: 0.4
 * /bt_joystick/angular_straight_rate: 0.0
 * /bt_joystick/angular_turning_rate: 0.3
 * /bt_joystick/bt_mac_address: FF:FF:80:06:6C:59
 * /bt_joystick/speed_fwd_normal: 0.1
 * /bt_joystick/speed_fwd_turning: 0.1
 * /bt_joystick/speed_rev_normal: -0.1
 * /bt_joystick/speed_stopped: 0.0
 * /bt_joystick/speed_turbo_multiplier: 1.75
 * /rosdistro: kinetic
 * /rosversion: 1.12.13

NODES
  /
    bt_joystick (bt_joystick/bt_joystick.py)

ROS_MASTER_URI=http://ubiquityrobot.local:11311

process[bt_joystick-1]: started with pid [4231]
Traceback (most recent call last):
  File "/opt/ros/kinetic/share/bt_joystick/nodes/bt_joystick.py", line 53, in <module>
    from gattlib   import GATTRequester
ImportError: No module named gattlib
[bt_joystick-1] process has died [pid 4231, exit code 1, cmd /opt/ros/kinetic/share/bt_joystick/nodes/bt_joystick.py __name:=bt_joystick __log:=/root/.ros/log/aac414fa-9bec-11e8-bfe6-9bceaaae476e/bt_joystick-1.log].
log file: /root/.ros/log/aac414fa-9bec-11e8-bfe6-9bceaaae476e/bt_joystick-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done
root@ubiquityrobot:/opt/ros/kinetic/share# python -m pip install --upgrade pip setuptools wheel
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
  warnings.warn(warning, RequestsDependencyWarning)
Requirement already up-to-date: pip in /usr/local/lib/python2.7/dist-packages (18.0)
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/ff/f4/385715ccc461885f3cedf57a41ae3c12b5fec3f35cce4c8706b1a112a133/setuptools-40.0.0-py2.py3-none-any.whl (567kB)
    100% |████████████████████████████████| 573kB 1.2MB/s
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/81/30/e935244ca6165187ae8be876b6316ae201b71485538ffac1d718843025a9/wheel-0.31.1-py2.py3-none-any.whl (41kB)
    100% |████████████████████████████████| 51kB 2.9MB/s
launchpadlib 1.10.3 requires testresources, which is not installed.
Installing collected packages: setuptools, wheel
  Found existing installation: setuptools 20.7.0
    Uninstalling setuptools-20.7.0:
      Successfully uninstalled setuptools-20.7.0
  Found existing installation: wheel 0.29.0
    Uninstalling wheel-0.29.0:
      Successfully uninstalled wheel-0.29.0
Successfully installed setuptools-40.0.0 wheel-0.31.1
root@ubiquityrobot:/opt/ros/kinetic/share# pip install gattlib
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main
root@ubiquityrobot:/opt/ros/kinetic/share# pip install ez_setup
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main
root@ubiquityrobot:/opt/ros/kinetic/share# pip install testresources
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main
root@ubiquityrobot:/opt/ros/kinetic/share# pip install ez_setup
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main
root@ubiquityrobot:/opt/ros/kinetic/share# pip install --upgrade setuptools
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main
root@ubiquityrobot:/opt/ros/kinetic/share# pip --version
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main
root@ubiquityrobot:/opt/ros/kinetic/share#

#4

I was wondering about this device too! Is there a ros module for it?


#5

Oh, by the way I use this Logitech gamepad and it works great.
(but I’d like to get the bluetooth joystick working too!)

Logitech Wireless Gamepad F710 - $37 on Amazon.


#6

Hi,

It seems I can’t enable bluetooth:

ubuntu@ubiquityrobot:~$ sudo systemctl start bluetooth
ubuntu@ubiquityrobot:~$ sudo systemctl status bluetooth
● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: inactive (dead)
Condition: start condition failed at Fri 2018-08-10 07:41:06 UTC; 1s ago
           ConditionPathIsDirectory=/sys/class/bluetooth was not met
     Docs: man:bluetoothd(8)

Aug 10 07:39:29 ubiquityrobot systemd[1]: Stopped Bluetooth service.

Then bluetoothctl stays stuck at Waiting to connect to bluetoothd...

Any idea ?


#7

Hi,

The joystick in the box still has some software weirdness to work out, we will be supporting it soon.

This is the ROS package for the joystick. https://github.com/UbiquityRobotics/bt_joystick

As for bluetooth, there is a firmware file missing, see this for instructions. https://github.com/UbiquityRobotics/ubiquity_main/issues/126

Rohan


#8

Yes this is a bluetooth joystick, its worth noting however that as the Raspberry Pi 3 and 3B+ have bluetooth built in there is no need for an additional Dongle. Conveniently this also makes it legal for us to send it to you: The Raspberry Pi 3B+ is a bluetooth enabled and certified module and the rules allow us to have one and only one module on the product without re-certifying the whole thing as an “intentional emitter”.

Certifications aside the software drivers have been a little tricky, they are available right now for download as the other post mentioned. They will make it on to the standard distribution and with an apt-get repo for easier install in a few days.


#9

Indeed, I forget the pi3 was bluetooth enabled anyway.

We got different issues here:

  1. getting the default raspberry pi 3 B+ bluetooth module to work. (which is not my initial request and it does require to download an extra firmware => https://github.com/UbiquityRobotics/ubiquity_main/issues/126). fyi, I did download it but while starting the bluetooth service, it fails to load. I’m guessing there are additionnal steps than just downloading like ppedro74 suggested)
  2. once paired with the joypad, getting it to move the magni
  3. getting all this to work with default pi image on a rpi3b+

i understand #3 this will be done in next image release. Unless this image is due for release this week, i’d love to solve #2 in the mean time


#10

@rohbotics once the fw is downloaded and located where expected => how do you activate it?


#11

@rohbotics how do you activate the bluetooth then ?
alternatively, when do you plan to release the pi image containing that option enabled?


#12

Hi! I have successfully downloaded but how do I “enable” it? Are there any steps I need to take?


#13

@rohbotics Hi! Is there any image preloaded with this feature?


#14

We are still working on this, but is lower priority.

The next image will likely not have this feature either unfortunately. :frowning:

Rohan


#15

I’ve noticed that gattlib is an issue for most people, as it will not install.

  1. Install Mercurial sudo apt-get install mercurial
  2. Then, clone gattlib’s source: hg clone https://bitbucket.org/OscarAcena/pygattlib cd pygattlib cat DEPENDS
  3. Then install glib-2.0: sudo apt-get install libglib2.0-dev
  4. Then install boost: sudo apt-get install libboost-all-dev
  5. At this point will still fail because it’s looking for libboost_python-py34 , and a newer version is installed libboost_python-py35 , so you need to run: sudo ln -s /dir/to/libboost/libboost_python-py35.so /dir/to/libboost/libboost_python-py34.so In my device the /dir/to/libboost is /usr/lib/arm-linux-gnueabihf
  6. Now you can install gattlib sudo python setup.py install

#16

Thanks for looking into this @Letune

Let me look into getting that deb into our repositories.


#17

We (I) am finally starting to take the bt joystick node up a few knotches. So the timing is good for inputs.

My ‘title’ is hardware engineer so I have a LOT of things going on at any time and this node had to take a backburner for a few months but I hope to squeeze some more functionality in right now and in fact have some running now.

ADDING /joy MODE: At this time (on my bench, not pushed to github) I have set the node up using ROS params to be able to send to ROS topic /joy the joystick part of the activity. That will be the default once code is pushed. Here at Ubiquity Robotics our goal for this nice little joystick is to have an alternative to the larger hand held joystick with dongle so our customers can drive our robot easily. You will have the ability to have this ROS node do just like it does today and supply output to a /cmd_vel type of topic of your topic name in the form of traditional ‘twist’ commands.

LACK OF ‘ANALOG’ JOYSTICK: As it has been from the start this node so far I have not been able to get ‘analog’ joystick info even though the electronics uses potentiometers I feel like it must be in there but maybe not exposed in the GATT interface. So I will look at and encourage anybody to find any GATT docs that explain how to squeeze out ‘analog’ info for the joystick from this ring controller. We want that badly but I gave up on trying for now. So specifically I seek GATT service and characteristic settings to readback analog like joystick settings from 0-255 or even wider range.

BUTTON SUPPORT: As far as button support we have right now the ability (due to lack of analog joystick) the ability to increase with button A or decrease with button C the speed for driving the robot. So if you want some other buttons I suggest you use B or D. My thoughts are that I will make all the buttons on this joystick (A,B,C,D, ‘o’ and return all be bits that I map to traditional ‘buttons’ 0-5 for the ROS /joy topic. So you would get the joystick and all buttons on /joy which is a standard for ROS (as standards go).

This part of this reply goes to the person trying to control servos. Also for the Servo person, note that there is no Analog yet in this code so IF you know how to get it, please tell me.

I am in no way ‘lazy’ it is just that my #1 priority is the next generation hardware board getting very close to being done so that is taking most of my available time. I am in no way too proud to accept research results from the field on use of this joystick to get over BLE Gatt server interface joystick analog (0-255 or whatever) inputs.

Thanks,
Mark


#18

Now I will address specific questions brought up as I wanted to explain our ‘plan’ first in prior post.

THIS THREAD SHOULD REALLY be titled: ‘How to use the shipped ring bluetooth LE joystick’

The LogiTech Gamepad is setup and we use it for all our current demos. It requires a dongle to match the joystick. The node for that joystick publishes to /joy ROS topic.

The little ring-controller that ships with Magni does not have a node fully integrated into our software stack. Also on the Raspberry Pi 3B+ there turned out to be an issue with bluetooth so the node would not work (yet) on the 3B+ and current Ubiquity kernel. This will be worked out and an image that has a kernel that does support bluetooth for the Raspberry Pi 3B+ is for SURE in our high want set of next deliverables.

There is a node for the cute ring bluetooth LE controller but it is not started with our software stack yet because we need to make the node publish to ROS topic /joy and work to do that is underway literally now (see prior post). The idea is we have the node for the little ring joystick near the time the next Ubiquity Robotics image is made available where Bluetooth LE is enabled. ALL of our official first run Magni products (and thus the actual 1st product) have the Raspberry Pi 3B+

use of gatlib: I can assure you there was GREAT PAIN in finding a Bluetooth GATT library that was not buggy as heck. This one was well above the others in ability and use of notifications and so on. I went through 3 and fully configured each finally to hit on this one that is closest to working to a sort of acceptable level. When you are on the ‘bleeding edge’ well … there is hemoglobin lost. A report from the field reports one issue I had seen in early development about a double free so that I am trying to recreate but no luck just yet. If it is the driver itself I may not be able to address that issue.


#19

Today I pushed a version of bt_joystick.py that by default publishes to the ROS /joy topic. As mentioned a few days back our goal is to have use of either the LogiTech joystick or this little ring BLE joystick. To do this whatever is in use should look like a Joystick. The readme as well as the source both discuss this in more detail. The node is designed to still be able to run using twist messages but they are off by default.

Earlier someone discussed trouble with getting gattlib to work. For what it is worth, we use bluez below gattlib and here are my notes I took when setting things up on top of Ubuntu Linux 16.04. Also I mentioned I tried at least 2 other ‘flavors’ of libs for gatt with poor to flakey results before hitting this one so the area of gatt can be a ‘mine field’ of issues and grief.

sudo apt-get install -y bluetooth bluez bluez-tools bluez-firmware blueman; sudo apt-get install libbluetooth-dev
sudo apt-get install pkg-config libboost-python-dev libboost-thread-dev libbluetooth-dev libglib2.0-dev python-dev
sudo apt-get -y install python-pip; pip install --upgrade setuptools; sudo pip install gattlib

We have a kernel that supports bluetooth on the earlier Raspberry Pi 3 but we are having some trouble with running bluetooth on the latest Raspberry Pi 3B+ which is an open issue still.

Mark


#20

Just now I have pushed a fix to try to solve the double free crash in bt_joystick.py
This fault was normally seen when no joystick was active and you ran the node or when the bluetooth disconnected for any reason at all and then tried to reconnect but the ring controller was too far away or not active yet. I have also posted the way this was fixed back to the gattlib forum so others may be helped as well.

So if you want to try this fix which may help you use the bluetooth joystick please help me regression test this fix by pulling the new code to your system.

I am testing several cases and I am SURE there are more cases:

  1. Bluetooth ring controller is on and the ‘mode’ and ‘B’ key hit then it blinks blue and I start the node. This is the simple and least error prone case.
  2. Do not even have the ring controller turned on at all and start the node. Wait as long as you like and at some later point turn on the ring controller and press ‘mode’ and ‘B’ (always required) and we connect.
    This case was guarenteed to crash the node after 40 seconds before.
  3. Start with case 1 above but then place the controller 50 or 80 feet away and let it be not seen then we loose connection. Then after some number of minutes come back and see if you connect. This case was guarenteed to crash the node after 40 seconds before.
  4. Start with case 1 then let the joystick time out and stop. Let it sit like that for some number of minutes then turn it back on and use ‘mode’ with ‘B’ and see if it reconnects. This case was guarenteed to crash the node after 40 seconds before.

Yes, the error cases are MANY but it is at any rate looking much better for many of the obvious cases.

I hope it now works well for you.

Mark