mega_base.ino is for mega board.
vnh5019_left.ino is for the motor controller board which has "L" label.
vnh5019_right.ino is for the motor controller board which has "R" label.
Please select Arduino Pro Mini when uploading codes for the motor controller boards.
Current sense in A0: 5V / 1024 ADC counts / 144 mV per A = 34 mA per count
Add this line in setup()
TCCR0B = TCCR0B & B11111000 | B00000010; // set timer 0 divisor to 8 for PWM frequency of 7812.50 Hz
Overwrite wiring.c in:
~/arduino-1.6.5/hardware/arduino/avr/cores/arduino
Modify:
#define MICROSECONDS_PER_TIMER0_OVERFLOW (clockCyclesToMicroseconds(64 * 256))
To:
#define MICROSECONDS_PER_TIMER0_OVERFLOW (clockCyclesToMicroseconds(8 * 256))
This wiring.c is only for motor control board, make sure to use original wiring.c when programming Mega 2560.
The Arduino uses Timer 0 internally for the millis() and delay() functions, so be warned that changing the frequency of this timer will cause those functions to be erroneous.
The frequency should, if possible, avoid the audio spectrum: below 20 Hz (not a good idea except for really massive motors) or above 20 KHz, so that the magnetostrictive vibration in windings or sympathetic vibration in the mechanical rotor, will not be heard by humans.
http://wiki.ros.org/ROS/Tutorials
$ git clone https://github.com/piliwilliam0306/andbot_base.git
$ cp -r src/ ~/catkin_ws/
$ cd ~/catkin_ws
$ catkin_make
$ roslaunch andbot andbot.launch
$ echo "ROS_MASTER_URI=http://"MASTER_IP":11311" >> ~/.bashrc
$ rosrun rviz rviz -d ~/catkin_ws/src/banana.rviz
$ sudo apt-get install ros-indigo-turtlebot-teleop
- $ roscd turtlebot_teleop/launch
- $ vi keyboard_teleop.launch
- modify the following line
- "remap from ="turtlebot_teleop_keyboard/cmd_vel" to="andbot/cmd_vel"/"
- $ roslaunch turtlebot_teleop keyboard_teleop.launch
https://arduino-info.wikispaces.com/Arduino-PWM-Frequency