From ea5a29bba75b51fc42def1753bd065d779ee7d33 Mon Sep 17 00:00:00 2001 From: "SIDDARTH.D" Date: Thu, 17 Feb 2022 12:57:29 +0530 Subject: [PATCH 1/3] adding basic gui --- rusty/scripts/gui.py | 68 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 rusty/scripts/gui.py diff --git a/rusty/scripts/gui.py b/rusty/scripts/gui.py new file mode 100644 index 0000000..50ba3ce --- /dev/null +++ b/rusty/scripts/gui.py @@ -0,0 +1,68 @@ +import rospy +import os +from tkinter import * +from tkinter import ttk +from tkinter import messagebox +import cv2 +import subprocess +import signal + + +class Gui: + + def __init__(self,master): + + self.main=master + self.command="clear" + self.status="false" + self.title=Label(self.main, text='RUSTY', font=("Times", "68", "bold")) + self.title.place(relx=0.5,rely=0.2,anchor=CENTER) + self.tagline=Label(self.main, text='Service robot', font=("Times", "18", "bold")) + self.tagline.place(relx=0.5,rely=0.3,anchor=CENTER) + self.startbutton=Button(self.main, text='START HOME SERVICE', command=self.startcore, font=("Times", "15", "bold")) + self.menu=Button(self.main, text='MENU', command=self.display, font=("Times", "15", "bold")) + self.menu.place(relx=0.50, rely=0.90, anchor=CENTER) + self.exit=Button(self.main, text='Close', command=self.close, font=("Times", "15", "bold")) + #self.exit.place(relx=0.70, rely=0.90, anchor=CENTER) + + self.gazebo=Button(self.main, text='View Gazebo', command=self.viewworld, font=("Times", "15", "bold")) + + def startcore(self): + + if self.status==True: + os.system("roscore") + + + def display(self): + """ + Displaying options for user to see + """ + self.menu.place_forget() + self.gazebo.place(relx=0.2,rely=0.6,anchor=CENTER) + self.exit.place(relx=0.70, rely=0.90, anchor=CENTER) + + def viewworld(self): + """ + Function to view different gazebo worlds + + TASK:= add a radio button for the worlds present + 1.empty.world + 2.house.world + 3.godown.world + + @chevula haarvish + """ + os.system("roslaunch rusty_description gazebo.launch") + + def close(self): + signal.signal(signal.SIGINT, exit(1)) + + +if __name__=="__main__": + root=Tk() + root.title("RUSTY") + root.geometry("500x500") + + myrobot=Gui(root) + root.mainloop() + From 668cf6ad5f7cda83e91e5e7f6b1575e0d2331a88 Mon Sep 17 00:00:00 2001 From: "SIDDARTH.D" Date: Thu, 17 Feb 2022 16:58:18 +0530 Subject: [PATCH 2/3] latest update --- rusty/scripts/gui.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/rusty/scripts/gui.py b/rusty/scripts/gui.py index 50ba3ce..e471206 100644 --- a/rusty/scripts/gui.py +++ b/rusty/scripts/gui.py @@ -4,7 +4,7 @@ from tkinter import ttk from tkinter import messagebox import cv2 -import subprocess +import subprocess as sub import signal @@ -26,11 +26,12 @@ def __init__(self,master): #self.exit.place(relx=0.70, rely=0.90, anchor=CENTER) self.gazebo=Button(self.main, text='View Gazebo', command=self.viewworld, font=("Times", "15", "bold")) - + #SLAM + self.slam=Button(self.main, text='KARTO SLAM', command=self.SLAM, font=("Times", "15", "bold")) def startcore(self): if self.status==True: - os.system("roscore") + os.system("gnome terminal -e roscore") def display(self): @@ -40,6 +41,7 @@ def display(self): self.menu.place_forget() self.gazebo.place(relx=0.2,rely=0.6,anchor=CENTER) self.exit.place(relx=0.70, rely=0.90, anchor=CENTER) + self.slam.place(relx=0.20, rely=0.70, anchor=CENTER) def viewworld(self): """ @@ -52,7 +54,17 @@ def viewworld(self): @chevula haarvish """ - os.system("roslaunch rusty_description gazebo.launch") + world_name="empty" + os.system("roslaunch rusty gazebo.launch world_name:={}".format(world_name)) + + def viewrviz(self): + os.system("roslaunch rusty_description display.launch") + + def SLAM(self): + os.system("cd ~/rosworkspace/src/Rusty/rusty/scripts") + os.system("chmod +x test_slam.sh") + os.system("./test_slam.sh") + def close(self): signal.signal(signal.SIGINT, exit(1)) From 3243371705690ea50dd25ec01c2dc8f3d41c3f6c Mon Sep 17 00:00:00 2001 From: "SIDDARTH.D" Date: Sun, 20 Feb 2022 17:09:11 +0530 Subject: [PATCH 3/3] updated navigation added navigation, and message box --- rusty/scripts/gui.py | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/rusty/scripts/gui.py b/rusty/scripts/gui.py index e471206..ee770f0 100644 --- a/rusty/scripts/gui.py +++ b/rusty/scripts/gui.py @@ -24,10 +24,15 @@ def __init__(self,master): self.menu.place(relx=0.50, rely=0.90, anchor=CENTER) self.exit=Button(self.main, text='Close', command=self.close, font=("Times", "15", "bold")) #self.exit.place(relx=0.70, rely=0.90, anchor=CENTER) - - self.gazebo=Button(self.main, text='View Gazebo', command=self.viewworld, font=("Times", "15", "bold")) + #Gazebo + self.gazebo=Button(self.main, text='GAZEBO', command=self.viewworld, font=("Times", "15", "bold")) #SLAM - self.slam=Button(self.main, text='KARTO SLAM', command=self.SLAM, font=("Times", "15", "bold")) + self.slam=Button(self.main, text='SLAM', command=self.SLAM, font=("Times", "15", "bold")) + #RVIZ + self.rviz=Button(self.main, text='RVIZ', command=self.viewrviz, font=("Times", "15", "bold")) + + #navigation + self.nav=Button(self.main, text='NAVIGATION', command=self.naavigation, font=("Times", "15", "bold")) def startcore(self): if self.status==True: @@ -38,11 +43,15 @@ def display(self): """ Displaying options for user to see """ + self.menu.place_forget() - self.gazebo.place(relx=0.2,rely=0.6,anchor=CENTER) + + self.tagline.configure(text="CONTROL PANEL") + self.gazebo.place(relx=0.2,rely=0.50,anchor=CENTER) self.exit.place(relx=0.70, rely=0.90, anchor=CENTER) - self.slam.place(relx=0.20, rely=0.70, anchor=CENTER) - + self.slam.place(relx=0.20, rely=0.60, anchor=CENTER) + self.rviz.place(relx=0.20,rely=0.70,anchor=CENTER) + self.nav.place(relx=0.20,rely=0.80,anchor=CENTER) def viewworld(self): """ Function to view different gazebo worlds @@ -65,7 +74,19 @@ def SLAM(self): os.system("chmod +x test_slam.sh") os.system("./test_slam.sh") - + def naavigation(self): + os.system("cd ~/rosworkspace/src/Rusty/rusty/scripts") + os.system("chmod +x navigation.sh") + os.system("./navigation.sh") + messagebox.showinfo(title='NAVIGATION TEST', message='Please use 2D nav to move the robot in the world') + + """ + @chevulahaarvish + + call me when you see this + """ + + def close(self): signal.signal(signal.SIGINT, exit(1))