Basic ROS for interfacing BLDC controller


(Simba) #1

hi guys,
this is my very first attempt for ROS.
i’ve googling alot and still have no idea how ROS talking to the controller.
so far as i found, there are only very few examples, such as roboteq. does it mean it’s the only way for me to go with ROS?

or someone know the clear idea?

i do have RS232 protocol and CANopen protocol, in PDF files. there are alot of commands either to query some information (motor speed, current, temperature, etc) as well as command to spin to motor.

but i don’t have any idea where i should start writing all those command so ROS can talk to the controller.

should i write a topic for each query and create node about controller? write each command in topic? or just copy roboteq driver and edit somewhere?

please kindly give me a clue to start.

cheap lidar has a ROS driver.
realsense has a ROS driver.
but i don’t know how to deal with controller.


#2

Hopefully some one who knows ROS a lot better than I do can give you better answers…

I am also not familiar with BLDC controller. Not sure if this is generic term or if you have a specific controller for your motors.

With some earlier wheeled robots I have from Lynxmotion and others. I used some motor controllers (roboclaw) by Basic Micro, who became IONMC, which now apears to have gone back to BasicMicro?

And I believe that there have been ROS drivers made for it? Example: https://github.com/sonyccd/roboclaw_ros

You also have the ability to simply create your own nodes who talk to your driver through Serial or the like and you then have the option to advertise whatever topics make sense or simply handle them all internal.

Hopefully one of the ROS people here can give you a lot better answer!


(Simba) #3

thx alot kurt :slight_smile:
yes, BLDC is common term for brushless DC.
basically i can send command using bash/shell to access serial port (e.g. ttyusb0) for writing (sending command) and reading.
just confusing where should i go or write all those commands.

so far as i know, each BLDC controller has their own command reference for serial. i may say, each factory has their command reference. so, i can’t simply use roboteq ROS driver for dealing with other brands.


#4

Again hopefully someone more ROS experienced will chime in!

As you mentioned BLDC is a generic term. As you mentioned the RobotEQ Ros driver is specific to their controllers.

However you can go to their Sources:

And get an idea of what it would take. That is they have code in place that defines some new messages, plus c++ code to talk to their boards. Again depending on how different your controller board is from theirs. You might be able to get some of yours working by simply changing the actual commands and responses that the board sends

Or if your board works more like the Roboclaw, you might look at the ROS driver done for it, which I posted in the earlier response.

Or again you could factor your code completely different. That is you could have a higher level node, maybe one for rover_controller, that maybe does the code that given some form of request, like maybe a new velocity, is responsible for telling your motors to do what is necessary and is also responsible for processing whatever feedback the controller provides (encoders? or the like) and then generate appropriate messages… Internal to that node you can talk to motors using your normal code (C++, Python, …)

An example of this, was code some hexapod robot code that uses Robotis servos,

where the main node, has the code in place to talk the servos. In his case he was using MX servos, where his main board talked to the servos using USB2AX board. I had versions of it that worked with AX12 servos also using USB2AX or Teensy boards or … Internal to that node we were using something like the standard DynamixelSDK (adapted to talk to /dev/ttyACM0 instead of the default /dev/ttyUSB0). Actually my fork of it tries both of these… Actually it first tries /dev/ttyDXL which I at times would setup using udev rules)… Sorry off topic.

The point is here he made the choice to simply encapsulate the motor controller code into his main node, as his code is tightly coupled to how he is talking to the servos…

Again hopefully you might find a driver specific to your setup.


(Simba) #5

thx kurt for pointing me out the correct path :heart_eyes:
now i have a clear idea what to do.

then it’s my best bet to go with serial to write all RS232 commands either for action or querying some information/status. this could be tough part as ROS robot is not as easy as just installing ubuntu and full blown ROS. but in somehow, this could be really fun and hot :laughing:

my setup will be very basic. only using these:

  • YDLidar F4, a cheap 2D lidar comes with ROS driver from EAI
  • Intel realsense R200, comes with ROS driver ofc. D415 is very interesting but it’s still too expensive for me coz i have decided to go with lidar. then i think i shouldn’t go with expensive RGBD camera for backup.
  • IMU USB stick. that’s handy. let’s see if this is serial also. no ROS driver ofc :rofl:
  • BLDC controller dual channel 30A, comes with PDF files about their commands for RS232 and CANbus. it’s not a big one coz i just need to control 200W motor, so the current of each of them will be at 10A rated. no driver at all but i can send command using bash, so, as your guide, let’s dive to some c++ for a bit
  • PC core i3 quad core 3.7GHz, 8GB RAM, and 256GB SSD
  • ubuntu 18.04 and i think i will go with kinetic and roboware as my first bet :smile:

thx, kurt :slight_smile: