這是我們之前跟北科大車輛系蕭耀榮老師配合的合作計劃,CompactRIO 在此能夠整合無線網路,PDA遙控,甚至Wii遙桿來控制馬達平臺。來看看哦!
既然我們已經從PC上跟Axis Camera連線成功了,現在我們可以試著將AXIS 206連到 cRIO-9074 的第二個網路孔 (記得哦,是第二個,第一個孔是讓 CompactRIO 接到電腦的。)
首先我們先來做些設定。從MAX裡找出你的CompactRIO,選擇 “Advanced Ethernet Settings”選項。
在左邊選擇第二個 ethernet port 的 MAC address,然後將 mode 從 “Disabled” 調成 “TCP/IP Network”. IP address 可以設成跟你 AXIS 206 的 IP 地址同樣 subnet。按ok之後,CompactRIO會需要重新開機。
接下來,我們就可以用之前 Part I 的程式來從 cRIO 跟 AXIS 206 Camera 溝通了! Remember to move the VI from the “My Computer” level in the LabVIEW Project to the cRIO level in the LabVIEW Project.
注意嘍,CompactRIO 的原廠設定是不支援 NI Vision 函數的,不過我們可以 Hack 一下 CompactRIO 來克服這個問題。
There are two install scripts located under these locations:
C:\Program Files\National Instruments\RT Images\Vision\8.6.0\install.cdf
C:\Program Files\National Instruments\RT Images\CommonVision\nivissvc.cdf
Replace with these files:
Note: These CDF files are for LabVIEW 8.6.0 only.
Once the scripts have been correctly updated, relaunch MAX and download Vision to your cRIO target. Right click on Software and select Add/Remove Software.
Select Custom Software Installation.
Highlight NI Vision RT and select “Install the feature.” Click Next.
Reboot and you’re done!
The AXIS 206 is an ethernet-based camera that supports up to 640x480 resolution. The camera has a built-in web server that allows you to monitor the live images from a web browser. Just type in http://x.x.x.x where x.x.x.x is the IP address of your camera.
The camera might ask you for a user name and password when you connect to the page, usually the user name is “root” and the password is “pass.” Find the option in the settings menu to switch on “anonymous login” so that this prompt won’t show anymore. This way we can use a program from LabVIEW to control the camera without being blocked by the password.
The VI you want to run is called “axis_03_grab.vi”. You’ll need to also have the NI Vision Development Module installed before you run it.
Don’t run this VI on the CompactRIO yet, because I haven’t told you how to modify the CompactRIO so that it can run the vision algorithms. You can run this VI on the PC first to experiment with it. Remember to change to IP address so that it matches your camera! When connecting from a PC without a hub or router, make sure to use a crossover cable, otherwise you might have some problems.
Also, if you have trouble finding CalculateFPS.vi, here it is for download.
Here are some tutorials from the NI website to show you how to use CompactRIO Scan Mode. You’ll probably want to use Scan Mode to output an analog voltage from the NI 9263 analog output module to control your motors.
還蠻簡單的,just follow the instructions below:
1. Download the Hokuyo URG-04LX instrument driver from ni.com/idnet (search for Hokuyo.)
http://www.ni.com/devzone/idnet/
2. Install under Program Files\National Instruments\Labview X.X\instr.lib
3. Plug in the USB port from the URG to the PC.
4. Find out which COM Port to use to communicate to the URG from Device Manager
5. Open the LabVIEW example, and select the appropriate COM Port.
如果你的URG是新的話,你可能要用他的軟體來把SCIP從1.1設成2.0. Here is the configuration tool, you can also use it to set the baud rate for the RS-232 interface (用 USB 連線的話,baud rate 的設定就無所謂了。)
Have fun!
-John
921 U8930: Robot Sensing and Control
Final Project: Unmanned Guided Vehicle (UGV)
Objective:
To design a robot that can navigate through an obstacle course and deliver a payload to the designated target location.
Background Information:
Unmanned Guided Vehicles (UGVs) are used to perform routine tasks for industry, as well as being used in areas hazardous to humans. Machine vision can provide such vehicles with 'sight', allowing them to understand their surroundings and leading to more flexible use of UGVs. Other sensors may be used to collect more data from the surroundings, and data from multiple sensors may be “fused” and combined to derive more complete data of the environment. Such sensors may include LIDAR sensors, IMU (Inertial Measurement Units), ultrasonic sensors, and GPS sensors. Real-world use of UGVs include military applications, terrain exploration, automated “driver” or driving assistance, and consumer applications (robot “helpers” or “maids”.)
Fig.1: UGVs in military, automotive, and consumer use
For this project, you will be using the NI CompactRIO system to help you integrate various sensors, vision systems, and motion control. By understanding how NI LabVIEW works as a graphical programming language, you will be able to assemble the critical components of a robotics system.
Rules of the Challenge:
1. Robots start at the “Start Point”. There will be 6 red cones scattered randomly about the area. The field is surrounded by a wall or fence. The waypoints will have brightly colored flags or markers for indication.
2. Robot has to navigate to the first waypoint to “pickup” payload. For the purposes of this challenge, the robot only has to physically touch the waypoint and wait for 5 seconds.
3. Robot has to navigate to the second waypoint to “deliver” payload. Again, the robot only has to physically touch the waypoint and wait for 5 seconds.
4. Robot has to navigate back to the “Start Point” and standby for further instructions.
5. Each group gets 3 runs in the obstacle course. We will take the run with the shortest time as your best run. The team that has the shortest course time will receive 5 bonus points to your overall score.
Scoring scheme:
Robot reached Waypoint 1: 10 points
Robot reached Waypoint 2: 10 points
Robot returned to Start Point: 10 points
Bonus Points: 5 points (awarded to the team with the shortest time)
Penalties:
1. If the robot physically touches a cone, 2 points will be deducted.
2. If the robot physically touches the wall or fence, 5 points will be deducted.
3. If the robot needs to be reset, no penalty will be taken, but the timer will not stop. You must return your robot to the Start Point to try again.
4. Except for returning the robot to the Start Point, you may not interfere with the robot while it is navigating the obstacle course (i.e. nudging, tilting, or pushing the robot.) The robot must be able to finish the course autonomously to receive full points. Interfering with the robot will disqualify the current run, and the course time will not be considered valid.
Materials/equipment provided to you:
l NI CompactRIO
l NI LabVIEW
l NTU Robot platform with 24V battery
l Hokuyo URG-04LX Scanning Laser Rangefinder
l AXIS 206 camera
l Wireless Router
l 24V DC to 5V DC Converter
Project Guidelines:
There are two main challenges involved in completing the obstacle course.
l How do I make the robot avoid the cones and stay within the field?
l How do I let the robot know where the waypoints are?
Of course, there are many ways to solve these problems. It will be up to you to use your creativity to implement such a solution. Here we will briefly investigate a few examples to help you get started.
Obstacle Avoidance:
Sensors such as ultrasonic sensors and infrared sensors may be used to tell a robot if an object is within vicinity of the sensor range. However, the accuracy of the sensors are limited, and unless they are used in an array configuration, most likely you will only be able to extract some vague information. LIDAR sensors, on the other hand, such as the Hokuyo URG-04LX Scanning Rangefinder, will be able to feedback an accurate “map” of its surroundings within its scan range. By using such a sensor, it will be easy to detect object presence accurately, and the robot can use this information to decide whether to drive forward, turn, reverse, etc. LabVIEW has example programs that can interface directly with the Hokuyo URG-04LX.
Fig 2. Hokuyo URG-04LX and resulting “map” of surroundings
Waypoint Detection:
Object detection and tracking is usually done with a vision system in robotics applications. Because machine vision is highly dependent on ambient lighting conditions, there are also many possible algorithms that can be applied to object tracking. One method of object tracking is through the use of color. If the color of an object has high contrast with its surroundings, then robots can use cameras to recognize this unique color and isolate its relative position using some further vision processing. Robots can also use geometry to match an object, or even a combination of both. The markers for the waypoints will be brightly colored objects, so your robots can also use geometry to match, or even a combination of both geometry and color. LabVIEW also has example programs to directly interface with the AXIS 206 IP Camera.
Fig 3. AXIS 206 Camera and sample object tracking algorithm screenshot
Suggested Project Timeline
Week 1: Establish connection with CompactRIO and motors.
Week 2: Connect and test Hokuyo LIDAR Sensor.
Week 3: Connect and test AXIS 206 Camera. Test vision algorithm.
Week 4: Fine-tuning navigation algorithm.
Week 5: Final debugging, field trials.
Reminders:
l Always back up your programs!
l Before you start programming, always draw out a flowchart for your logic.
l Be careful of short circuits and live wires. Double check all wiring before powering on!
l When you’re not sure about what a VI in LabVIEW does, remember to use the online help and Example Finder.
l Start early! Leave plenty of buffer time for experimentation.
Be safe, be smart, and have fun.
John Wu
National Instruments Taiwan
wei-han.wu@ni.com