def __init__(self, host, console, hal): t = threading.Thread(target=self.run_server) self.payload = { 'robot_coord': '', 'robot_contorno': '', 'text_buffer': '', 'laser': '', 'sonar_sensor': '', 'pos_vertices': '', 'laser_global': '', 'EnableMapping': '' } # self.map_message = { # 'EnableMapping': '' # } self.server = None self.client = None self.host = host self.acknowledge = False self.acknowledge_lock = threading.Lock() # Take the console object to set the same websocket and client self.console = console self.hal = hal t.start() pose3d_object = ListenerPose3d("/robot0/odom") laser_object = ListenerLaser("/robot0/laser_1") self.map = Map(laser_object, pose3d_object)
def __init__(self, host, hal): t = threading.Thread(target=self.run_server) self.payload = {'image': '', 'map': '', 'array': ''} self.server = None self.client = None self.host = host self.image_to_be_shown = None self.image_to_be_shown_updated = False self.image_show_lock = threading.Lock() self.array_lock = threading.Lock() self.array = None self.acknowledge = False self.acknowledge_lock = threading.Lock() self.mapXY = None self.worldXY = None # Take the console object to set the same websocket and client self.hal = hal t.start() # Create the lap object self.pose3d_object = ListenerPose3d("/taxi_holo/odom") self.map = Map(self.pose3d_object)
def __init__(self, host, console, hal): t = threading.Thread(target=self.run_server) self.payload = {'image': '', 'lap': '', 'map': '', 'text_buffer': ''} self.server = None self.client = None self.host = host # Image variables self.image_to_be_shown = None self.image_to_be_shown_updated = False self.image_show_lock = threading.Lock() self.acknowledge = False self.acknowledge_lock = threading.Lock() # Take the console object to set the same websocket and client self.console = console self.hal = hal t.start() # Create the map object laser_object = ListenerLaser("/F1ROS/laser/scan") pose3d_object = ListenerPose3d("/F1ROS/odom") self.map = Map(laser_object, pose3d_object) # Create the lap object self.lap = Lap(self.map)
def __init__(self, host, hal): t = threading.Thread(target=self.run_server) self.payload = {'image': '','lap': '', 'map': '', 'v':'','w':''} self.server = None self.client = None self.host = host # Image variables self.image_to_be_shown = None self.image_to_be_shown_updated = False self.image_show_lock = threading.Lock() self.acknowledge = False self.acknowledge_lock = threading.Lock() # Get HAL object self.hal = hal t.start() # Create the lap object pose3d_object = ListenerPose3d("/F1ROS/odom") self.lap = Lap(pose3d_object) self.map = Map(pose3d_object)
def __init__(self, host): rospy.init_node("GUI") self.payload = {'image': '','lap': '', 'map': '', 'v':'','w':''} self.server = None self.client = None self.host = host # Image variable self.shared_image = SharedImage("guiimage") # Get HAL variables self.shared_v = SharedValue("velocity") self.shared_w = SharedValue("angular") # Create the lap object pose3d_object = ListenerPose3d("/F1ROS/odom") self.lap = Lap(pose3d_object) self.map = Map(pose3d_object) # Event objects for multiprocessing self.ack_event = multiprocessing.Event() self.cli_event = multiprocessing.Event() # Start server thread t = threading.Thread(target=self.run_server) t.start()
def __init__(self): rospy.init_node("HAL") self.motors = PublisherMotors("/roombaROS/cmd_vel", 4, 0.3) self.pose3d = ListenerPose3d("/roombaROS/odom") self.laser = ListenerLaser("/roombaROS/laser/scan") self.bumper = ListenerBumper("/roombaROS/events/bumper") self.camera_lock = threading.Lock()
def __init__(self): rospy.init_node("HAL") self.image = None self.camera = ListenerCamera("/F1ROS/cameraL/image_raw") self.motors = PublisherMotors("/F1ROS/cmd_vel", 4, 0.3) self.pose3d = ListenerPose3d("/F1ROS/odom") self.laser = ListenerLaser("/F1ROS/laser/scan")
def __init__(self): rospy.init_node("HAL") # Shared memory variables self.image = None self.v = None self.w = None self.p3d = None if os.getcwd() == "/": f = open("/RoboticsAcademy/exercises/car_junction/web-template/stop_conf.yml", "r") else: f = open("stop_conf.yml", "r") cfg = yaml.load(f) ymlNode = cfg['Stop'] #node = rospy.init_node(ymlNode["NodeName"], anonymous=True) # ------------ M O T O R S ---------------------------------- print("Publishing "+ "Stop.Motors" + " with ROS messages") topicM = cfg['Stop']["Motors"]["Topic"] maxW = cfg['Stop']["Motors"]["maxW"] if not maxW: maxW = 0.5 print ("Stop.Motors"+".maxW not provided, the default value is used: "+ repr(maxW)) maxV = cfg['Stop']["Motors"]["maxV"] if not maxV: maxV = 5 print ("Stop.Motors"+".maxV not provided, the default value is used: "+ repr(maxV)) self.motors = PublisherMotors(topicM, maxV, maxW) # ----------------- P O S E 3 D ------------------------------------- print("Receiving " + "Stop.Pose3D" + " from ROS messages") topicP = cfg['Stop']["Pose3D"]["Topic"] self.pose3d = ListenerPose3d(topicP) # -------- C A M E R A C E N T R A L -------------------------------------- print("Receiving " + "Stop.CameraC" + " CameraData from ROS messages") topicCameraC = cfg['Stop']["CameraC"]["Topic"] self.cameraC = ListenerCamera(topicCameraC) # -------- C A M E R A L E F T -------------------------------------------- print("Receiving " + "Stop.CameraL" + " CameraData from ROS messages") topicCameraL = cfg['Stop']["CameraL"]["Topic"] self.cameraL = ListenerCamera(topicCameraL) # -------- C A M E R A R I G H T ------------------------------------------ print("Receiving " + "Stop.CameraR" + " CameraData from ROS messages") topicCameraR = cfg['Stop']["CameraR"]["Topic"] self.cameraR = ListenerCamera(topicCameraR) self.template = cv2.imread('assets/img/template.png',0)
def __init__(self): self.config = Config() self.motors = PublisherMotors(self.config.topic_motors, self.config.max_velV, self.config.max_velW) self.pose3d = ListenerPose3d(self.config.topic_pose) self.sonar_0 = ListenerSonar(self.config.topic_sonar_0) self.sonar_1 = ListenerSonar(self.config.topic_sonar_1) self.sonar_2 = ListenerSonar(self.config.topic_sonar_2) self.sonar_3 = ListenerSonar(self.config.topic_sonar_3) self.sonar_4 = ListenerSonar(self.config.topic_sonar_4) self.sonar_5 = ListenerSonar(self.config.topic_sonar_5) self.sonar_6 = ListenerSonar(self.config.topic_sonar_6) self.sonar_7 = ListenerSonar(self.config.topic_sonar_7) self.laser = ListenerLaser(self.config.topic_laser)
def __init__(self, host, hal): t = threading.Thread(target=self.run_server) self.payload = {'map': ''} self.server = None self.client = None self.host = host self.acknowledge = False self.acknowledge_lock = threading.Lock() self.hal = hal t.start() # Create the lap object pose3d_object = ListenerPose3d("/roombaROS/odom") self.map = Map(pose3d_object)
def __init__(self, host, console): t = threading.Thread(target=self.run_server) self.payload = {'canvas': None,'image': '', 'shape': []} self.server = None self.client = None self.host = host self.payload_lock = threading.Lock() # Take the console object to set the same websocket and client self.console = console t.start() # Create the lap object pose3d_object = ListenerPose3d("/roombaROS/odom") self.map = Map(pose3d_object)
def __init__(self, host, console, hal): t = threading.Thread(target=self.run_server) self.payload = {'map': '', 'text_buffer': ''} self.server = None self.client = None self.host = host self.acknowledge = False self.acknowledge_lock = threading.Lock() # Take the console object to set the same websocket and client self.console = console self.hal = hal t.start() # Create the lap object pose3d_object = ListenerPose3d("/roombaROS/odom") self.map = Map(pose3d_object)
if __name__ == '__main__': if len(sys.argv) < 2: print( 'ERROR: python2 globalNavigation.py [MAP CONFIG file] [YAML CONFIG file]' ) sys.exit(-1) app = QApplication(sys.argv) frame = MainWindow() grid = Grid(frame) removeMapFromArgs() motors = PublisherMotors("/amazon_warehouse_robot/cmd_vel", 0.5, 0.01) pose = ListenerPose3d("/amazon_warehouse_robot/odom") vel = Velocity(0, 0, motors.getMaxV(), motors.getMaxW()) frame.setVelocity(vel) sensor = Sensor(grid, pose, True) sensor.setGetPathSignal(frame.getPathSig) frame.setGrid(grid) frame.setSensor(sensor) algorithm = MyAlgorithm(grid, sensor, vel) frame.setAlgorithm(algorithm) frame.show() t1 = ThreadMotors(motors, vel) t1.daemon = True t1.start()
print("Stop.Motors" + ".maxW not provided, the default value is used: " + repr(maxW)) maxV = cfg.getPropertyWithDefault("Stop.Motors" + ".maxV", 5) if not maxV: maxV = 5 print("Stop.Motors" + ".maxV not provided, the default value is used: " + repr(maxV)) # motors = PublisherMotors("/opel/cmd_vel", maxV, maxW) motors = PublisherMotors(topicM, maxV, maxW) # ----------------- P O S E 3 D ------------------------------------- print("Receiving " + "Stop.Pose3D" + " from ROS messages") topicP = cfg.getProperty("Stop.Pose3D" + ".Topic") pose3d = ListenerPose3d(topicP) # pose3d = ListenerPose3d("/opel/odom") # -------- C A M E R A C E N T R A L -------------------------------------- print("Receiving " + "Stop.CameraC" + " CameraData from ROS messages") topicCameraC = cfg.getProperty("Stop.CameraC" + ".Topic") cameraC = ListenerCamera(topicCameraC) # cameraC = ListenerCamera("/opel/cameraC/image_raw") # -------- C A M E R A L E F T -------------------------------------------- print("Receiving " + "Stop.CameraL" + " CameraData from ROS messages") topicCameraL = cfg.getProperty("Stop.CameraL" + ".Topic") cameraL = ListenerCamera(topicCameraL) # cameraL = ListenerCamera("/opel/cameraL/image_raw") # -------- C A M E R A R I G H T ------------------------------------------
if __name__ == '__main__': if len(sys.argv) < 2: print('ERROR: python2 globalNavigation.py [MAP CONFIG file] [YAML CONFIG file]') sys.exit(-1) app = QApplication(sys.argv) frame = MainWindow() grid = Grid(frame) removeMapFromArgs() motors = PublisherMotors("/taxi_holo/cmd_vel", 4, 0.3) pose = ListenerPose3d("/taxi_holo/odom") vel = Velocity(0, 0, motors.getMaxV(), motors.getMaxW()) frame.setVelocity(vel) sensor = Sensor(grid, pose, True) sensor.setGetPathSignal(frame.getPathSig) frame.setGrid(grid) frame.setSensor(sensor) algorithm = MyAlgorithm(grid, sensor, vel) frame.setAlgorithm(algorithm) frame.show() t1 = ThreadMotors(motors, vel) t1.daemon = True t1.start()
import sys, os from PyQt5.QtWidgets import QApplication from gui.GUI import MainWindow from gui.threadGUI import ThreadGUI from MyAlgorithm import MyAlgorithm from interfaces.camera import ListenerCamera from interfaces.pose3d import ListenerPose3d from interfaces.laser import ListenerLaser from interfaces.motors import PublisherMotors if __name__ == "__main__": camera = ListenerCamera("/F1ROS/cameraL/image_raw") motors = PublisherMotors("/F1ROS/cmd_vel", 3, 0.5) pose3d = ListenerPose3d("/F1ROS/odom") laser = ListenerLaser("/F1ROS/laser/scan") algorithm = MyAlgorithm(pose3d, laser, motors) app = QApplication(sys.argv) myGUI = MainWindow() myGUI.setCamera(camera) myGUI.setMotors(motors) myGUI.setPose3D(pose3d) myGUI.setLaser(laser) myGUI.setAlgorithm(algorithm) myGUI.show() t2 = ThreadGUI(myGUI) t2.daemon = True
def __init__(self): rospy.init_node("HAL") self.pose3d = ListenerPose3d("/taxi_holo/odom") self.motors = PublisherMotors("/taxi_holo/cmd_vel", 4, 0.3) self.camera_lock = threading.Lock()
from MyAlgorithm import MyAlgorithm import rospy import threading from jderobotTypes import LaserData, CMDVel, Pose3d, SonarData from gui.threadPublisher import ThreadPublisher sys.path.append('/home/vladkrav/TFM/AmigoBot/web-template') from interfaces.motors import PublisherMotors from interfaces.pose3d import ListenerPose3d from interfaces.laser import ListenerLaser from interfaces.sonar import ListenerSonar if __name__ == "__main__": motors = PublisherMotors("/robot0/cmd_vel", 0.2, 0.2) pose3d = ListenerPose3d("/robot0/odom") laser = ListenerLaser("/robot0/laser_1") sonar_0 = ListenerSonar("/robot0/sonar_0") sonar_1 = ListenerSonar("/robot0/sonar_1") sonar_2 = ListenerSonar("/robot0/sonar_2") sonar_3 = ListenerSonar("/robot0/sonar_3") sonar_4 = ListenerSonar("/robot0/sonar_4") sonar_5 = ListenerSonar("/robot0/sonar_5") sonar_6 = ListenerSonar("/robot0/sonar_6") sonar_7 = ListenerSonar("/robot0/sonar_7") sonar = [sonar_0, sonar_1, sonar_2, sonar_3, sonar_4, sonar_5, sonar_6, sonar_7] #Run your Algorithm with your solution algorithm=MyAlgorithm(pose3d, motors, laser, sonar) #app = QApplication(sys.argv)
from interfaces.camera import ListenerCamera from interfaces.pose3d import ListenerPose3d from interfaces.laser import ListenerLaser from interfaces.motors import PublisherMotors if __name__ == "__main__": cfg = config.load(sys.argv[1]) #cam_path = cfg.getProperty("ObstacleAvoidance.CameraPath") mot_path = cfg.getProperty("ObstacleAvoidance.MotorsPath") odo_path = cfg.getProperty("ObstacleAvoidance.Pose3DPath") las_path = cfg.getProperty("ObstacleAvoidance.LaserPath") #camera = ListenerCamera(cam_path) motors = PublisherMotors(mot_path, 4, 0.3) pose3d = ListenerPose3d(odo_path) laser = ListenerLaser(las_path) algorithm=MyAlgorithm(pose3d, laser, motors) app = QApplication(sys.argv) myGUI = MainWindow() #myGUI.setCamera(camera) myGUI.setMotors(motors) myGUI.setPose3D(pose3d) myGUI.setLaser(laser) myGUI.setAlgorithm(algorithm) myGUI.show() t2 = ThreadGUI(myGUI) t2.daemon=True
# import sys from gui.GUI import MainWindow from gui.threadGUI import ThreadGUI from MyAlgorithm import MyAlgorithm from PyQt5.QtWidgets import QApplication from interfaces.camera import ListenerCamera from interfaces.pose3d import ListenerPose3d from interfaces.motors import PublisherMotors if __name__ == "__main__": camera = ListenerCamera("/F1ROS/cameraL/image_raw") motors = PublisherMotors("/F1ROS/cmd_vel", 4, 0.3) pose3d = ListenerPose3d("/F1ROS/odom") pose3dphantom = ListenerPose3d("/F1ROS_phantom/odom") algorithm = MyAlgorithm(camera, motors, pose3d) app = QApplication(sys.argv) myGUI = MainWindow() myGUI.setCamera(camera) myGUI.setMotors(motors) myGUI.setPose3D(pose3d, pose3dphantom) myGUI.setAlgorithm(algorithm) myGUI.show() t2 = ThreadGUI(myGUI) t2.daemon = True t2.start()
if __name__ == '__main__': if len(sys.argv) < 2: print('ERROR: python2 globalNavigation.py [MAP CONFIG file] [YAML CONFIG file]') sys.exit(-1) app = QApplication(sys.argv) frame = MainWindow() grid = Grid(frame) removeMapFromArgs() motors = PublisherMotors("/cmd_vel", 0.5, 0.1) pose = ListenerPose3d("/odom") vel = Velocity(0, 0, motors.getMaxV(), motors.getMaxW()) frame.setVelocity(vel) sensor = Sensor(grid, pose, True) sensor.setGetPathSignal(frame.getPathSig) frame.setGrid(grid) frame.setSensor(sensor) algorithm = MyAlgorithm(grid, sensor, vel) frame.setAlgorithm(algorithm) frame.show() t1 = ThreadMotors(motors, vel) t1.daemon = True t1.start()