def main(): #--------------------------------------OBSTACLE-SETUP---------------------------------# obstacles = [(-100, 0), (-90, 0), (-90, 150), (-100, 150), (100, 0), (90, 0), (90, 150), (100, 150), (40, 50), (-40, 50), (-40, 80), (40, 80)] newObstacles = formatObstacles(obstacles) #---------------------------------------GET-POSITION----------------------------------# robotPos = (0, 0) #---------------------------------------HISTORY STUFF---------------------------------# # Just for printing out at the end sensedPointsHist = [] path = [] controller = RobotController() #---------------------------------------ACTION LOOP---------------------------------# for i in range(1): # Get action action = controller.getAction() path.append(controller.getCurrentPosition()) # Get scan of surroundings every 15 degrees detectedPoints = getDetectedPoints(controller.getCurrentPosition(), newObstacles, 15) controller.updateSurroundings(detectedPoints) sensedPointsHist += detectedPoints drawSimulation(obstacles, path, sensedPointsHist)
def main(): controller = RobotController() controller.updateSurroundings([(10, 180)]) controller.updatePosition(5, 0) controller.updateVisited([(5, 0)]) print(str(controller.polarToCartesian(1, pi / 2))) print(controller)
def __init__(self): # Among other things, this constructor initializes # logging and preferences. AbstractRwbGui.__init__(self, NAME, DEFAULT_SETTINGS) self.wm_geometry("800x600") self.tally = RobotTally() self._create_fonts() self._create_menubar() self._create_statusbar() self._create_toolbar() # self._create_command_line() self._create_notebook() self.register(GeneralSettingsFrame) self._controller = RobotController(self) self._controller.configure(listeners=(self.console,self.log_tree, self.log_messages, self.tally, self))
def follow_me(): rospy.init_node('follow_me') signal.signal(signal.SIGINT, terminate) human_pose_topic = rospy.get_param(rospy.get_name()+'/human_pose_topic') #, '/HumanPose' human_path_topic = rospy.get_param(rospy.get_name()+'/human_pose_topic') #, '/HumanPath' uav_pose_topic = rospy.get_param(rospy.get_name()+'/uav_pose_topic') #, '/UAV1Pose' cmd_vel_topic = rospy.get_param(rospy.get_name()+'/cmd_vel_topic') #, '/uav1/mobile_base/commands/velocity' activation_service = rospy.get_param(rospy.get_name()+'/activation_service') #, '/uav1/follow_me/enable' follow_distance = rospy.get_param(rospy.get_name()+'/follow_distance') #, 2 ##### DEBUGGING ###### # leader_pose_sub = rospy.Subscriber('/uav2/odom', Odometry, leader_pose_cb) # leader_pose_sub = rospy.Subscriber('/uav1/odom', Odometry, self_pose_cb) ###################### # Logging Parameters print ("") global human_pose_sub, human_path_sub, uav_pose_sub, cmd_vel_pub, robot_controller robot_controller = RobotController(follow_distance, publish_velocity, obstacle_avoidance=True) human_pose_sub = rospy.Subscriber(human_pose_topic, PoseWithCovarianceStamped, human_pose_cb) human_path_sub = rospy.Subscriber(human_path_topic, Path, human_path_cb) uav_pose_sub = rospy.Subscriber(uav_pose_topic, PoseWithCovarianceStamped, uav_pose_cb) cmd_vel_pub = rospy.Publisher(cmd_vel_topic, Twist, queue_size=1000) activation_srv = rospy.Service(activation_service, SetBool, set_mode) print ("UAV Follower Controller: %s" %(uav_pose_topic)) # spin() simply keeps python from exiting until this node is stopped rospy.spin()
# ############################################ # Model learning of two link robot arm # Script for training and testing of model # # Author : Deepak Raina @ IIT Delhi # Version : 0.1 # ############################################ from controller import RobotController # Robot controller controller = RobotController() EPOCHS = 10000 MODEL_FILE_LOC = 'models/trained_nn_model_' + str(EPOCHS) ## Training controller.train(epochs=EPOCHS) ## Testing # controller.test(model_fileloc = MODEL_FILE_LOC, num_test=1)