public ControllerForm(SshClient sshClient, NetworkDevice device) { InitializeComponent(); pBox_video.SizeMode = PictureBoxSizeMode.StretchImage; this.Text = device.Name; sshConsole = new SSHConsole(sshClient, rtxBox, label_Ping); sshConsole.SSHException += SshConsole_SSHException; camera = new MJPEGStream("http://" + device.IP.ToString() + ":8080/?action=stream"); camera.NewFrame += new NewFrameEventHandler(Video_newFrame); sshConsole.WriteLine("cd AlphaBot2/mjpg-streamer/mjpg-streamer-experimental/"); sshConsole.WriteLine("nohup ./start.sh &"); sshConsole.WriteLine("cd"); camera.Start(); controller = new AlphaBot2Controller(sshConsole); }
public AlphaBot2Controller(SSHConsole console) { cameraXPriority = new LinkedList <Keys>(); cameraYPriority = new LinkedList <Keys>(); movementPriority = new LinkedList <Keys>(); cameraControlTimer = new System.Timers.Timer(); cameraXCommandBuilder = new StringBuilder(); cameraYCommandBuilder = new StringBuilder(); this.console = console; console.WriteLine("cd AlphaBot2/python/"); console.WriteLine("python -i"); console.WriteLine("import AlphaBot2"); console.WriteLine("import PCA9685"); console.WriteLine("move = AlphaBot2.AlphaBot2()"); console.WriteLine("camera = PCA9685.PCA9685(0x40, debug = False)"); console.WriteLine("camera.setPWMFreq(50)"); cameraControlTimer.Interval = 20; cameraControlTimer.Elapsed += onTimerElapsed; cameraControlTimer.Start(); }