ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Tank Steering Algorithm in ROS

asked 2016-02-16 02:42:09 -0500

Marcus Barnet gravatar image

Hi to all,

I'm trying to write a ROS node for my mobile robot which is based on a skid-steering system. I have two motors, one per each side, and each motor can be controlled by using A C/C++ function:

int motor_cmd(MOTOR_channel, VALUE);

where motor_channel is used to choose the motor to control and VALUE is an integer with a range (-100, 0, +100). Values 0, +100 make the motor spin forward while 0, -100 make the robot spin backward.

I would like to use a bluetooth joypad and write a teleop node to control the robot. The problem is that I'm not able to figure out how to implement the skid steering motion.

What kind of relation should I write to use the X-Y values which come from the joypad as parameter for my motor_cmd() function?

I mean, if for example I use the joypad to go forward, then X=0, Y=MAX_VALUE and then the function should be: motor_cmd(1, 100); motor_cmd(2, 100); Or if I turn on the spot and so X = MAX_value, Y = - MAX_value, then: motor_cmd(1, 100); motor_cmd(2, -100);

How can I implement this algorithm? Can you help me, please?

Thank you!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-02-16 03:39:17 -0500

One very simple implementation of what you're interested in is available here:

  • updateCommand takes in a speed and angular rate in the range [-1.0,1.0] (which can be directly mapped to joystick axes) and generates left and right wheel int8_t commands in the range [-127,127]. You'd basically just have to substitute the "127" for a "100" as far as I can see.
  • A message containing the left and right wheel command is sent to an Arduino via rosserial_arduino. This is then used to apply PWM to the motors on the Arduino side via this code in the command callback.
edit flag offensive delete link more

Comments

Thank you for your support and answer! So your suggestion is to write a function like that used on Arduino for my controller? In this way, speed_in == Y and andRate_in == X?

The solution is to translate that Arduino code into something similar for my controller?

Marcus Barnet gravatar image Marcus Barnet  ( 2016-02-16 04:18:25 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-02-16 02:42:09 -0500

Seen: 1,097 times

Last updated: Feb 16 '16