On the smaller Arduinos with only 2kb RAM I've had trouble using rosserial because of the amount of RAM consumed, so I've abandoned that for ros_arduino_bridge. If you are using a motor driver not already supported by ros_arduino_bridge, you'll have to modify the code in a couple of places.
First, in ROSArduinoBridge.ino, look at this code (lines 48-64):
//#define USE_BASE // Enable the base controller code
#undef USE_BASE // Disable the base controller code
/* Define the motor controller and encoder library you are using */
#ifdef USE_BASE
/* The Pololu VNH5019 dual motor driver shield */
#define POLOLU_VNH5019
/* The Pololu MC33926 dual motor driver shield */
//#define POLOLU_MC33926
/* The RoboGaia encoder shield */
#define ROBOGAIA
/* Encoders directly attached to Arduino board */
//#define ARDUINO_ENC_COUNTER
#endif
You need to uncomment the definition of USE_BASE, comment out ROBOGAIA, and then add your own define for your motor controller, say #define RKI1340_MOTOR_CONTROLLER
.
Then, in motor_driver.ino, you'll need to add code to support that motor driver. The bottom of that file looks like this:
#else
#error A motor driver must be selected!
#endif
You'll need to add an #elif
before the #else
for RKI1340_MOTOR_CONTROLLER
, and add a definition of void setMotorSpeeds(int leftSpeed, int rightSpeed)
.
There are other changes required to support encoders different from the ones already coded. You might compare with the changes Marco Walther made to support the Pololu A-Star board with onboard motor driver. (I've contributed to his mods.)
https://github.com/mw46d/ros_arduino_bridge/tree/indigo-devel/ros_arduino_firmware/src/libraries/ROSArduinoBridge
Originally posted by Mark Rose with karma: 1563 on 2017-02-12
This answer was ACCEPTED on the original site
Post score: 1