A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/nasa-jpl/osr-rover-code/commit/4bbb29a21cea7f7cf28d9235b8d22b1250dbcbed below:

Merge pull request #17 from daniel-s-ingram/daniel-s-ingram/issue-5-p… · nasa-jpl/osr-rover-code@4bbb29a · GitHub

File tree Expand file treeCollapse file tree 7 files changed

+23

-14

lines changed

Filter options

Expand file treeCollapse file tree 7 files changed

+23

-14

lines changed Original file line number Diff line number Diff line change

@@ -1,4 +1,5 @@

1 1

#!/usr/bin/env python

2 +

from __future__ import print_function

2 3

import socket

3 4

import os

4 5

import time

@@ -38,10 +39,10 @@ def _btConnect(self):

38 39

service_classes = [uuid, SERIAL_PORT_CLASS],

39 40

profiles = [SERIAL_PORT_PROFILE],

40 41

)

41 -

print "waiting for connection on RFCOMM channel %d" % port

42 +

print("waiting for connection on RFCOMM channel %d" % port)

42 43

client_socket, client_info = server_sock.accept()

43 44

client_socket.setblocking(0)

44 -

print "Accepted connection from ", client_info

45 +

print("Accepted connection from ", client_info)

45 46

self.bt_sock = client_socket

46 47

self.bt_sock.settimeout(1)

47 48

@@ -50,10 +51,10 @@ def _xBoxConnect(self):

50 51

Initializes a listener for the Xbox controller

51 52

'''

52 53

self.joy = xbox.Joystick()

53 -

print 'Waiting on Xbox connect'

54 +

print("Waiting on Xbox connect")

54 55

while not self.joy.connected():

55 56

time.sleep(1)

56 -

print 'Accepted connection from Xbox controller', self.joy.connected()

57 +

print("Accepted connection from Xbox controller", self.joy.connected())

57 58 58 59

def _btVals(self):

59 60

'''

@@ -100,13 +101,15 @@ def unixSockConnect(self):

100 101

values of strings [0-3]

101 102 102 103

'''

103 -

if os.path.exists(self.config['UNIX_SOCKET_CONFIG']['path']) :

104 +

if os.path.exists(self.config['UNIX_SOCKET_CONFIG']['path']):

104 105

client = socket.socket(socket.AF_UNIX,socket.SOCK_DGRAM)

105 106

client.connect(self.config['UNIX_SOCKET_CONFIG']['path'])

106 107

self.unix_sock = client

107 -

print "Sucessfully connected to Unix Socket at: ", self.config['UNIX_SOCKET_CONFIG']['path']

108 +

print("Sucessfully connected to Unix Socket at: ",

109 +

self.config['UNIX_SOCKET_CONFIG']['path'])

108 110

else:

109 -

print "Couldn't connect to Unix Socket at: ", self.config['UNIX_SOCKET_CONFIG']['path']

111 +

print("Couldn't connect to Unix Socket at: ",

112 +

self.config['UNIX_SOCKET_CONFIG']['path'])

110 113 111 114

def connectController(self):

112 115

'''

Original file line number Diff line number Diff line change

@@ -1,4 +1,5 @@

1 1

#!/usr/bin/env python

2 +

from __future__ import print_function

2 3

import time

3 4

from osr import Rover

4 5

from arguments import Arguments

@@ -29,7 +30,7 @@ def main():

29 30

time.sleep(0.1)

30 31 31 32

except Exception as e:

32 -

print e

33 +

print(e)

33 34

rover.cleanup()

34 35

time.sleep(0.5)

35 36

rover.connectController()

Original file line number Diff line number Diff line change

@@ -1,3 +1,4 @@

1 +

from __future__ import print_function

1 2

import time

2 3

import serial

3 4

import math

@@ -78,7 +79,7 @@ def getEnc(motorID):

78 79

elif (motorID % 2 == 1):

79 80

command = rc.ReadEncM2

80 81

else:

81 -

print "MotorID error"

82 +

print("MotorID error")

82 83

return

83 84

cmd = command(addr[motorID])[1]

84 85

if motorID == 5:

Original file line number Diff line number Diff line change

@@ -1,4 +1,5 @@

1 1

#!/usr/bin/env python

2 +

from __future__ import print_function

2 3

from roboclaw import Roboclaw

3 4

import time

4 5

import serial

@@ -33,7 +34,7 @@ def __init__(self,config):

33 34

version = version & self.rc.ReadVersion(address)[0]

34 35 35 36

if version != 0:

36 -

print "[Motor__init__] Sucessfully connected to RoboClaw motor controllers"

37 +

print("[Motor__init__] Sucessfully connected to RoboClaw motor controllers")

37 38

else:

38 39

raise Exception("Unable to establish connection to Roboclaw motor controllers")

39 40

@@ -66,7 +67,7 @@ def __init__(self,config):

66 67 67 68

voltage = self.rc.ReadMainBatteryVoltage(0x80)[1]/10.0

68 69

if voltage >= config['BATTERY_CONFIG']['low_voltage']:

69 -

print "[Motor__init__] Voltage is safe at: ",voltage, "V"

70 +

print("[Motor__init__] Voltage is safe at: ",voltage, "V")

70 71

else:

71 72

raise Exception("Unsafe Voltage of" + voltage + " Volts")

72 73 Original file line number Diff line number Diff line change

@@ -1,4 +1,5 @@

1 1

#!/usr/bin/env python

2 +

from __future__ import print_function

2 3

from robot import Robot

3 4

from connections import Connections

4 5

@@ -59,7 +60,7 @@ def sendFaceCmd(self):

59 60

try:

60 61

self.sendUnixData()

61 62

except Exception as e:

62 -

print e

63 +

print(e)

63 64

self.unix_flag = 0

64 65 65 66

def cleanup(self):

Original file line number Diff line number Diff line change

@@ -1,3 +1,4 @@

1 +

from __future__ import print_function

1 2

import time

2 3

from rover import Robot

3 4

from connections import Connections

@@ -36,7 +37,7 @@ def drive(self):

36 37

self.cleanup()

37 38 38 39

except Exception as e:

39 -

print e

40 +

print(e)

40 41

self.cleanup()

41 42

time.sleep(0.5)

42 43

self.connectController()

@@ -45,7 +46,7 @@ def drive(self):

45 46

try:

46 47

self.sendUnixData()

47 48

except Exception as e:

48 -

print e

49 +

print(e)

49 50

self.unix_flag = 0

50 51 51 52 Original file line number Diff line number Diff line change

@@ -1,3 +1,4 @@

1 +

from __future__ import print_function

1 2

import time

2 3

import serial

3 4

import threading

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4