Nowadays ROS - Robot Operating System is one of the essential robotic development platforms in the industry. The Roboteq is now finally coming up with ROS compatible Roboteq Motor Controller Driver for their users and also for the very huge and active ROS community. To provide the best from all is always the motto for the Roboteq Team and after lots of efforts and research, we have tried to make this driver as fast and simple as possible.
These few paragraphs are for the users who are new to this platform and for experts we suggest you to go directly to our GitHub page for driver source code. ROS is a very structured platform like other operating systems. Its file system has sub-systems like meta-packages, packages, messages, services. The Roboteq driver creates the package with all kinds of application-based features in it. This roboteq driver package has the following folders and files"
Driver File Structure
Fast & Flexible
This Roboteq ROS driver publishes important properties of the motor and controller status like Voltage applied at controller, current consumption by Motors, Temperature of MCU, Encoder counter, Analog input, Sensor speed feedback in RPM, fault flags, etc. The users can also add parameters that are essential in their application.
- Fast - There is a CPP file in the SRC folder - roboteq_motor_controller_driver.cpp, which has some strings in it with 8-10 parameters and frequency. Here the frequency is how fast the controller outputting those parameters to serial communication. The users can change that frequency as per their requirements. The previous ROS drivers were running microbasic scripts to get this output (published topic), but with this new driver you don’t have to create microbasic scripting to print out the parameters you want. The controller communicates very fast with only one string method.
- Flexible - Sometimes MCU temperature or voltage values are not very critical to the system and you don’t want to overload MCU with lots of data. In this driver, you can determine different frequencies to prioritize the parameters. I.e. you can keep high frequency for crucial parameters like fault flags, motor amps and low frequency for temperature.
In ROS, communication is mainly done by topics, services, and actions. The ROS users are recommended to refer to the ROS-wiki page for a detailed explanation. The topics are published and subscribed by Publishers and Subscribers respectively. The topics contain different types of data of the robots and those data are processed within nodes. In Roboteq Driver some of the essential topics are already published and subscribed by the drivers, which makes mobile-robot applications very simple. The users with mobile robots can directly start their experiment without any changes in Driver.
- /include - All header files are stored in this folder. If users are adding more functionality then they are advised to change these header files, too. The header files define the ROS features like publisher, subscriber, services, and functions.
- Src - This folder contains all source files written in C++ for this driver. The initialization, publisher-subscriber topics, serial communication, and ROS master connection is written here.
- Srv - This folder defines the service files and request, response variables. The same way users can also create a msg folder for message declaration.
- CMakeLists.txt - It is the CMake build file of the package. The users should edit these files when they are adding some files in Driver.
- Package.xml - It is a package manifest file for the package and changes are done the same as CMake.
- Launch - All launch files are stored in this folder. The nodes for different applications are launched by these files. To run Roboteq drivers then just launch this file in the Linux terminal screen and the driver will be activated.
This driver will help users to simulate their robot in some simulation programs as it has already configured odometry and cmd_vel topics. It also has some inbuilt service servers and clients for Roboteq queries, configuration, and commands. You can directly change some values with these services. Please follow the steps written on the GitHub page. For the users who are new to ROS - The services are just another way to communicate within nodes like topics. The service can be divided into two parts - 1) service server and 2) service client. The service client sends requests and the server gives the proper response with the help of the node and its function. The server contains callback which deals with the service request and it also advertises the service to the system. So users can access those servers by giving local proxy with the help of the client. You can verify that by checking the response of the server and client.
- The result - The publisher publishes different user-defined data on this topic. By default there are 8 motor data published in result topic with high and low frequency.
- Users can change these 8 parameters as per their application requirements. The frequency and queries can be changed from the config file of the driver as shown in this picture.
- ~catkin_ws/ src/ roboteq_motor_controller_driver/ config/ query.yaml
The odometry publisher - This driver publishes odometry values to the odom topic. It is very important for mobile robot simulation.
- The subscriber to cmd_vel - The users can use different nodes to publish the cmd_vel topic and the controller will subscribe to it for motor commands. The users can start with teleop_keyboard to check how this subscriber works.
- Open another terminal and run teleop keyboard node.
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
Here driver is subscribing to cmd_vel topic and teleop keyboard is publishing data into cmd_vel topic. Whenever user will give command from keyboard then motor will move by that value.
- Config_srv service allows users to change some configuration parameters with request and response structure of service. If users want to change the operating mode of the system then they need to call the client and add appropriate commands for it. Refer to the user manual for that. The operating mode command is MMOD, so call config client and in arguments write [MMOD] [ ] [channel number] [ ] [value].
- To run service client for these services - Open a new terminal and call client
rosrun roboteq_motor_controller_driver config_client.cpp
Snippet - client for service
- Command_srv service will give commands to system on the fly. It works the same way like config service. The users can refer to the user manual and windows API header file to get more details about the available commands and roboteq command for it. To give motor command in open-loop - call command client and add this in arguments - [G] [ ] [channel number] [ ] [value].
- Query_srv service is for getting output or query from the running system. Just like other services, the structure will be the same here. The list of query commands is in our User Manual. For example, If you want to query fault flags then call query client and add these arguments - [FF].