Skip to content

Commit 95bcbf5

Browse files
naming changes
1 parent 5266e95 commit 95bcbf5

File tree

3 files changed

+30
-31
lines changed

3 files changed

+30
-31
lines changed

AVISEngine.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'''
2-
@ 2022, Copyright AVIS Engine
2+
@ 2023, Copyright AVIS Engine
33
'''
44

55
import cv2
@@ -11,17 +11,17 @@
1111
import utils
1212

1313
__author__ = "Amirmohammad Zarif"
14-
__email__ = "amirmohammadzarif@avisengine.com"
14+
__email__ = "amir@avisengine.com"
1515

1616

1717
class Car():
1818
'''
19-
AVIS Engine Main car class
19+
AVIS Engine Main Car class
2020
2121
Attributes
2222
----------
2323
24-
Private:
24+
Public:
2525
steering_value
2626
speed_value
2727
sensor_status

Example.py

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
11
'''
2-
@ 2022, Copyright AVIS Engine
3-
Example Compatible with AVISEngine version 2.0.1 or higher
2+
@ 2023, Copyright AVIS Engine
3+
- An Example Compatible with AVISEngine version 2.0.1 or higher
44
'''
5-
import AVISEngine
5+
import avisengine
66
import config
77
import time
88
import cv2
99

10-
#Calling the class
11-
car = AVISEngine.Car()
10+
# Creating an instance of the Car class
11+
car = avisengine.Car()
1212

13-
#connecting to the server (Simulator)
13+
# Connecting to the server (Simulator)
1414
car.connect(config.SIMULATOR_IP, config.SIMULATOR_PORT)
1515

16-
#Counter variable
16+
# Counter variable
1717
counter = 0
1818

1919
debug_mode = False
2020

21-
#Sleep for 3 seconds to make sure that client connected to the simulator
21+
# Sleep for 3 seconds to make sure that client connected to the simulator
2222
time.sleep(3)
2323

2424
try:
2525
while(True):
26-
#Counting the loops
27-
26+
# Counting the loops
2827
counter = counter + 1
2928

30-
#Set the power of the engine the car to 20, Negative number for reverse move, Range [-100,100]
29+
# Set the power of the engine the car to 20, Negative number for reverse move, Range [-100,100]
3130
car.setSpeed(20)
3231

33-
#Set the Steering of the car -10 degree from center
32+
# Set the Steering of the car -10 degree from center, results the car to steer to the left
3433
car.setSteering(-10)
3534

36-
#Set the angle between sensor rays to 30 degrees, Use this only if you want to set it from python client
35+
# Set the angle between sensor rays to 30 degrees, Use this only if you want to set it from python client
3736
car.setSensorAngle(40)
3837

39-
#Get the data. Need to call it every time getting image and sensor data
38+
# Get the data. Need to call it every time getting image and sensor data
4039
car.getData()
4140

42-
#Start getting image and sensor data after 4 loops. for unclear some reason it's really important
41+
# Start getting image and sensor data after 4 loops
4342
if(counter > 4):
4443

45-
#returns a list with three items which the 1st one is Left sensor data, the 2nd one is the Middle Sensor data, and the 3rd is the Right one.
44+
# Returns a list with three items which the 1st one is Left sensor data\
45+
# the 2nd one is the Middle Sensor data, and the 3rd is the Right one.
4646
sensors = car.getSensors()
47-
#EX) sensors[0] returns an int for left sensor data in cm
4847

49-
#returns an opencv image type array. if you use PIL you need to invert the color channels.
48+
# Returns an opencv image type array. if you use PIL you need to invert the color channels.
5049
image = car.getImage()
5150

52-
#returns an integer which is the real time car speed in KMH
51+
# Returns an integer which is the real time car speed in KMH
5352
carSpeed = car.getSpeed()
5453

55-
#Don't print data for better performance
5654
if(debug_mode):
57-
print("Speed : ",carSpeed)
58-
print("Left : " + str(sensors[0]) + " | " + "Middle : " + str(sensors[1]) +" | " + "Right : " + str(sensors[2]))
59-
60-
#Showing the opencv type image
55+
print(f"Speed : {carSpeed}")
56+
print(f'Left : {str(sensors[0])} | Middle : {str(sensors[1])} | Right : {str(sensors[2])}')
57+
58+
# Showing the opencv type image
6159
cv2.imshow('frames', image)
62-
#Break the loop when q pressed
60+
61+
6362
if cv2.waitKey(10) == ord('q'):
6463
break
64+
6565
time.sleep(0.001)
6666

6767
finally:

utils.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
'''
22
@ 2022, Copyright AVIS Engine
33
'''
4-
#Utils and Extra Functions for AVISEngine Class
4+
# Utils for AVISEngine Class
55
import base64
66
import cv2
77
import numpy as np
88
from PIL import Image
99
import io
10-
import json
1110

1211

1312
__author__ = "Amirmohammad Zarif"

0 commit comments

Comments
 (0)