Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation #5

Open
wants to merge 71 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
e608e0f
Create users.txt
jasonjt12 Jan 19, 2023
1ca5241
Update users.txt
jasonjt12 Jan 19, 2023
c2e74ea
added username for Jason
jasonjt12 Jan 19, 2023
5d565b0
Update users.txt
Ribena-dev Jan 19, 2023
16d83f0
Update users.txt
harsheeduh Jan 19, 2023
1c70d25
Update users.txt
jglee11 Jan 19, 2023
23dd5a9
Added space
jglee11 Jan 19, 2023
5eb566f
Merge pull request #1 from jglee11/main
jglee11 Jan 19, 2023
e38e89d
Update users.txt
saatvik-agrawal Jan 19, 2023
b741dae
Update users.txt
harsheeduh Jan 19, 2023
feb7d29
Update users.txt
harsheeduh Jan 19, 2023
8a9a9f0
Update users.txt
harsheeduh Jan 19, 2023
c42ba8d
Update users.txt
harsheeduh Jan 19, 2023
2c692d0
this is done by saatvik
saatvik-agrawal Jan 19, 2023
8ec7636
Merge branch 'main' of github.com:jasonjt12/r2auto_nav into main
saatvik-agrawal Jan 19, 2023
52afc83
this was a random edit made by saatvik for testing purposes
saatvik-agrawal Jan 19, 2023
3586bf6
Create users.txt
harsheeduh Jan 19, 2023
a69f8e4
To enter waypoint into csv file
Ribena-dev Mar 12, 2023
674601b
r2waypoint not working(problem subsrcibing to odom
Ribena-dev Mar 14, 2023
869073c
r2wapoint_2 is test subsrcibtion
Ribena-dev Mar 14, 2023
aefd9fe
r2waypoint subribes to odom, doesnt change after first run
Ribena-dev Mar 14, 2023
f1b6eff
cannot store to csv
Ribena-dev Mar 14, 2023
0ae3085
moving to waypoints
Ribena-dev Mar 21, 2023
8892a6b
moves to waypoint (working)
Ribena-dev Mar 22, 2023
2045e77
saves to csv but some bugs
Ribena-dev Mar 22, 2023
6382dc6
can store point without stopping
Ribena-dev Mar 22, 2023
62e3ce7
need to test in real life
Ribena-dev Mar 22, 2023
cf68f0a
stopping works
Ribena-dev Mar 23, 2023
67ddfd2
can move in path
Ribena-dev Mar 23, 2023
ed81002
works but uses odom topic
Ribena-dev Mar 28, 2023
05289f4
paths stopping deosnt work plus other stuff
Ribena-dev Mar 30, 2023
af69b4a
doesnt work , problem with path moving
Ribena-dev Mar 31, 2023
4fcf80e
need to test (will hv bugs)
Ribena-dev Apr 1, 2023
b367da0
waypoint moving works not intergrated
Ribena-dev Apr 3, 2023
6d4d1fb
neesd testing in real life
Ribena-dev Apr 3, 2023
07f37d3
Not working in simulations
Ribena-dev Apr 3, 2023
b24846a
Table set to 2
Ribena-dev Apr 3, 2023
25434dc
WOrking on publishing
Ribena-dev Apr 3, 2023
597725e
Works in simulations for table 1 to 5
Ribena-dev Apr 4, 2023
79df697
works in sim from table 1 to 5
Ribena-dev Apr 7, 2023
439737e
Test to check lidar values within raneg of index
Ribena-dev Apr 7, 2023
dcdf1bc
Works in sim for table 1 to 5
Ribena-dev Apr 7, 2023
4c08432
Code worksish need to change odom to map2base
Ribena-dev Apr 8, 2023
8746168
works in sim
Ribena-dev Apr 10, 2023
22ee938
test table 6
Ribena-dev Apr 11, 2023
644a5de
improved waypoints storing
Ribena-dev Apr 11, 2023
d872200
test table 6
Ribena-dev Apr 11, 2023
8a88fa2
testing table 6
Ribena-dev Apr 11, 2023
36beb37
testing table 6
Ribena-dev Apr 11, 2023
689800c
Table 6, can_sim and dock_sim added
Ribena-dev Apr 11, 2023
a0d893e
Test sim
Ribena-dev Apr 11, 2023
847cbf2
intergrated with buttons
Ribena-dev Apr 12, 2023
afc6564
intergrating_v1
Ribena-dev Apr 12, 2023
9888efa
add subs
jasonjt12 Apr 12, 2023
ec644aa
Merge branch 'navigation' of https://github.com/jasonjt12/r2auto_nav …
jasonjt12 Apr 12, 2023
e0ce0eb
added irnav
jasonjt12 Apr 12, 2023
ef8b9f7
updated GPIO to irdata
jasonjt12 Apr 12, 2023
b568e36
updated GPIO to internal list, move lost to class
jasonjt12 Apr 12, 2023
80c9f82
check this one
Ribena-dev Apr 12, 2023
4f1054b
fixed merge conflict
Ribena-dev Apr 12, 2023
dda3bfc
please check
Ribena-dev Apr 12, 2023
f6fffb3
removed faulty check
Ribena-dev Apr 12, 2023
611acf1
lidar callback error
Ribena-dev Apr 12, 2023
cb7ed1b
Waypoints alll the way(sans 6)
Ribena-dev Apr 12, 2023
2d0a58e
Redoing table 6
Ribena-dev Apr 13, 2023
0ac50e9
table 6 works ish
Ribena-dev Apr 13, 2023
e577704
Table 6 works
Ribena-dev Apr 13, 2023
b8ffbce
Fully coded n intergrated hvnt tested
Ribena-dev Apr 13, 2023
54a350f
Turning to waypoint broke
Ribena-dev Apr 13, 2023
5710545
waypoint navigation
Ribena-dev Apr 29, 2023
1100c5d
simulate user input from user interface
Ribena-dev Apr 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions publisherbutton.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import time
import ubinascii
import machine
from umqtt.simple import MQTTClient
from machine import Pin, PWM

MQTT_BROKER = '192.168.128.219'
CLIENT_ID = ubinascii.hexlify(machine.unique_id())
user = "roger"
password = "password"
MQTT_TOPIC = "client"
Table = []

# GPIO ports for the 7seg pins
segments = (13,12,14,27,26,25,33)

#Set-up for IO pins based on our electronic architecture
led_A = Pin(13, Pin.OUT) # number in is Output
led_B = Pin(12, Pin.OUT) # number in is Output
led_C = Pin(14, Pin.OUT) # number in is Output
led_D = Pin(27, Pin.OUT) # number in is Output
led_E = Pin(26, Pin.OUT) # number in is Output
led_F = Pin(25, Pin.OUT) # number in is Output
led_G = Pin(33, Pin.OUT) # number in is Output
led_DP = Pin(32, Pin.OUT) # number in is Output
push_button1 = Pin(22, Pin.IN) # input as table 1
push_button2 = Pin(1, Pin.IN) # input as table 2
push_button3 = Pin(3, Pin.IN) # input as table 3
push_button4 = Pin(21, Pin.IN) # input as table 4
push_button5 = Pin(19, Pin.IN) # input as table 5
push_button6 = Pin(18, Pin.IN) # input as table 6
push_button7 = Pin(5, Pin.IN) # input as cancelOrder

num = {' ':(0,0,0,0,0,0,0),
'1':(0,1,1,0,0,0,0),
'2':(1,1,0,1,1,0,1),
'3':(1,1,1,1,0,0,1),
'4':(0,1,1,0,0,1,1),
'5':(1,0,1,1,0,1,1),
'6':(1,0,1,1,1,1,1),
'C':(0,1,1,1,0,0,1),}

def reset():
print("Resetting...")
for loop in range(0,7):
led_pwm = PWM(segments[loop].value(num[' '][loop]), 5000)
led_pwm.duty(Table)
time.sleep(0.001)
time.sleep(5)
machine.reset()

def display(n):
for loop in range(0,7):
segments[loop].value(num[n][loop])
led_pwm.duty(n)
time.sleep(0.001)

def talker():
table1_state = push_button1.value()
table2_state = push_button2.value()
table3_state = push_button3.value()
table4_state = push_button4.value()
table5_state = push_button5.value()
table6_state = push_button6.value()
cancel_state = push_button7.value()
if table1_state == True:
display('1')
return Table + [1]
elif table2_state == True:
display('2')
return Table + [2]
elif table3_state == True:
display('3')
return Table + [3]
elif table4_state == True:
display('4')
return Table + [4]
elif table5_state == True:
display('5')
return Table + [5]
elif table6_state == True:
display('6')
return Table + [6]
elif cancel_state == True:
display('C')
return Table[:-1]
count = 0
def main():
print(f"client {CLIENT_ID} to mqtt broker: {MQTT_BROKER}\n")
mqttClient = MQTTClient(CLIENT_ID, server=MQTT_BROKER, user=user, password=password, keepalive=60)
mqttClient.connect()
for i in range(0,100):
count =+1
Table[-1] = talker()
if (Table[-1] > 0):
print(f"Publishing Table number :: {Table[-1]}")
mqttClient.publish(TOPIC, str(Table[-1]).encode())
time.sleep(3)
mqttClient.disconnect()


if __name__ == "__main__":
try:
main()
except OSError as e:
print("Error: " + str(e))
reset()
Loading