File: test-gui.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 (35 lines) | stat: -rw-r--r-- 793 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
25
26
27
28
29
30
31
32
33
34
35
import pyenki
import random

class MyEPuck(pyenki.EPuck):
	
	def __init__(self):
		super(MyEPuck, self).__init__()
		self.timeout = 10
		
	def controlStep(self, dt):
		if self.timeout == 0:
			self.leftSpeed = random.uniform(-100,100)
			self.rightSpeed = random.uniform(-100,100)
			self.timeout = random.randint(1,10)
		else:
			self.timeout -= 1
		#print('Control step')
		#print('pos: ' + str(self.pos))
		#print('IR dists: ' + str(self.proximitySensorDistances))
		#print('IR values: ' + str(self.proximitySensorValues))
		#print('Cam image: ' + str(self.cameraImage))
		#print len(self.cameraImage), self.cameraImage[0]
		print id(self), self.pos


w = pyenki.World()

for i in range(0,10):
	for j in range(0,10):
		e = MyEPuck()
		e.pos = (i*10,j*10)
		w.addObject(e)

w.runInViewer()