stanley – rc car. introduction the idea of this project – develop remote controlled car that...
TRANSCRIPT
![Page 1: Stanley – RC Car. Introduction The idea of this project – develop Remote Controlled Car that will be controlled by the computer. Initial Idea – Control](https://reader030.vdocuments.net/reader030/viewer/2022032709/56649eac5503460f94bb23a5/html5/thumbnails/1.jpg)
Stanley – RC Car
![Page 2: Stanley – RC Car. Introduction The idea of this project – develop Remote Controlled Car that will be controlled by the computer. Initial Idea – Control](https://reader030.vdocuments.net/reader030/viewer/2022032709/56649eac5503460f94bb23a5/html5/thumbnails/2.jpg)
Introduction
• The idea of this project – develop Remote Controlled Car that will be controlled
by the computer.• Initial Idea– Control Stanley by the keyboard– Control Stanley by the mouse– Draw the path
• Add on – Direction by laser pointer– Follow the Light point– Follow the object based on the colour.
![Page 3: Stanley – RC Car. Introduction The idea of this project – develop Remote Controlled Car that will be controlled by the computer. Initial Idea – Control](https://reader030.vdocuments.net/reader030/viewer/2022032709/56649eac5503460f94bb23a5/html5/thumbnails/3.jpg)
The Hardware
• Remote Controlled Car– Digital controller
• PhidgetInterfaceKit 0/0/4 board– USB-based controller, – with 4 digital outputs
• USB Webcam• IP Webcam
![Page 4: Stanley – RC Car. Introduction The idea of this project – develop Remote Controlled Car that will be controlled by the computer. Initial Idea – Control](https://reader030.vdocuments.net/reader030/viewer/2022032709/56649eac5503460f94bb23a5/html5/thumbnails/4.jpg)
Connecting the Car
• Controller – Switches for controlling
directions– One switch = two points
(ground and active)– Press switch closes circuit
• Identify the points– Different colour wires for different direction– Solder on group of two points
![Page 5: Stanley – RC Car. Introduction The idea of this project – develop Remote Controlled Car that will be controlled by the computer. Initial Idea – Control](https://reader030.vdocuments.net/reader030/viewer/2022032709/56649eac5503460f94bb23a5/html5/thumbnails/5.jpg)
• PhidgetInterfaceKit Board– 4 Relay Outputs, each
relay has 3 connections:• #C = Common• NO – Normally Open• NC – Normally Close
• Screw the wires– Grouped by the colour – to each relay• #C, and NO• Port no = #
Connecting the Car
![Page 6: Stanley – RC Car. Introduction The idea of this project – develop Remote Controlled Car that will be controlled by the computer. Initial Idea – Control](https://reader030.vdocuments.net/reader030/viewer/2022032709/56649eac5503460f94bb23a5/html5/thumbnails/6.jpg)
Connecting the Camera
• Power connection wireless– Power connector (2mm out diameter1.3 inner diameter).– Battery Holder– Wires– 4 AA CHARGABLE batteries at 1.2V each, with
capacity rating over 2000mAh.
![Page 7: Stanley – RC Car. Introduction The idea of this project – develop Remote Controlled Car that will be controlled by the computer. Initial Idea – Control](https://reader030.vdocuments.net/reader030/viewer/2022032709/56649eac5503460f94bb23a5/html5/thumbnails/7.jpg)
The Software
• Visual Studio 2008• Microsoft Robotics Studio• Phidget Libraries• Aforge Libraries
![Page 8: Stanley – RC Car. Introduction The idea of this project – develop Remote Controlled Car that will be controlled by the computer. Initial Idea – Control](https://reader030.vdocuments.net/reader030/viewer/2022032709/56649eac5503460f94bb23a5/html5/thumbnails/8.jpg)
The Software
• Microsoft Robotics Studio– Microsoft Robotics Studio Runtime have two main components;
• Concurrency and Coordinate Runtime (CCR) • Managed code Library
• The Decentralized System Services (DSS)• Decentralized Software Service Protocol (DSSP) –to interact with the services
• XML/Soap• Subscribe to service
• Contains state information, identification and has ports that can accept messages and service handlers to process these messages
– Supports wide range of programming Languages; VB.NET, C#, Microsoft Visual Programming Language (VPL) (provided as part of the Microsoft Robotics Studio)
– Create Service• Command prompt
– dssnewservice/service: RemoteCar• Folder with project and Solution Files
– RemoteCar.cs (contains implementation of the remote car service)– RemoteCar.manifest.xml (indicate a set of service that are to be started)
![Page 9: Stanley – RC Car. Introduction The idea of this project – develop Remote Controlled Car that will be controlled by the computer. Initial Idea – Control](https://reader030.vdocuments.net/reader030/viewer/2022032709/56649eac5503460f94bb23a5/html5/thumbnails/9.jpg)
The Software
• Phidget Libraries– PhitgetInterfaceKit is managed behind this library– MRS includes a built-in service for PhidgetInterfaceKit– Communicate with the PhidgetInterface
• Add Reference• Import Library
private phidgetinterfacekit.PhidgetInterfaceKitBoardsOperations _ikPort = new phidgetinterfacekit.PhidgetInterfaceKitBoardsOperations();
• Declare Port private phidgetinterfacekit.PhidgetInterfaceKitBoardsOperations _ikPort = new phidgetinterfacekit.PhidgetInterfaceKitBoardsOperations();
• Subscribe To the Service_ikPort.SelectiveSubscribe(null,new phidgetinterfacekit.PhidgetInterfaceKitBoardsOperations());
![Page 10: Stanley – RC Car. Introduction The idea of this project – develop Remote Controlled Car that will be controlled by the computer. Initial Idea – Control](https://reader030.vdocuments.net/reader030/viewer/2022032709/56649eac5503460f94bb23a5/html5/thumbnails/10.jpg)
The Software
public enum Direction { Forward = 0, Backward, Left, Right}public void SetOutput(Direction dir, bool enabled) { if (dir == Direction.None) return; // create a new request to send to the Phidgets service phidgetinterfacekit.SetOutputRequestType req = new
phidgetinterfacekit.SetOutputRequestType(); // assign the index and state (true/false) req.Index = (int)dir; req.State = enabled; // send the request to the port _ikPort.SetOutput(req); }
![Page 11: Stanley – RC Car. Introduction The idea of this project – develop Remote Controlled Car that will be controlled by the computer. Initial Idea – Control](https://reader030.vdocuments.net/reader030/viewer/2022032709/56649eac5503460f94bb23a5/html5/thumbnails/11.jpg)
The Software
• Aforge.NET Libraries– Developed by Andrew Kirillow– Written in C#– For Computer Vision– 6 main libraries:
• AForge.Imaging is library for processing routines and filters.• AForge.Neuro is neural networks computation library.• AForge.Genetic is evaluation programming library.• AForge.Vision is computer vision library.• AForge.Machine Learning is machine learning library.• AForge.Robotics.Lego is for manipulation of Lego Mindstorm NXT
devices.– Classes for accessing local video capture devices (DirectShow),
and motion JPEG stream.
![Page 12: Stanley – RC Car. Introduction The idea of this project – develop Remote Controlled Car that will be controlled by the computer. Initial Idea – Control](https://reader030.vdocuments.net/reader030/viewer/2022032709/56649eac5503460f94bb23a5/html5/thumbnails/12.jpg)
Stanley without camera
• Control the car by keyboard–Testing tool–ProcessCmdKey/keyUp
• Control the car on the screen–MouseUp/Down
• Control the car by the mouse–Compare last x and y coordinates with new
(count every 5th)
![Page 13: Stanley – RC Car. Introduction The idea of this project – develop Remote Controlled Car that will be controlled by the computer. Initial Idea – Control](https://reader030.vdocuments.net/reader030/viewer/2022032709/56649eac5503460f94bb23a5/html5/thumbnails/13.jpg)
Stanley without camera
• Control the car by the mouse–Compare last x and y coordinates with new
(count every 5th)
![Page 14: Stanley – RC Car. Introduction The idea of this project – develop Remote Controlled Car that will be controlled by the computer. Initial Idea – Control](https://reader030.vdocuments.net/reader030/viewer/2022032709/56649eac5503460f94bb23a5/html5/thumbnails/14.jpg)
Stanley without camera
• Follow the Path• Compare first x and y points with last• Calculate line length between points (Line Length = √ ((x2-x1)*(x2-x1)) + ((y2-y1)*(y2-y1))
• Calculate Angle
• Compare angles ==> • Measure Stanley movements
![Page 15: Stanley – RC Car. Introduction The idea of this project – develop Remote Controlled Car that will be controlled by the computer. Initial Idea – Control](https://reader030.vdocuments.net/reader030/viewer/2022032709/56649eac5503460f94bb23a5/html5/thumbnails/15.jpg)
Stanley with camera
• Control on the screen With camera– Testing tool– MouseDown/Up
• Follow direction from the laser pointer– Look trough each pixel in image– Convert each pixel in corresponding colour from grey scale by
using the Greyscale BT709 algorithm– red * 0.2125 + green * 0.7154 + blue * 0.0721 = 0-255– Value >240– Record x and y points– Determine direction – Same algorithm like in “mouse move”
![Page 16: Stanley – RC Car. Introduction The idea of this project – develop Remote Controlled Car that will be controlled by the computer. Initial Idea – Control](https://reader030.vdocuments.net/reader030/viewer/2022032709/56649eac5503460f94bb23a5/html5/thumbnails/16.jpg)
Stanley with camera
• Follow the Lightest point• Find the lightest pixel – same as in previous
example• Record the x and y points• Compare the points with camera position• Determine direction• Determine Distance (stop/go)• Search for the object
![Page 17: Stanley – RC Car. Introduction The idea of this project – develop Remote Controlled Car that will be controlled by the computer. Initial Idea – Control](https://reader030.vdocuments.net/reader030/viewer/2022032709/56649eac5503460f94bb23a5/html5/thumbnails/17.jpg)
• Track the object based on the colour•Filter Image:
•Blur•Colour Filter –RGB – range 0-255 •Convert to Greyscale•Threshold
•Convert image into a 1-bit binary image•Black and white (depending on the pixel value
•Get Image size and position•BlobCounter / getObjectRectangles();
•Find the centre of the object •Record the x and y points•Compare the points with •camera position•Determine direction•Determine Distance (stop/go)•Search for the object
Stanley with camera
![Page 18: Stanley – RC Car. Introduction The idea of this project – develop Remote Controlled Car that will be controlled by the computer. Initial Idea – Control](https://reader030.vdocuments.net/reader030/viewer/2022032709/56649eac5503460f94bb23a5/html5/thumbnails/18.jpg)
Deploy the Stanley
• DSS Deploy Tool • Creates files containing all MRS
components needed for running the application
• dssdeploy /p /m:“RemoteCar\RemoteCar.manifest.xml" InstallStanley.exe
• Start • MRS not needed• Trough Standard Command Prompt• cd /d C:/InstallStanley" bin\dsshost /p:50000 /m:" RemoteCar\
RemoteCar.manifest.xml"