-
-
Notifications
You must be signed in to change notification settings - Fork 573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Idea: Remote Pendant (Playstation 3 Dualshock Controller / SIXAXIS Controller) #103
Comments
I got it work. Its fucking bad ass. I can control my CNC with PS3 DS3 controller over bluetooth from raspberry pi... its everything i hoped it would be. Still have some minor bugs. But I have work in the morning. Node.js DS3 Controller Setup
Socket.io Client
The CodeUsage: node test.js test.js MIT License
That was a lot to get done in a day... [ ] Still need a way to detect when controller connects, then load this script.. also need to close script on connectivity loss with controller... then it should load on connect / reconnect. |
This is pretty cool. Would you like to continue your work in the examples directory or somewhere else? Just let me know if you'd like to become a collaborator. |
I would love to become a collaborator! |
Will do once have a working beta. I need some help:
Would also be nice for uses using authentication to be able to specify a username & password if authentication is enable. Current test code with static token:
|
You can try below example to generate an access token using a secret stored in var fs = require('fs');
var path = require('path');
var jwt = require('jsonwebtoken');
var io = require('socket.io-client');
// https://github.com/auth0/node-jsonwebtoken#jwtsignpayload-secretorprivatekey-options-callback
var generateAccessToken = function(payload, secret) {
var token = jwt.sign(payload, secret, {
expiresIn: '30d' // 30 days
});
return token;
};
var getUserHome = function () {
return process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'];
};
var cncrc = path.resolve(getUserHome(), '.cncrc');
var config = JSON.parse(fs.readFileSync(cncrc, 'utf8'));
var token = generateAccessToken({ id: '', user: '' }, config.secret);
var socket = io.connect('ws://localhost:8000', {
'query': 'token=' + token
});
socket.on('connect', function() {
console.log('Socket IO Connected!');
// List ports
socket.emit('list', function(data) {
console.log('LIST: ' + data);
});
// Open port
socket.emit('open', '/dev/ttyUSB0', { baudrate: Number(115200) });
});
socket.on('error', function() {
console.log('error');
}); |
Looks like your code is working well. Thanks for the help. |
BETA v0.1 [2016/12/11] NOTE: Use pm2 to run, so it can auto restart the script
Todo
cnc-pendant_ps3.js
|
Updated above script... still have a few small issues to resolve. |
PS3 CNC Control Button Map Work in Progress. |
FYI, new baby today. Going to be busy for the next week. |
@AustinSaintAubin Congratulations! 👪 |
Would you like to add your file "cnc-pendant-ps3.js" as a main entry in the package.json file? For example: "bin": {
"cnc": "./bin/cnc",
"cnc-pendant-ps3": "./bin/cnc-pendant-ps3"
}, You can add the file to bin, I will publish a new version once it's ready! |
That would be good, but I cant get past "GH006: Protected branch update failed for refs/heads/master. |
Let me check it. |
I think it might be best to branch plugins off into their own repository... but I am still thinking on that... I still need to work on a few things in regard to this script before it is ready for prime time... hope to work on it more this weekend. For now I have commited changes to the pendant-ps3 branch. |
Sure! The branch is back, you can push your changes to the pendant-ps3 branch. Thanks. |
Still working on this... I have some food for thought and need input.
What are your thoughts? |
I vote the first one. A separate repository will be convenient for source management and version control. |
I created an organization for managing multiple projects: https://github.com/cncjs. An invitation has already been sent to your mailbox. I will rename and move this project to the organization after 1.9 release, you can create a new repository for cncjs-pendant-ps3 and push your changes to the repository. 😃 |
Going to create |
This feature sounds very cool. Will it be possible to use it on a mac? |
I have designed it to run on the raspberry pi, but it should be able to run on Mac OS w/ NodeJS and all dependencies installed. I run CNCjs and my pendent on a Raspberry Pi 3. This is ideal for me because end user OS's sleep, auto update, etc. I use my MacBook to connect to the CNCjs web interface running on the Raspberry Pi. Basically everything runs on the Raspberry Pi. The end user devices (MacBook, Chromebook) are then free to do other things. Additionally, because I run the pendent software on the Raspberry Pi, the PS3 controller connects to the Raspberry Pi in my shop. Allowing my to only have to take my PS3 into my dirty areas, no need to bring my MacBook into the shops dust. |
Closing. Any new issues / discussions should be posted to cncjs/cncjs-pendant-ps3 or cncjs/cncjs-pendant-boilerplate |
Gamepad Control
Goal:Use Use Playstation 3 Controller wirelessly over bluetooth to control CNC.
Ideally I want the control to happen on the host device (raspberry pi), not just the client.
Using a wireless game controller (like a PS3 controller) seems to be one of the lowest cost & simplest solution methods.
Integrating Node.js libraries for support looks like the best option. I also looked at
Resources Options:
Playstation Controller Setup ( general guide to connect hardware )
Here is what I have figured out so far for PS3 on Raspberry PI 3 w/ integrated bluetooth.
The bellow just shows how to get PS3 controller connected.
Install
Pairing Tools
Test Controller Connectivity
Get Battery Level
cat "/sys/class/power_supply/sony_controller_battery_64:d4:bd:b3:9e:66/capacity"
Joystick Application
The text was updated successfully, but these errors were encountered: