[Video] Alternative Kinect Control (using depth images)

Firmware/software/electronics/mechanics
Bumbolt
Beginner
Posts: 16
Joined: Tue Feb 18, 2014 10:53 pm

Re: [Video] Alternative Kinect Control (using depth images)

Post by Bumbolt »

Thanks for the tip. I didn't understand the error so clearly. I did indead use jstest and it logs perfectly that's why i didnt understand. I'm using an aftermakert PS3 controller.
whoenig
Expert
Posts: 395
Joined: Mon Oct 27, 2014 2:55 am

Re: [Video] Alternative Kinect Control (using depth images)

Post by whoenig »

How many buttons does your joystick have according to jstest? For example I get the following

Code: Select all

Axes:  0: -3565  1:  2142  2:-32767  3:  2181  4: -1004  5:-32767  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off  9:off 10:off 
Hence, I have only 11 buttons and I would need to change the index in joy_driver_pid.py to a lower number.
Bumbolt
Beginner
Posts: 16
Joined: Tue Feb 18, 2014 10:53 pm

Re: [Video] Alternative Kinect Control (using depth images)

Post by Bumbolt »

Code: Select all

Driver version is 2.1.0.
Joystick (ShanWan PS3/PC WirelessGamePad) has 6 axes (X, Y, Z, Rz, Hat0X, Hat0Y)
and 12 buttons (Trigger, ThumbBtn, ThumbBtn2, TopBtn, TopBtn2, PinkieBtn, BaseBtn, BaseBtn2, BaseBtn3, BaseBtn4, BaseBtn5, BaseBtn6).
Testing ... (interrupt to exit)
Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off  9:off 10:off 11:of
Seems like I have 12 :) The only reason I got this is because they kept telling me "the original one will be in, in one week"... for 3 weeks.


Why are the buttons (L1,L2,.., Circle,...) also mapped to an axes? This makes no sense. Also with jstest i looks like i only 2 axes are used (+ and -) I don't really get how to map the index to that.
I was already able to fix some of the buttons but it needs some debugging.

My map is like following:

Buttons:
0: Triangle / Right joystick up
1: Circle / Right joystick right
2: Cross / Right joystick down
3: Square / Right joystick left
4: L1
5: R1
6: L2
7: R2
8: Select
9: Start

Axes:
0: Left joystick left (+)
0: Left joystick right (-)
1: Left joystick down (+)
1: Left joystick up (-)
whoenig
Expert
Posts: 395
Joined: Mon Oct 27, 2014 2:55 am

Re: [Video] Alternative Kinect Control (using depth images)

Post by whoenig »

There is this one comment in the code, which makes me believe that the PS3 driver somehow maps buttons to (virtual) axes as well:

Code: Select all

# Strange bug: left button as axis doesnt work. So use button instead
I never used the PS3 controller myself and work with an XBox controller instead. Those have default behavior from a driver perspective (i.e. buttons are buttons and axis are axis:-)

I believe there is a set of different drivers on Linux for the PS3 controller, also depending on how you connect it (USB/Wireless?). It might help to try another driver to see if you get more axis working.
Bumbolt
Beginner
Posts: 16
Joined: Tue Feb 18, 2014 10:53 pm

Re: [Video] Alternative Kinect Control (using depth images)

Post by Bumbolt »

I use a wireless controller that connects through a usb dongle. It works just fine with the default client though (the original bitcraze)

I will experiment tomorrow or go on a quest for an original controller monday.
omwdunkley
Expert
Posts: 162
Joined: Thu Jun 06, 2013 9:56 pm
Location: Munich

Re: [Video] Alternative Kinect Control (using depth images)

Post by omwdunkley »

Hey guuys,
sorry I have been super busy with my internship here in silicon valley. Ill be returning to Munich this month and will only have a single job then :) I should have time to help with whatever problems are occurring...
I hacked most of this together while writing my thesis so it is not really implemented for the general case. Thats why the PS3 controller stuff has sort of been hard coded. But It shouldnt be too challenging to figure out which button/axes of your controller are assigned to which index and rewrite the mapping in `joy_driver_pid.py`.

Its been a while since ive looked at the code, but I think`joy_driver_pid.py` replaced `joy_driver.py`. It has the same functionality + the control stuff.

I guess you could also write your own node that listens to your own joystick data, interpret it as you wish, and send the commands as a `CFJoyMSG` type over the `/cfjoy` topic.

Cheers!

PS: Didnt really announce it but here is my thesis stuff:
hdmathias
Member
Posts: 47
Joined: Sat Nov 01, 2014 3:24 pm
Location: Florida, USA

Re: [Video] Alternative Kinect Control (using depth images)

Post by hdmathias »

I'm just getting going with this project. I've installed most of the software and now a student and I will begin trying to get it to work before we try to add to it. I'm sure I'll have several questions along the way. My first is this: will the custom firmware work with a CF 2.0?

Thanks Oliver for blazing the trail on this. We're looking forward to working on it.

David
omwdunkley
Expert
Posts: 162
Joined: Thu Jun 06, 2013 9:56 pm
Location: Munich

Re: [Video] Alternative Kinect Control (using depth images)

Post by omwdunkley »

hdmathias wrote:I'm just getting going with this project. I've installed most of the software and now a student and I will begin trying to get it to work before we try to add to it. I'm sure I'll have several questions along the way. My first is this: will the custom firmware work with a CF 2.0?

Thanks Oliver for blazing the trail on this. We're looking forward to working on it.

David
Hey David,
good question! Not sure. The super early builds worked fine as there were not too many changes I made originally, but I have not had time to fly at all and there have been many changes since.

The custom client probably works with the default firmware, minus some features that should just stop working - nothing critical. Cant promise anything though...

Good luck!!
hdmathias
Member
Posts: 47
Joined: Sat Nov 01, 2014 3:24 pm
Location: Florida, USA

Re: [Video] Alternative Kinect Control (using depth images)

Post by hdmathias »

Thanks Oliver. A student and I are getting started tomorrow. We're both completely new to ROS so I don't expect it to go smoothly. :D But certainly much easier thanks to your work and that of some of the others in this thread.
hdmathias
Member
Posts: 47
Joined: Sat Nov 01, 2014 3:24 pm
Location: Florida, USA

Re: [Video] Alternative Kinect Control (using depth images)

Post by hdmathias »

We're having a problem that isn't directly related to this project but I'm asking in this thread because it has to do with setup of the environment. I thought I had everything setup as needed to run but I can't recognize a Crazyflie. I've installed Oliver's ros stuff in Ubuntu 12.04 (in a VM). When I couldn't get his ros node to recognize a Crazyflie, I tried simply running one of the python code examples. It seems to find the Crazyradio but never detects a Crazyflie.

The problem isn't hardware -- I can recognize the same Crazyflies using the same radio in the Bitcraze VM. Both VMs (Bitcraze and the one mentioned above are in VirtualBox so I don't think the VM is the problem).

I've updated the cflib to to the latest Master version but the result is the same. I added a few print statement to crazyradio.py. Here's what I see when I run it:
david@osboxes:~/ros/stacks/crazyflie-clients-python/examples$ python2 ramp.pyScanning interfaces for Crazyflies...
In find_devices. pyusb1 = True
Crazyradio found:
DEVICE ID 1915:7777 on Bus 002 Address 011 =================
bLength : 0x12 (18 bytes)
bDescriptorType : 0x1 Device
bcdUSB : 0x200 USB 2.0
bDeviceClass : 0x0 Specified at interface
bDeviceSubClass : 0x0
bDeviceProtocol : 0x0
bMaxPacketSize0 : 0x40 (64 bytes)
idVendor : 0x1915
idProduct : 0x7777
bcdDevice : 0x52 Device 0.52
iManufacturer : 0x1 Error Accessing String
iProduct : 0x2 Error Accessing String
iSerialNumber : 0x1d Error Accessing String
bNumConfigurations : 0x1
CONFIGURATION 1: 100 mA ==================================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x2 Configuration
wTotalLength : 0x20 (32 bytes)
bNumInterfaces : 0x1
bConfigurationValue : 0x1
iConfiguration : 0x0
bmAttributes : 0x80 Bus Powered
bMaxPower : 0x32 (100 mA)
INTERFACE 0: Vendor Specific ===========================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x4 Interface
bInterfaceNumber : 0x0
bAlternateSetting : 0x0
bNumEndpoints : 0x2
bInterfaceClass : 0xff Vendor Specific
bInterfaceSubClass : 0xff
bInterfaceProtocol : 0x0
iInterface : 0x0
ENDPOINT 0x81: Bulk IN ===============================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x81 IN
bmAttributes : 0x2 Bulk
wMaxPacketSize : 0x40 (64 bytes)
bInterval : 0x6
ENDPOINT 0x1: Bulk OUT ===============================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x1 OUT
bmAttributes : 0x2 Bulk
wMaxPacketSize : 0x40 (64 bytes)
bInterval : 0x6
In if block
Crazyflies found:
No Crazyflies found, cannot run example

"In if block" prints in the "if pyusb1" block before the call to self.dev.set_configuration(1) call. I have a print statement after that call but never see the output.

I've run CF python code in Windows and in the Bitcraze VM but never before in another Linux environment. Any ideas about what might be wrong with my installation? Thank you.

David
Post Reply