How would you implement movement of a custom robot with drivers given?
I am new to ROS and I have ordered an Uctronics K7300 Raspberry Pi robot ( https://www.amazon.com/dp/B07FNJ14LY/... ) which will run the latest Raspbian and ROS Melodic. I plan on using this with an RPLIDAR A1 to make a tour robot. I don't have the parts yet, but I wanted to research ROS in the meantime. This robot was not made to work with ROS, but it comes with all the drivers needed to control it, which is written in C. In other words, I have the following functions available to me:
void go_left(void);
void go_right(void);
void go_forward_left(void);
void go_forward_right(void);
void go_back(void);
void go_back_left(void);
void go_back_right(void);
void stop(void);
My question is, how can I implement this into ROS so that when I use Rviz I can set a navigation goal on the map and it will have a way to move the robot to said goal?
Is that really the API you have available? Because
go_left(void)
seems like a rather useless function, unless the robot travels in a "grid" (ie: go left one cell).The nav-stack is not really made to work with such setups. It will work much better with robots that can actually be "steered" ..
.. (ie: go left by "4 degrees" this cycle).
It can probably be made to work (you'd probably need other planners), but it won't be optimal.
Yeah, this robot does not turn the front wheels, it just adjusts the motors to make a turn, so
go_left(void)
looks like this:That sounds like skid-steer, which is not uncommon, but can you vary the amount (ie: velocity) by which the motors run? So can
FORWARD
be a different value for instance?I see these three
#define
s, which I guess means pulse width modulation, but it is not used anywhere in the code. I feel like there has to be a way.If all else fails, buying another motor controller is always an option. Assuming I can adjust the speed, how would I proceed?
If we assume you have proper/some form of velocity control over your motors, then something like the diff_drive_controller configured for skid steer could be an option.
That would give you a ..
.. geometry_msgs/Twist interface that is standard across all ROS mobile bases for robots and is immediately compatible with things like the navigation stack and tele-operation packages.