-
Notifications
You must be signed in to change notification settings - Fork 3
Running Discovery Board with Panda Board
Hey Everyone,
I've now uploaded the code for the full communication between Discovery and Panda board, it is about 90% complete, as the only fix left to be added is the Speed Controller.
The following are the steps that you need to follow in order to be able to run both boards:
-
This is important, make sure that you do these steps with your group's Hardware/Middleware people, as they somewhat understand what's going in the Discovery Board's Ghetto.
-
Connect your Discovery Board and Panda Boards, preferably with both power and data USB connectors.
-
Create your group's folder from the project template (See "OpenDaVINCI msv getting started" steps, 8, 9, 10 and 11).
-
In Driver.cpp, ALWAYS set the speed of the car to 0, the speed of the car isn't mapped yet, so for now we're using hard-coded speed.
vc.setSpeed(0)
-
Compile and upload the STM folder's code into the discovery board (See "STM32F4 Discovery Board Getting started").
-
Cross compile your OpenDavinci code into the the Panda Board (See "Cross compiling for PandaBoard").
-
Run a test to see if the car works as it should:
a. First run "supercomponent", frequency is up to you to decide. b. Run "STM32F4Tester", Frequency should be at least 10, if you want faster action, increase the freq.
The car's wheels should now move all the way to the right, then back all the way to the left (Exactly like i had it work in the presentation), if you have the motor on, the car's wheels should spin somewhat depending on your battery.
-
Run your code for OpenDavinci as follow:
a. First run "supercomponent", frequency is up to you to decide. b. Run the proxy "ProxySTM32F4" to start the communication between both boards, frequency at least 10. b. Run "Lanedetector" to start your camera. d. Run "Driver"
You now have the basics of the car running, you can run other components as well (if you have any), but make sure that step A and B are executed first.
Speed Of The Car
The speed of the car is currently not mapped, for reasons I've mentioned in the final presentation, so we've hard-coded a speed that should run the car at a relatively slow speed. If you run the car and you find out that the hard-coded speed is too slow or too fast, then do the following:
Direct to the DiscoveryBoard's folder:
cd sources/STM32F4/embedded/ChibiOS/DiscoveryBoad
Open Main.c and at line "94" you can find the setMotorData function where we're setting the speed/steeering of the car:
setMotorData(-(steering-28),1500);
1500 should be relatively slow but that's dependent on the car, its battery, its weight, and other factors.
Change 1500, to a value close by, like 1600 or 1400, then compile the STM code and upload it into discovery board and run the motor, you'll see a difference in the car's speed.
Keep changing that value until you find a speed that works for you.
Sorry but this is the only way you can run the motor right now until we figure out an alternative solution.
Note: If you don't like this whole mess, you can simply move your car with your (RC Controller), and let lane-detection take care of steernig your car.
Steering of the Car
You can steer the car between (-28 steering all the way to the left) and (28 steering all the way to the right), 0 should put the car's wheels in the middle (straight).
Some cars have special servos that require a little push to steer properly, if you set the steering to 0, and the car's wheels aren't straight, or if you run the test mentioned above, and your car doesn't steer left and right properly, then know that your car is one of those, to fix that do the following:
Navigate to the msv folder
cd sources/STM32F4/embedded/ChibiOS/DiscoveryBoad/msv/src
open motor.c
At line "6" you'll see a line,
#define steeringDefault 1450
1450 should make the car's wheels in the middle (This works for most of the cars), but for your car, you'll have to increase that value somewhat, for example (Group 1's) car had to set that value to (1780), so keep changing that value, then compile and run, until you see that your wheels are in the middle and that should fix it.
I really hope you won't have any problems running this, it's fairly easy once you understand it well (guess that's true for just about anything), but if you do have problems, contact me or Christian by mail and we'll help as much as possible.
With My Best Regards, Husam.