File: test.py

package info (click to toggle)
enki-aseba 1%3A1.6.99-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 4,916 kB
  • sloc: cpp: 15,011; python: 143; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 644 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import pyenki
import math

class MyEPuck(pyenki.EPuck):
	def controlStep(self, dt):
		self.leftSpeed = 0.1
		self.rightSpeed = 0.2
		print('Control step')
		print('pos: ' + str(self.pos))
		print('IR dists: ' + str(self.proximitySensorDistances))
		assert(not any(map(math.isnan, self.proximitySensorDistances)))
		print('IR values: ' + str(self.proximitySensorValues))
		assert(not any(map(math.isnan, self.proximitySensorValues)))
		print('Cam image: ' + str(self.cameraImage))
		print len(self.cameraImage), self.cameraImage[0]

w = pyenki.World()
e = MyEPuck()
#e = pyenki.EPuck()
w.addObject(e)

for i in range(10):
	w.step(0.05)
	print ''