Giter Club home page Giter Club logo

autorccar's People

Contributors

geek1111 avatar hamuchiwa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

autorccar's Issues

windows 7

will i be able to do the project using wondows 7?

Version OpenCV

Hello, what do you use version of opencv? And please share your schema for connections raspberry pi and arduino (sensors). Thank you so much. It”s most important version opencv.

Memory Error

Error Message:
File "C:\Python27\lib\site-packages\numpy\core\shape_base.py", line 234, in vstack
return _nx.concatenate([atleast_2d(_m) for _m in tup], 0)
MemoryError

what's wrong? Have you ever met this situation? What I should do? how do you control data size? thank you!

Issue with collect_training_data.py

Hi @hamuchiwa !

I've been trying to recreate your project and ran into a problem I was hoping you might be able to help me with. When I run the "collect_training_data.py" the line "cv2.imshow('image', image)" does not appear to do anything. It doesn't open a preview window at all and as a result, PyGame cannot capture any key entries either.

I've run the "stream_server_test.py" without any issue and the images from the RaspberryPi stream onto the PC, so it definitely isn't a connection issue.

Do you have any idea why this might be happening?

I'm using OpenCV 2.4.9 on Ubuntu 14.04

Thanks in advance! :)

What do we do with the streamed video from Python ?

Trying to be successful to get the streaming part correct for now.
I am using 'Motion' to stream from pi camera onto an ip address... now I changed the IP address(192.168.0.6:8081) in the 2 codes.. (stream_server_test.py which runs on laptop and stream_client.py which runs on RPi) I am getting errors on both the programs..

I want to know what software you used in Pi to stream on the IP address? I used Motion and it clearly doesn't work :( Please help
EDIT: I've spent atleast 5 days just trying to get stream working via python/OpenCV from my laptop..
tried using Gstreamer/ffmpeg/Motion.

Hi, I meet another problem but I can't solve this by self anymore:(

Hi, I meet another problem but I can't solve this by self anymore:(

in step7(last step), I mean that run 'rc_driver.py' in computer and run 'stream_client.py' and 'ultrasonic_client.py' in raspberry pi. the RCcar is moving well and the video scene show in my monitor. so connect works well between computer and raspberry pi. but when ultrasonic sensor sense below 30, the car doesn't stop and even 'Stop, obstacle in front' message doesn't show up. just distance message show up continuously. I guess that it doesn't run in class VideoStreamHandler in rc_driver.py. and I think that I maybe do run these three code wrong. when I run these three codes('rc_driver.py','stream_client.py',and 'ultrasonic_client.py', first, I run 'rc_driver.py' in computer in Pycharm. and then I run 'stream_client.py' on spe in raspberry pi. and I stop 'stream_client.py' code and then I run 'ultrasonic_client.py' code on spe in raspberry pi. I think these two codes in raspberry pi should run simultaneously but I don't know how to do that. anyway, could you teach me what's my problem and what I have to do?

thank you very much and have a nice day :)

Some questions about AutoCar

Read your AutoRCCar, I was interested, but would like to ask you some questions about your host computer what operating system? I'm under my windows host computer to compile and run the wrong side of the python, you are using what python editor? I am using pycharm. Looking forward to your reply

Pre-trained NN examples

Hello!

I'm working on porting this project completely to Raspberry pi. Can you provide pre-trained NN examples to allow me quickly evaluate performance on the Pi board? This will save me a lot of time because I have to use another approach to control RC car and getting training data for NN.

Some questions about the camera calibration

hi,man. Your project is awesome. I wanna make it by myself,but I have some problems on camera calibration.The "picam_calibration.py" should run on pi or computer? It seems to run on pi but u put it in the "computer" folder,that confuse me.Hoping ur reply.

Camera placement for distance measurement

Hey sir!

I have a question, does camera placement affect the distance calculated by raspberry pi? If yes, then how should I place the Camera to get accurate distance measurement.

Waiting for your response. Thank you so much.

Hi, I want to know how I can use traffic signal!

Hi, I bought the traffic signal on internet.
this consists of basic LED light (red, yellow, green)
but the camera can't recognize these lights.
this sometimes recognize red light.
I saw your videos many times and I guess that the problem is light spread but not exactly.
I want to buy same model you used but It's difficult to find it and get it.
maybe It's my last question.
How can I solve this problem?
image this is my traffic light !
Thank you :)
Merry christmas :))

pygame

Hello,
I have a question about pygame. Why did you use pygame in this project?

Understanding the MLP output & label format

Hi Hamuchiwa!

I've revisited this project in my quest to better understand machine learning and I have a question regarding the output format.

In the project, you use a 1x4 array to determine what action the car should do. Is there a reason this can't instead be one value with a range from 0 to 3 instead?
Does the output have to be between 0 and 1?

Using the same code for the neural network as yours, if the input labels had arrays which had elements ranging from 0 to 100 (for example) to indicate turn angle and drive speed (assuming we have a car which has variable turn/speed) would the code still work? (assuming the dimensions of the array holding the labels is still 1x4)

Thanks again for this great project and all the help!

RC Car Control Unit

what type of on/off switch type controller do you use? our remoter controller use tactile switch.
but it seems the arduino is not able to control the tactile switch directly. we have to use 4n35 to replace the ticticle switch, but it cause other issues (maybe drain too much power from arduino )....

Error when running mlp_predict_test.py

Hi @hamuchiwa
I've adapted the project to use RaspberryPi/PCA9685/Websocket instead of RCCar/Arduino/Serial and it's working great. I've just trained the model with mlp_training.py, but when I try mlp_predict_test.py it produces the following error:

...I don't see a reason for the error (same dimension arrays and float numbers...)


$python mlp_predict_test.py
(0, 38400)
(0, 4)
OpenCV Error: Bad argument (Both input and output must be floating-point matrices of the same type and have the same number of rows) in predict, file /tmp/opencv-20170224-1869-10nlf6f/opencv-2.4.13.2/modules/ml/src/ann_mlp.cpp, line 279
Traceback (most recent call last):
File "mlp_predict_test.py", line 36, in
ret, resp = model.predict(test)
cv2.error: /tmp/opencv-20170224-1869-10nlf6f/opencv-2.4.13.2/modules/ml/src/ann_mlp.cpp:279: error: (-5) Both input and output must be floating-point matrices of the same type and have the same number of rows in function predict

The training results follow:

$ python mlp_training.py
Loading training data...
['train_labels', 'train']
(26, 38400)
(26, 4)
(26, 38400)
(26, 4)
Loading image duration: 0.034844063
Training MLP ...
Training duration: 28.552917344
Ran for 249 iterations
Prediction: [2 2 2 0 0 0 0 0 2 0 0 2 0 2 1 2 2 2 2 2 2 2 2 2 2 2]
True labels: [2 0 2 0 0 0 0 2 2 0 0 2 0 2 0 2 2 2 2 2 2 2 2 2 2 2]
Testing...
Train rate: 88.461538:

Few questions about server and white lines and camera

Hello,

I kinda want to make the same project, so I have a few questions about it:
About the wifi-connection you use between the raspberry pi and your PC: Do you make from your raspberry pi an accespoint and then connect to it via your computer?

And is it possible to do it without a server? So just a raspberry pi for camera and sensor and an arduino to control the motors. Or don't you recommend this?

I can't find the code where you analyse the stream and say to your car to stay between the white lines.

Do you need to calibrate your camera everytime you start up your picamera?

Thanks in advance!

Regards,
OwhPUS

Error in `mlp_training.py`

Hi, @hamuchiwa
After running mlp_training.py it shows an error...

Loading training data...
(0, 38400)
(0, 4)
Loading image duration: 0.017612816
Training MLP ...

Traceback (most recent call last):
  File "/home/pi/CAR/computer/mlp_training.py", line 49, in <module>
    num_iter = model.train( train, train_labels, None, params = params)
error: /home/pi/opencv/modules/ml/src/ann_mlp.cpp:690: error: (-5) input training data should be a floating-point matrix withthe number of rows equal to the number of training samples and the number of columns equal to the size of 0-th (input) layer in function CvANN_MLP::prepare_to_train

>>> 

i would like to know which version of OpenCV you're using....because some months before this code were working perfectly! unfortunately that whole data was lost so i have installed latest dependencies.....

Writing 1,800 jpeg images of streamed video in 1 minute ? and other questions..

import numpy as np
import cv2
import socket


class VideoStreamingTest(object):
    def __init__(self):
        
        # self.server_socket = socket.socket()
        # self.server_socket.bind(('192.168.0.6', 8081))
        # self.server_socket.listen(0)
        # self.connection, self.client_address = self.server_socket.accept()
        # self.connection = self.connection.makefile('rb')
        # self.streaming()
        # self.socket.connect(('192.168.0.6', 8081))
        
        self.socket = socket.socket()
        self.connection = self.socket.connect(('192.168.0.6', 8081))
        self.streaming()

    def streaming(self):

        try:
            #print ("Connection from: ", self.client_address)
            print ("Streaming...")
            print ("Press 'q' to exit")
            frame = 0
            stream_bytes = b' '
            while True:
                
                stream_bytes += self.socket.recv(1024)
                first = stream_bytes.find(b'\xff\xd8')
                last = stream_bytes.find(b'\xff\xd9')
                if first != -1 and last != -1:
                    jpg = stream_bytes[first:last + 2]
                    stream_bytes = stream_bytes[last + 2:]
                    # Grayscale image
                    #image = cv2.imdecode(np.fromstring(jpg, dtype=np.uint8), cv2.IMREAD_GRAYSCALE)
                    # Color image
                    image = cv2.imdecode(np.fromstring(jpg, dtype=np.uint8), cv2.IMREAD_COLOR)
                    # To write/save the frames
                    # cv2.imwrite("stream_images/frame_%d.jpg" % count, image)
                    cv2.imwrite('stream_images/frame{:>05}.jpg'.format(frame), image)
                    
                    cv2.imshow('image', image)
                    
                    frame += 1
                    
                    if cv2.waitKey(1) & 0xFF == ord('q'):
                        break
        finally:
            #self.connection.close()
            self.socket.close()

if __name__ == '__main__':
    VideoStreamingTest()

Thats the code im using.... now I'm able to have 1800 images(frames) saved in 1 minute, is this correct? everytime I run the program I over write them, is that correct as well?

I got a error. Please help!

Hi I try to run picam_Calibration and I got the follow error. Please do you know how I can fix this?

cd '/Users/bas/Desktop/' && '/usr/local/bin/pythonw' '/Users/bas/Desktop/picam_calibratio.py' && echo Exit status: $? && exit 1
imac:~ bas$ cd '/Users/bas/Desktop/' && '/usr/local/bin/pythonw' '/Users/bas/Desktop/picam_calibratio.py' && echo Exit status: $? && exit 1
OpenCV Error: Assertion failed (nimages > 0) in calibrateCamera, file /Users/bas/opencv/modules/calib3d/src/calibration.cpp, line 3357
Traceback (most recent call last):
File "/Users/bas/Desktop/picam_calibratio.py", line 47, in
retval, cameraMatrix, distCoeffs, rvecs, tvecs = cv2.calibrateCamera(object_points, image_points, (w, h), None, None)
cv2.error: /Users/bas/opencv/modules/calib3d/src/calibration.cpp:3357: error: (-215) nimages > 0 in function calibrateCamera

Questions about implementing this into a single board

Hello,
So at my school, we want to build a simular car. I wanted to make up the whole code from 0 in Java, but luckily i found your project.
So i've got a few questions about the title, but let me introduce my surrodings.

I've got the latest (3 B) Raspberry PI, and the v2 Pi Camera (8MP, if i remember right), with all the neccessary components (ultrasonic, etc). It came to my mind, that you're using Arduino, to control the RC Transmitter. Lucily, we havent got a transmitter, and we had to solder jumper wires to the actual IC in order control the car. So in that setup, we had the pi connected to ardunio via USB, running all the 3 programs at once to make up everything. So it came to my mind that we could avoid arduino because the Pi had an actual GPIO as the same as Arduino does.

So i modified your code just a littlebit, adding the GPIO library to the rc_drive, and modify the serial send to smth like that: GPIO.output(GPIO_FORWARD, True).

Unfortunately, i couldnt test it till next Wednesday, but besides that, what do you think about this setup? Do you think that this could handle all the 3 programs at once? (+ a VNC server to see the camera pic)

hi i have a question about this! :)

Hi! I wanna really make this RC car by myself so now I'm doing my best for self satisfaction, everything is fine including setting hardware but I have a problem with installing Opencv. now my laptop is Mac and I installed Opencv using Pycharm project interpreter. but the problem is that when I'm trying to running 'picam_calibration.py', there is error like this 'OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvShowImage, file /Users/travis/build/skvark/opencv-'python/opencv/modules/highgui/src/window.cpp, line 545" so, I wanna know how do you install opencv in mac. I tried to search google and try it, but I couldn't .
sincerely thank you and have a nice day!

RC Car Speed Control

@hamuchiwa Firstly, great work with the project and on the extensive documentation you have provided. I am making a similar project taking inspiration from your work. I have managed to successfully collect training data and train my network weights. But, when I let the car run for itself, its moving too quickly (i.e. its got too much speed) and ends up moving out of the track before its got a chance to correct itself Did you face a similar problem? If so, how did you slow down the car. I see from your video that your car is moving in a more slow and controlled manner. I'm failing to achieve that with my car. Any pointers or advice would be very helpful

Furthermore, from my NN training (of layers 38400, 32, 1) I get a train error % ~ 2% and test set error % ~ 15%. Could it be that my network isn't generalising very well? I may have to move the sides of the road a bit closer since they are a bit widely spread at the moment?

Error in "stream_server_test.py"and "collect_training_data.py"

Hello...
Sir first i run "stream_server_test.py" on laptop and then "stream_client.py" on raspberry.It shows:
"connection from:
Streaming. . .
press 'q' to exit"
and soon error occurs
"AttributeError: 'module' object has no attribute 'CV_LOAD_IMAGE_UNCHANGED' "
and when i run "collect_training_data.py" and then "stream_client.py"...It show:
collecting images. . .
and the same above AttributeError occurs again.
I've done everything in the same manner as you said so where is the issue??how to solve it??

Delay Response of Arduino to control motors Plz Help

I am using arduino and motor driver l238N , while executing collect training data file i am facing problem of delay response from arduino. The lights of arduino TX/RX are on continuously while executing code. Motors are moving about after 5 to 8 seconds of key press. please help me as quick as possilble.. thank you in advance @hamuchiwa

why not to use Raspberry Pi only?

Why You divide software to three platforms?
Raspberry can drive RC panel like an arduino.
Raspberry can run AI with native video/sonar calc too - no ext streaming.
Is this question of general Raspberry processor speed?

Getting error in ULTRASONIC_CLINT.py

Traceback (most recent call last):
File "/home/pi/Downloads/AutoRCCar-master/raspberryPi/ultrasonic_client.py", line 52, in
distance = measure()
File "/home/pi/Downloads/AutoRCCar-master/raspberryPi/ultrasonic_client.py", line 31, in measure
elapsed = stop-start
UnboundLocalError: local variable 'stop' referenced before assignment

Issue with mlp_predict_test.py

After running the code, I am getting Following error...

C:\Python27\python.exe E:/Downloads/Compressed/AutoRCCar-master/computer/mlp_predict_test.py
(0L, 38400L)
(0L, 4L)
OpenCV Error: Bad argument (Both input and output must be floating-point matrices of the same type and have the same number of rows) in CvANN_MLP::predict, file ........\opencv\modules\ml\src\ann_mlp.cpp, line 279
Traceback (most recent call last):
File "E:/Downloads/Compressed/AutoRCCar-master/computer/mlp_predict_test.py", line 36, in
ret, resp = model.predict(test)
cv2.error: ........\opencv\modules\ml\src\ann_mlp.cpp:279: error: (-5) Both input and output must be floating-point matrices of the same type and have the same number of rows in function CvANN_MLP::predict

Hi! I have a some questions

Hi, I am very impressed with your project. So I am also trying your project.
There are some questions.

  1. In my view, your RCCar system seems to give RaspberryPi and Arduino each command on the computer. Is RaspberryPi sending ultrasound sensor and image information to computer, Computer telling Arduino according to the received information and Arduino controlling RCCar through remote control?

  2. If the first question is correct, I control four DC motors with my RCCar motor as the motor driver (motor-motor driver-Arduino). So my Arduino should be attached to my RC car. In this case, do I have to connect to my computer using the Bluetooth module? Or do I have to issue commands in serial communication with RaspberryPi?

  3. After finishing the neural network learning on the practice track, should I study again when driving to the practice track in another place?

I will be waiting for your answer.

P.S. The sentence may be awkward because it was a question by a translate.

cv2.imshow does nothing

Hi! Im having a problem with collect_training_data.py, I can't see the camera window on my computer. Im able to hook up the raspberry pi with sockets, images also save to the the correct folder. However, cv2.imshow('image', image) doesn't seem to work. The python logo just bounces on OS X but the imshow window doesn't show. Any ideas!?
screen shot 2017-04-25 at 18 36 27

Problem in "stream_server_test.py"

After running "stream_server_test.py" in python 2.7.9 , it shows following errors
is there problem in my python packages ? or which python version should i install to run this code?
"/usr/lib/python2.7/socket.py", line 228, in meth return getattr(self._sock,name)(*args)

this errors shows when i try to run
/AutoCar/test$ python stream_server_test.py Traceback (most recent call last): File "stream_server_test.py", line 44, in <module> VideoStreamingTest() File "stream_server_test.py", line 12, in __init__ self.server_socket.bind(('192.168.1.100', 8000)) File "/usr/lib/python2.7/socket.py", line 228, in meth return getattr(self._sock,name)(*args) socket.error: [Errno 99] Cannot assign requested address

rc/arduino

thank you so much for this great project
my issue is how to connect the rc with the arduino, I need four pins is that correct ?
I'd be grateful is you tell me how to connect them withe rc

Error in collect_training_data.py "training_data_temp" no such file and directory

Hello sir

I am facing another issue, when i run collect_training_data,py, an error occurred which says: there is no such file or directory like training_data_temp/test08, and this file doesn't even exist in your repository too. Therefore i created this files, by opening up pycharmprojects in my PC and creating a new folder in a required place then again opened the project in pycharm from PC. This actually removed my error,
and i could see on the left most side that the created folder was storing the data in npz format.

error_2

I want to ask, if this is the correct way to create a file? or the following error in mlp_training.py is because of this problem?

line49 num_iter = model.train(train, train_labels, None, params = params)
Error cv2.error: ........\opencv\modules\ml\src\ann_mlp.cpp:690: error: (-5) input training data should be a floating-point matrix withthe number of rows equal to the number of training samples and the number of columns equal to the size of 0-th (input) layer in function CvANN_MLP::prepare_to_train

Thank you sir
For your kind response

Emma Rosa

Syntax error in mlp.training

Hello sir

I am working on your project but i am new to python, and it is really great to have your codes and they are quite helpful. Sir, i am facing a syntax error while running mlp.training.

e2 = cv2.getTickCount
SyntaxError : invalid syntax

I am also attaching the snap, It would be nice to have your guidance and suggestion in this regard.

Thank you so much
Emma Rosa

Some question about the speed of car

請問作者 你有調整遙控車的速度嗎?
我目前在做training
可是車子速度太快 一直駛出白紙跑道 無法training完成
我想把車子速度調慢 有什麼方法嗎?

Hi, I have a question about how to drive this car in“collect_training_data.py” part:

Hi, I always appreciate for you answer!
Now, I don't have problem in coding and server. everything works well.
but when I run 'rc_driver.py', the car runs only left and straight even if I set up the car in "collect_tarining_data.py" and "stream_client.py" along the path that I set up totally.
so I suddenly wonder if maybe I train this car wrong method.
now, I just press key in path in 'rc_driver.py' expecting that this car will act same in the same location in 'rc_driver.py'
How can I solve this problem?

W jaki sposób nauczyć haara?

Twój kod nie zawiera żadnych obrazów, czy jest mozliwosc zrobienia minimalnego Makefile z przykładowymi danymi? Nie udaje mi się uruchomic programu do nauki w OpenCV

Tree Classifier
Stage
+---+
| 0|
+---+

Number of features used : 125199

Parent node: NULL

*** 1 cluster ***
POS: 12 12 1.000000
Invalid background description file.
opencv_haartraining: /builddir/build/BUILD/opencv-2.4.12.3/apps/haartraining/cvhaartraining.cpp:1393: void icvGetNextFromBackgroundData(CvBackgroundData*, CvBackgroundReader*): Assertion `0' failed.
./zz2a.sh: linia 10: 3898 Aborted (zrzut pamięci) opencv_haartraining -data hdgh -vec przyklady.txt -bg negatywne.txt -nstages 2 -nsplits 2 -minhitrate 0.01 -maxfalsealarm 0.999 -npos 12 -nneg 4 -w 20 -h 20 -nonsym -mem 1024 -mode ALL -minpos 10

mógłbys mi jakos pomóc?

Stream.client.py / stream_server_test.py connection issue

After uploading the correct files and connecting the PI and PC to the same I.P. I am getting the following error:

runfile('C:/Users/bsimmons/Stream_test.py', wdir='C:/Users/bsimmons')
Connection from: ('192.168.43.130', 56770)
Streaming...
Press 'q' to exit
Traceback (most recent call last):

File "", line 1, in
runfile('C:/Users/bsimmons/Stream_test.py', wdir='C:/Users/bsimmons')

File "C:/Users/bsimmons/Anaconda3/envs/virtual_platform/lib/site-packages/spyder/utils/site/sitecustomize.py", line 710, in runfile
execfile(filename, namespace)

File "C:/Users/bsimmons/Anaconda3/envs/virtual_platform/lib/site-packages/spyder/utils/site/sitecustomize.py", line 101, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/bsimmons/Stream_test.py", line 44, in
VideoStreamingTest()

File "C:/Users/bsimmons/Stream_test.py", line 16, in init
self.streaming()

File "C:/Users/bsimmons/Stream_test.py", line 27, in streaming
stream_bytes += self.connection.read(1024)

TypeError: Can't convert 'bytes' object to str implicitly

Differential Motor rather than RC Car

I am trying to get this working using a simple robot that is using two DC motors, rather than an RC car.

I have created a websocket library that controls the robot - it listens for "0" Left, "1" Right, "2" Forward, etc and I have modified the collect, rc_driver scripts to send the control signals to the websocket service.

It all works great - I can test the driving using the test_rc script, I can collect data - all good. I run the training data and get good figures (90% and 74% accuracy). However, when I then go and run the rc_driver script, it all goes very wrong.

The robot appears to drive very randomly.

Things I have tried:

a) reset and re calibrated the camera using my chessboard printout
b) removed and retrained data, positioning the camera in different view points
c) tweaked the robot movement scripts

All these have failed, so I wanted to ask whether there are any points on how to troubleshoot the actual autonomous driving part of the script. Any guidance greatly appreciated.

What RC cars are people using?

Not really an issue, but I have got everything working in this project but I am struggling with one thing. The car will not move!!

It looks like it is down to weight / poor choice in RC car.

I have tried pairing down, and am just waiting for the PiZero motor hat before I swap from Pi3 to PiZero, but suspect that it will still be too much weight.

So what are other people using? I might need to go out and buy something more powerful.

Understanding RC_Driver and thinking behind your approach.

Thank you for this fantastic project, I've been working to replicate something similar and add addition functionality and have been learning supervised machine learning on the go.

Just to test my understanding.

  1. so we've collected our data (frames and assigned them keyboard inputs)
  2. we reshape and process this data into our neural net
  3. the neural is trained to make predictions and outputs 1 2 3 for driving and steering.

Coud you explain this part of the code
I'm not clear on how the .getTickCount() is used to generate predictions from the MLP.

create MLP

layer_sizes = np.int32([38400, 32, 4])
model = cv2.ANN_MLP()
model.create(layer_sizes)
model.load('mlp_xml/mlp.xml')

generate predictions

e0 = cv2.getTickCount()
ret, resp = model.predict(test)
prediction = resp.argmax(-1)
e00 = cv2.getTickCount()
time0 = (e00 - e0)/cv2.getTickFrequency()
print 'Prediction time per frame:', time0/(test.shape[0])`

On the actual RC_Driver.py file

I want to understand your approach on how you were able to use the trained MLP to drive the vehicle.
if i put this this trained model onto a new track how does it different a left tun from a right turn?
My understanding it the model has been trained to look at each frame and predict forward left or right based on the frame it sees.

I'd like to understand how your thinking how you added the stop sign classifiers to an already trained neural net.

Thanks for your time !
James

Question about cascade xml for stop sign

Hi, i have question about stop_sign.xml. I work on some project where i have sign on road and my robot must recognise them and does some operation, for example stop for 5 second, or 3 second etc... I tried to parse your stop_sign.xml in python but i can't do that. Where i can find clasificator for sign or how python can load them? Thanks in advence

please help!!

hi
i just keep having this error whenever i run "stream_server_test.py" it shows me this error

" Traceback (most recent call last):
File "C:\Users\Suzy\Desktop\AutoRCCar-master\test\stream_server_test.py", line 44, in
VideoStreamingTest()
File "C:\Users\Suzy\Desktop\AutoRCCar-master\test\stream_server_test.py", line 12, in init
self.server_socket.bind(('192.168.1.24',5400))
File "C:\Python27\lib\socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
error: [Errno 10049] The requested address is not valid in its context "
and i'm using windows 8.1 and my local address is 192.168.1.x just like the one in the code
what's the proplem?!

problem in streaming

hamuchiwa
I have install the python picam library on my rasp pi and that module is working on my VNC viewer but I dont know whts causing the errror while I am running stream_client_test.py on vnc and same with the server code.

Is there require any kind of configuration in pycharm or something else is causing the error.
Following are the errors

While running stream_client_test.py using VNC viewer

Traceback (most recent call last):
File "/home/pi/Desktop/raspberryPi/stream_client.py", line 19, in
client_socket.connect(('192.168.2.11', 8000))
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused

While running server test .py on laptop

File "C:/Users/USER/PycharmProjects/AutoRCCar-master/test/stream_server_test.py", line 44, in
VideoStreamingTest()
File "C:/Users/USER/PycharmProjects/AutoRCCar-master/test/stream_server_test.py", line 12, in init
self.server_socket.bind(('192.168.2.11', 8000))
File "C:\Python27\lib\socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 10049] The requested address is not valid in its context

Process finished with exit
Please reply soon

mlp_training.py not working

Dear Author,

your code in mlp_training.py:

model = cv2.ANN_MLP()
model.create(layer_sizes)
criteria = (cv2.TERM_CRITERIA_COUNT | cv2.TERM_CRITERIA_EPS, 500, 0.0001)
criteria2 = (cv2.TERM_CRITERIA_COUNT, 100, 0.001)
params = dict(term_crit = criteria,
train_method = cv2.ANN_MLP_TRAIN_PARAMS_BACKPROP,
bp_dw_scale = 0.001,
bp_moment_scale = 0.0 )

print 'Training MLP ...'
num_iter = model.train(train, train_labels, None, params = params)

But it cannot work.

Then, I have modified as following:

model = cv2.ml.ANN_MLP_create()
model.setLayerSizes(layer_sizes)
model.setTrainMethod(cv2.ml.ANN_MLP_BACKPROP)
model.setBackpropMomentumScale(0.0)
model.setBackpropWeightScale(0.001)
model.setTermCriteria((cv2.TERM_CRITERIA_COUNT, 20, 0.01))
model.setActivationFunction(cv2.ml.ANN_MLP_SIGMOID_SYM, 2, 1)

print 'Training MLP ...'
num_iter = model.train(train, cv2.ml.COL_SAMPLE, train_labels)

It can create the model, but there is an error about the last line of the above code.

num_iter = model.train(train, cv2.ml.COL_SAMPLE, train_labels)

do yo have any solutions???

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.