Project

General

Profile

Revision 9a88eb2e

ID9a88eb2e8a8e9934880dd25c1cf54fb45fdccf01

Added by Priya over 11 years ago

Fixed pause so that it compiles. Also changed behavior gui so that it starts with Scout1 automatically.

View differences:

scout/libscout/src/BehaviorList.cpp
3 3

  
4 4
BehaviorList::BehaviorList(std::string scoutname, Sensors * sensor)
5 5
{
6
  behavior_list.push_back((Behavior*)new pause_scout(scoutname, sensor));
6 7
  behavior_list.push_back((Behavior*)new draw_cw_circle(scoutname,sensor));
7 8
  behavior_list.push_back((Behavior*)new draw_ccw_circle(scoutname, sensor));
8 9
  behavior_list.push_back((Behavior*)new Odometry(scoutname, sensor));
......
11 12
  behavior_list.push_back((Behavior*)new WH_Robot(scoutname, sensor));
12 13
  behavior_list.push_back((Behavior*)new line_follow(scoutname, sensor));
13 14
  behavior_list.push_back((Behavior*)new wl_test(scoutname, sensor));
14
  behavior_list.push_back((Behavior*)new pause_scout(scoutname));
15 15
  return;
16 16
}
17 17

  
scout/libscout/src/behaviors/pause_scout.h
32 32
{
33 33
    public:
34 34
        /// @todo Is this the best way to inherit the Behavior constructor?
35
        pause_scout(std::string scoutname) : Behavior(scoutname, "pause_scout") {};
35
        pause_scout(std::string scoutname, Sensors* sensors)
36
            : Behavior(scoutname, "pause_scout", sensors) {};
36 37

  
37 38
        /** Actually executes the behavior. */
38 39
        void run();
scout/scoutsim/BehaviorGUI.py
45 45
			behaviorLabel.SetLabel("  |  Current Behavior: "+scouts[name])
46 46
		else:
47 47
			processes[name].send_signal(signal.SIGSTOP)
48
			subprocess.Popen("rosrun libscout libscout "+name+" 8", shell=True) 
48
			subprocess.Popen("rosrun libscout libscout "+name+" 0", shell=True) 
49 49
			print "Scout "+name+" was paused."
50 50
			behaviorButton.SetLabel("Resume")
51 51
			behaviorLabel.SetLabel("  |  Current Behavior: Paused")
52 52
		return True
53 53
	if name in processes:
54 54
		processes[name].kill()
55
	processes[name] = subprocess.Popen("rosrun libscout libscout "+name+" "+str(GetBehaviors().index(behavior))+"", shell=True) 
55
	processes[name] = subprocess.Popen("rosrun libscout libscout "+name+" "+str(GetBehaviors().index(behavior)+1)+"", shell=True) 
56 56
	behaviorButton.SetValue(False)
57 57
	behaviorButton.SetLabel("Pause")
58 58
	print "Scout "+name+" was set to behavior: "+behavior
......
83 83
		super(GUI, self).__init__(parent, title=title, style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER, size=(600, 600))
84 84
		self.InitUI()
85 85
		self.Show()     
86
		self.AddScoutBox("scout1")     
86 87

  
87 88
	def InitUI(self):
88 89
		self.window = wx.ScrolledWindow(self, style=wx.VSCROLL)

Also available in: Unified diff