Skip to content

Commit

Permalink
Fix the gamepad code (#67)
Browse files Browse the repository at this point in the history
* first check in

* added initial gamepad api support

* fixed bugs

* session bug fix and training improvements, during race

* training fix

* train fix

* changing editor

* updated joystick code

* fixed merge problem

* fixed merge

* removed additional files

* removed extra line

* removed last linefeed
  • Loading branch information
alanswx authored and wroscoe committed Mar 11, 2017
1 parent 940fd49 commit 3edfe84
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions donkey/templates/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,16 @@ var driveHandler = (function() {
{
var joystickX = applyDeadzone(pad.axes[2], 0.05);
//console.log(joystickX);
angle = joystickX * 90;
state.tele.user.angle= joystickX ;
//console.log('angle:'+angle);
var joystickY = applyDeadzone(pad.axes[1], 0.15);
//console.log(joystickY);
throttle= joystickY * -100 ;
state.tele.user.throttle= joystickY * -1 ;
//console.log('throttle:'+throttle);
if (throttle> 10 || throttle<-10)
recording = true
if (state.tele.user.throttle> 10 || state.tele.user.throttle<-10)
state.recording = true
else
recording = false
state.recording = false

postDrive()
}
Expand Down Expand Up @@ -269,4 +269,4 @@ var driveHandler = (function() {

function toRadians (angle) {
return angle * (Math.PI / 180);
}
}

0 comments on commit 3edfe84

Please sign in to comment.