diff --git a/_sources/lib/Api.rst.txt b/_sources/lib/Api.rst.txt
index 7517d76..21cc1e9 100644
--- a/_sources/lib/Api.rst.txt
+++ b/_sources/lib/Api.rst.txt
@@ -32,26 +32,31 @@ Calling Seeding API
from compLib.Api import Seeding
- park = Seeding.get_park()
- print(f"I should move to parking position: {park}")
-
- if park == 0:
- print(f"I can't move to this position yet :(")
- elif park == 1:
- print(f"Moving to position 1!")
- # drive to parking position using Motors module...
- print(f"Now hopefully at position 1")
- # drive back using Motors module...
- elif park == 2:
- # do something similar to park == 1..
- elif park == 3:
- # do something similar to park == 1..
-
- success = Seeding.pay_park()
- if success:
- print(f"We scored some points!")
+ park, code = Seeding.get_park()
+ if code == 403:
+ print(f"I am not in the correct zone to make that request!")
else:
- print(f"We failed :(")
+ park = park["id"]
+ print(f"I should move to parking position: {park}")
+
+ if park == 0:
+ print(f"I can't move to this position yet :(")
+ elif park == 1:
+ print(f"Moving to position 1!")
+ # drive to parking position using Motors module...
+ print(f"Now hopefully at position 1")
+ # drive back using Motors module...
+ elif park == 2:
+ # do something similar to park == 1..
+ elif park == 3:
+ # do something similar to park == 1..
+
+ success = Seeding.pay_park()
+ # check which code the api returned
+ if success == 201:
+ print(f"We scored some points!")
+ else:
+ print(f"We failed :(")
Calling Double Elimination API
----------------------------------
diff --git a/lib/Api.html b/lib/Api.html
index 35a9f60..33f9b71 100644
--- a/lib/Api.html
+++ b/lib/Api.html
@@ -182,42 +182,42 @@
Class used for communicating with seeding api
-
-static
get_park
() → int
+static get_park
() → Tuple[Dict, int]
Get a parkingsapce from the api.
- Returns
-An int between 0 and 3
+Json Object and status code as returned by the api.
- Return type
-int
+Tuple[Dict, int]
-
-static
pay_park
() → bool
+static pay_park
() → int
Pay for parking.
- Returns
-True if successful, False if not successful
+Status code as returned by the api.
- Return type
-bool
+int
-
-static
simon_says
() → int
+static simon_says
() → Tuple[Dict, int]
Get next simon says zone from the api.
- Returns
-An int between 0 and 3 or -1 after making this request 5 times.
+Json Object and status code as returned by the api.
- Return type
-int
+Tuple[Dict, int]
@@ -305,26 +305,31 @@
Calling Seeding API
from compLib.Api import Seeding
-park = Seeding.get_park()
-print(f"I should move to parking position: {park}")
-
-if park == 0:
- print(f"I can't move to this position yet :(")
-elif park == 1:
- print(f"Moving to position 1!")
- # drive to parking position using Motors module...
- print(f"Now hopefully at position 1")
- # drive back using Motors module...
-elif park == 2:
- # do something similar to park == 1..
-elif park == 3:
- # do something similar to park == 1..
-
-success = Seeding.pay_park()
-if success:
- print(f"We scored some points!")
+park, code = Seeding.get_park()
+if code == 403:
+ print(f"I am not in the correct zone to make that request!")
else:
- print(f"We failed :(")
+ park = park["id"]
+ print(f"I should move to parking position: {park}")
+
+ if park == 0:
+ print(f"I can't move to this position yet :(")
+ elif park == 1:
+ print(f"Moving to position 1!")
+ # drive to parking position using Motors module...
+ print(f"Now hopefully at position 1")
+ # drive back using Motors module...
+ elif park == 2:
+ # do something similar to park == 1..
+ elif park == 3:
+ # do something similar to park == 1..
+
+ success = Seeding.pay_park()
+ # check which code the api returned
+ if success == 201:
+ print(f"We scored some points!")
+ else:
+ print(f"We failed :(")
diff --git a/lib/Servo.html b/lib/Servo.html
index 3e3183f..82ebd9f 100644
--- a/lib/Servo.html
+++ b/lib/Servo.html
@@ -170,7 +170,7 @@
Control the servo ports on the robot
-
-static
set_position
(channel: int, angle: int)
+static set_position
(channel: int, angle: int, offset: float = 90)
Set position of servo connected to port
- Parameters
diff --git a/searchindex.js b/searchindex.js
index 4c1b439..5f665d3 100644
--- a/searchindex.js
+++ b/searchindex.js
@@ -1 +1 @@
-Search.setIndex({docnames:["index","lib/Api","lib/Battery","lib/Buzzer","lib/IRSensor","lib/Logging","lib/Motor","lib/Servo","lib/Vision","other/usage"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":3,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":2,"sphinx.domains.rst":2,"sphinx.domains.std":1,sphinx:56},filenames:["index.rst","lib/Api.rst","lib/Battery.rst","lib/Buzzer.rst","lib/IRSensor.rst","lib/Logging.rst","lib/Motor.rst","lib/Servo.rst","lib/Vision.rst","other/usage.rst"],objects:{"compLib.Api":{DoubleElim:[1,0,1,""],Position:[1,0,1,""],Seeding:[1,0,1,""]},"compLib.Api.DoubleElim":{get_goal:[1,1,1,""],get_items:[1,1,1,""],get_opponent:[1,1,1,""],get_position:[1,1,1,""]},"compLib.Api.Seeding":{get_park:[1,1,1,""],pay_park:[1,1,1,""],simon_says:[1,1,1,""]},"compLib.Battery":{Battery:[2,0,1,""]},"compLib.Battery.Battery":{percent:[2,1,1,""]},"compLib.Buzzer":{Buzzer:[3,0,1,""]},"compLib.Buzzer.Buzzer":{set:[3,1,1,""]},"compLib.IRSensor":{IRSensor:[4,0,1,""]},"compLib.IRSensor.IRSensor":{bottom_left:[4,1,1,""],bottom_middle:[4,1,1,""],bottom_right:[4,1,1,""],top_left_percent:[4,1,1,""],top_right_percent:[4,1,1,""]},"compLib.LogstashLogging":{Logging:[5,0,1,""]},"compLib.LogstashLogging.Logging":{get_logger:[5,1,1,""],set_debug:[5,1,1,""]},"compLib.Motor":{Motor:[6,0,1,""]},"compLib.Motor.Motor":{all_off:[6,1,1,""],power:[6,1,1,""]},"compLib.Servo":{Servo:[7,0,1,""]},"compLib.Servo.Servo":{set_position:[7,1,1,""],setup_position:[7,1,1,""]},"compLib.Vision":{__Streaming:[8,0,1,""]},"compLib.Vision.__Streaming":{get_frame:[8,1,1,""],publish_frame:[8,1,1,""]}},objnames:{"0":["py","class","Python class"],"1":["py","method","Python method"]},objtypes:{"0":"py:class","1":"py:method"},terms:{"001":8,"100":[2,4,6],"2021":0,"9898":8,"class":[0,1,4,7,8],"float":6,"import":[1,2,3,5,6,8,9],"int":[1,2,4,6,7],"return":[1,2,4,5,8],"static":[1,2,3,4,5,6,7],"true":[1,3,4,8],"while":8,BUT:8,For:8,NOT:8,The:8,Use:8,Used:[2,3],Using:0,__main__:9,__name__:9,__stream:8,access:4,after:1,all:[1,6],all_off:6,alwai:1,angl:7,api:0,automat:8,back:1,backward:9,batteri:0,becaus:8,beep:9,between:[1,2,4,6,7],bin:9,bit:8,bool:[1,3,4],bottom:4,bottom_left:4,bottom_middl:4,bottom_right:4,browser:8,buffer:8,buup:9,buzzer:0,call:0,cam:8,camera:8,can:[1,5,8],captur:8,channel:7,chessboard:0,color_bgr2grai:8,come:8,commun:[1,5],competit:5,complib:[0,1,2,3,4,5,6,7,8,9],connect:[6,7,8],control:[6,7],convert:8,coordin:1,corner:8,creat:8,criteria:8,current:1,cv2:8,cvtcolor:8,datastructur:1,debug:5,def:9,degre:1,detect:[0,4],dictionari:1,differ:4,displai:8,document:[0,8],done:8,doubl:0,doubleelim:1,draw:8,drawchessboardcorn:8,drive:[0,1],dure:7,ein:9,elif:1,elimin:0,els:1,exampl:0,fail:1,fals:[1,3],field:1,find:8,findchessboardcorn:8,forward:9,frame:8,from:[1,2,3,5,6,8,9],game:1,get:[1,2,4,5,8],get_fram:8,get_goal:1,get_item:1,get_logg:5,get_oppon:1,get_park:1,get_posit:1,goal:1,grab:8,grai:8,grayscal:8,hallo:9,handl:8,here:8,hold:1,hopefulli:1,how:8,http:8,ich:9,imag:8,indexerror:6,infrar:0,instanc:8,interact:[2,3],interfac:8,internet:8,irsensor:4,item:1,lag:8,left:[4,6],level:5,librari:5,like:[1,8],list:1,littl:8,log:0,logger:5,logstash:5,logstashlog:5,look:[1,8],main:9,make:1,manual:5,max:6,mayb:0,middl:4,might:8,modul:[0,1],motor:[0,1,9],move:1,need:8,newest:8,next:1,none:8,note:8,now:1,object:[1,5],off:0,onto:8,opencv:0,oppon:1,organ:5,output:8,own:8,pai:1,paramet:[3,6,7,8],park:1,parkingsapc:1,pay_park:1,percent:[2,6],percentag:[0,4,6],point:[1,8],port:[6,7,9],posit:[0,7,8],power:[6,9],print:[0,1,9],process:[7,8],provid:8,publish:8,publish_fram:8,python:5,rais:6,rang:[6,9],raspberri:8,realtim:8,record:8,request:1,ret:8,right:[4,6],robot:[1,4,7,9],rotat:1,rtmp:8,run:8,sai:1,score:1,screenshot:8,second:8,seed:0,sensor:0,server:8,servo:0,set:[3,6,7],set_debug:5,set_posit:7,setup:7,setup_posit:7,should:[1,5,8],show:8,signal:4,similar:1,simon:1,simon_sai:1,sleep:[3,9],some:[1,8],someth:1,specifi:6,speed:6,statu:4,straight:0,stream:0,success:1,take:8,term_criteria_ep:8,term_criteria_max_it:8,test:8,thi:[1,5,8],time:[1,3,9],top:[4,6],top_left_perc:4,top_right_perc:4,turn:[0,6],type:[1,2,4,5],usag:0,use:[5,8],used:[0,1,5,6,7],using:[1,8],view:8,vision:0,wait:8,want:8,web:8,webserv:8,websit:8,whatev:8,when:[5,8],which:[6,8],yet:1,you:8,your:8,your_raspi_ip:8,yourself:8,zone:1},titles:["Robo4you Competition Library","Api","Battery","Buzzer","Infrared Sensor","Logging","Motor","Servo","Vision","Usage"],titleterms:{"class":[2,3,5,6],Using:8,api:1,batteri:2,buzzer:3,call:1,chessboard:8,competit:0,content:0,detect:8,document:[2,3,5,6],doubl:1,drive:6,elimin:1,exampl:[1,2,3,5,6,8],infrar:4,librari:0,log:5,mayb:6,modul:8,motor:6,off:3,opencv:8,percentag:2,posit:1,print:2,robo4y:0,seed:1,sensor:4,servo:7,straight:6,stream:8,turn:[3,5],usag:9,vision:8}})
\ No newline at end of file
+Search.setIndex({docnames:["index","lib/Api","lib/Battery","lib/Buzzer","lib/IRSensor","lib/Logging","lib/Motor","lib/Servo","lib/Vision","other/usage"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":3,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":2,"sphinx.domains.rst":2,"sphinx.domains.std":1,sphinx:56},filenames:["index.rst","lib/Api.rst","lib/Battery.rst","lib/Buzzer.rst","lib/IRSensor.rst","lib/Logging.rst","lib/Motor.rst","lib/Servo.rst","lib/Vision.rst","other/usage.rst"],objects:{"compLib.Api":{DoubleElim:[1,0,1,""],Position:[1,0,1,""],Seeding:[1,0,1,""]},"compLib.Api.DoubleElim":{get_goal:[1,1,1,""],get_items:[1,1,1,""],get_opponent:[1,1,1,""],get_position:[1,1,1,""]},"compLib.Api.Seeding":{get_park:[1,1,1,""],pay_park:[1,1,1,""],simon_says:[1,1,1,""]},"compLib.Battery":{Battery:[2,0,1,""]},"compLib.Battery.Battery":{percent:[2,1,1,""]},"compLib.Buzzer":{Buzzer:[3,0,1,""]},"compLib.Buzzer.Buzzer":{set:[3,1,1,""]},"compLib.IRSensor":{IRSensor:[4,0,1,""]},"compLib.IRSensor.IRSensor":{bottom_left:[4,1,1,""],bottom_middle:[4,1,1,""],bottom_right:[4,1,1,""],top_left_percent:[4,1,1,""],top_right_percent:[4,1,1,""]},"compLib.LogstashLogging":{Logging:[5,0,1,""]},"compLib.LogstashLogging.Logging":{get_logger:[5,1,1,""],set_debug:[5,1,1,""]},"compLib.Motor":{Motor:[6,0,1,""]},"compLib.Motor.Motor":{all_off:[6,1,1,""],power:[6,1,1,""]},"compLib.Servo":{Servo:[7,0,1,""]},"compLib.Servo.Servo":{set_position:[7,1,1,""],setup_position:[7,1,1,""]},"compLib.Vision":{__Streaming:[8,0,1,""]},"compLib.Vision.__Streaming":{get_frame:[8,1,1,""],publish_frame:[8,1,1,""]}},objnames:{"0":["py","class","Python class"],"1":["py","method","Python method"]},objtypes:{"0":"py:class","1":"py:method"},terms:{"001":8,"100":[2,4,6],"201":1,"2021":0,"403":1,"9898":8,"class":[0,1,4,7,8],"float":[6,7],"import":[1,2,3,5,6,8,9],"int":[1,2,4,6,7],"return":[1,2,4,5,8],"static":[1,2,3,4,5,6,7],"true":[3,4,8],"while":8,BUT:8,For:8,NOT:8,The:8,Use:8,Used:[2,3],Using:0,__main__:9,__name__:9,__stream:8,access:4,all:[1,6],all_off:6,alwai:1,angl:7,api:0,automat:8,back:1,backward:9,batteri:0,becaus:8,beep:9,between:[2,4,6,7],bin:9,bit:8,bool:[3,4],bottom:4,bottom_left:4,bottom_middl:4,bottom_right:4,browser:8,buffer:8,buup:9,buzzer:0,call:0,cam:8,camera:8,can:[1,5,8],captur:8,channel:7,check:1,chessboard:0,code:1,color_bgr2grai:8,come:8,commun:[1,5],competit:5,complib:[0,1,2,3,4,5,6,7,8,9],connect:[6,7,8],control:[6,7],convert:8,coordin:1,corner:8,correct:1,creat:8,criteria:8,current:1,cv2:8,cvtcolor:8,datastructur:1,debug:5,def:9,degre:1,detect:[0,4],dict:1,dictionari:1,differ:4,displai:8,document:[0,8],done:8,doubl:0,doubleelim:1,draw:8,drawchessboardcorn:8,drive:[0,1],dure:7,ein:9,elif:1,elimin:0,els:1,exampl:0,fail:1,fals:3,field:1,find:8,findchessboardcorn:8,forward:9,frame:8,from:[1,2,3,5,6,8,9],game:1,get:[1,2,4,5,8],get_fram:8,get_goal:1,get_item:1,get_logg:5,get_oppon:1,get_park:1,get_posit:1,goal:1,grab:8,grai:8,grayscal:8,hallo:9,handl:8,here:8,hold:1,hopefulli:1,how:8,http:8,ich:9,imag:8,indexerror:6,infrar:0,instanc:8,interact:[2,3],interfac:8,internet:8,irsensor:4,item:1,json:1,lag:8,left:[4,6],level:5,librari:5,like:[1,8],list:1,littl:8,log:0,logger:5,logstash:5,logstashlog:5,look:[1,8],main:9,make:1,manual:5,max:6,mayb:0,middl:4,might:8,modul:[0,1],motor:[0,1,9],move:1,need:8,newest:8,next:1,none:8,note:8,now:1,object:[1,5],off:0,offset:7,onto:8,opencv:0,oppon:1,organ:5,output:8,own:8,pai:1,paramet:[3,6,7,8],park:1,parkingsapc:1,pay_park:1,percent:[2,6],percentag:[0,4,6],point:[1,8],port:[6,7,9],posit:[0,7,8],power:[6,9],print:[0,1,9],process:[7,8],provid:8,publish:8,publish_fram:8,python:5,rais:6,rang:[6,9],raspberri:8,realtim:8,record:8,request:1,ret:8,right:[4,6],robot:[1,4,7,9],rotat:1,rtmp:8,run:8,sai:1,score:1,screenshot:8,second:8,seed:0,sensor:0,server:8,servo:0,set:[3,6,7],set_debug:5,set_posit:7,setup:7,setup_posit:7,should:[1,5,8],show:8,signal:4,similar:1,simon:1,simon_sai:1,sleep:[3,9],some:[1,8],someth:1,specifi:6,speed:6,statu:[1,4],straight:0,stream:0,success:1,take:8,term_criteria_ep:8,term_criteria_max_it:8,test:8,thi:[1,5,8],time:[3,9],top:[4,6],top_left_perc:4,top_right_perc:4,tupl:1,turn:[0,6],type:[1,2,4,5],usag:0,use:[5,8],used:[0,1,5,6,7],using:[1,8],view:8,vision:0,wait:8,want:8,web:8,webserv:8,websit:8,whatev:8,when:[5,8],which:[1,6,8],yet:1,you:8,your:8,your_raspi_ip:8,yourself:8,zone:1},titles:["Robo4you Competition Library","Api","Battery","Buzzer","Infrared Sensor","Logging","Motor","Servo","Vision","Usage"],titleterms:{"class":[2,3,5,6],Using:8,api:1,batteri:2,buzzer:3,call:1,chessboard:8,competit:0,content:0,detect:8,document:[2,3,5,6],doubl:1,drive:6,elimin:1,exampl:[1,2,3,5,6,8],infrar:4,librari:0,log:5,mayb:6,modul:8,motor:6,off:3,opencv:8,percentag:2,posit:1,print:2,robo4y:0,seed:1,sensor:4,servo:7,straight:6,stream:8,turn:[3,5],usag:9,vision:8}})
\ No newline at end of file