Ask Your Question
0

Hardware Interface for Arduino

asked 2017-06-08 15:05:02 -0500

RandyD gravatar image

Hey,

Recently i started my own robot project to learn ROS, using Arduino. So far i just have a single Arduino + L289n dual h-bridge motor controller to power 2 DC motors

The initial setup of my project is based on the Husky project, so i have a base node containing a hardware_interface::RobotHW class that communicates with the Arduino. Using the teleop_twist_keyboard i'm able to move my robot. Currently this is done using a custom message, where the RobotHW is the advertiser and the Arduino the subscriber. But just driving the motors is far from enough. I'm using powerfull 24V DC motors salvaged from broken printers and big (heavy) wheels from an old RC car. Currently i'm running the motors are 12v, which seem to be enough to get the robot rolling, but it takes time to get up to speed cause of the big heavy wheels and they keep spinning once the wheel speed is set to 0.

To apply brake force to the wheels i need to reverse the motor power till the wheels stopped, so i got myself some motor encoders to measure the speed of the wheels. According to the hardware interface documentation and code i been checking to learn how it works, i need to read from the hardware, update the controller manager, then write to the hardware. So using ROS message system doesn't seem the correct way.

Been looking into using rosserial for c++ and using the Serial communication in the Arduino firmware instead of message advertisers/subscribers, but this require writing some custom protocol for messages between the hardware and the hardware interface node.

So before continuing writing a custom serial comm protocol, i wanted to know if this is the correct way to go, or if i should just use advertisers/subscribers to send custom messages between the hardware/ros node?

Full code of my project in the current state of using messages can be found here: https://github.com/DeborggraeveR/ampru

the ampru_base package, contains both the firmware and the hardware interface node.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-06-16 12:43:29 -0500

RandyD gravatar image

updated 2017-06-16 12:44:09 -0500

As there were no answers to my questions, i went forward with using a custom serial protocol instead of publish/subscribe topics to communicate between the hardware interface node and Arduino.

The protocol is based on HDLC and seems to work fine :) Code pushed to git repository.

edit flag offensive delete link more

Comments

Hi Randy, I'm new to roscontrol. Can I know what was the problem if you use public/subscribe to communicate between hardware interface node and Arduino.? Can't we subscribe to the joint values from Arduino and update control manager and then publish the new joint values to Arduino.?

Thank you :)

Sai Krishna gravatar image Sai Krishna  ( 2018-08-26 12:57:28 -0500 )edit

Hi Sai & Randy, I also wanted to know if we can work with publisher/subscriber instead of a custom protocol . Just wanted an opinion before I go forward with my method. Let me know. Thanx!

pranavb104 gravatar image pranavb104  ( 2018-12-13 00:42:44 -0500 )edit

Hi, i tested with publisher/subscriber on Arduino and it works fine, but my concern was that using it contains more code, while the programming memory on arduino is limited and there is more data going over the serial port.

RandyD gravatar image RandyD  ( 2018-12-14 04:08:00 -0500 )edit

Ah...makes sense....i also got it working anyway....thanx

pranavb104 gravatar image pranavb104  ( 2018-12-14 20:19:10 -0500 )edit

Hi Pranavb, Can I know your mail id. So that we can share our works. Mine is banda.saikrishna93@gmail.com .

Sai Krishna gravatar image Sai Krishna  ( 2018-12-14 23:47:14 -0500 )edit
pranavb104 gravatar image pranavb104  ( 2018-12-16 20:30:01 -0500 )edit

Share your code on github, might be useful to others as well ;)

RandyD gravatar image RandyD  ( 2018-12-17 00:01:24 -0500 )edit
pranavb104 gravatar image pranavb104  ( 2019-01-04 05:29:50 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-06-08 15:05:02 -0500

Seen: 1,187 times

Last updated: Jun 16 '17