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

ros_arduino_bridge cant get my robot to move

asked 2015-12-06 06:35:25 -0600

Dor gravatar image

hello everyone, basically i want to send twist command to my robot and get it moving but nothing happans when i send the twist commands...

i have successfully uploaded the ros_arduino_bridge sketch in to my robot, i can get it moving by sending "m 20 20" (through serial monitor) and get encoder data "0 0" (although i still don't have encoders plugged in) .

in my config file .yaml i have changed to the following settings:

# For a direct USB cable connection, the port name is typically
# /dev/ttyACM# where is # is a number such as 0, 1, 2, etc
# For a wireless connection like XBee, the port is typically
# /dev/ttyUSB# where # is a number such as 0, 1, 2, etc.

port: /dev/ttyACM4
baud: 57600
timeout: 0.1

rate: 50
sensorstate_rate: 10

use_base_controller: True
base_controller_rate: 10

# For a robot that uses base_footprint, change base_frame to base_footprint
base_frame: base_link

# === Robot drivetrain parameters
wheel_diameter: 0.146
wheel_track: 0.2969
encoder_resolution: 20 # from Pololu for 131:1 motors
gear_reduction: 1.0
motors_reversed: True

# === PID parameters
#Kp: 10
#Kd: 12
#Ki: 0
#Ko: 50
#accel_limit: 1.0

# === Sensor definitions.  Examples only - edit for your robot.
#     Sensor type can be one of the follow (case sensitive!):
#     * Ping
#     * GP2D12
#     * Analog
#     * Digital
#     * PololuMotorCurrent
#     * PhidgetsVoltage
#     * PhidgetsCurrent (20 Amp, DC)



sensors: {
  #motor_current_left:   {pin: 0, type: PololuMotorCurrent, rate: 5},
  #motor_current_right:  {pin: 1, type: PololuMotorCurrent, rate: 5},
  #ir_front_center:      {pin: 2, type: GP2D12, rate: 10},
  #sonar_front_center:   {pin: 5, type: Ping, rate: 10},
  arduino_led:          {pin: 13, type: Digital, rate: 5, direction: output}
}

i am successfully launching the ros communication with the arduino, even pin 13 with the LED is flashing

robot@robot-os:~/catkin_ws$ roslaunch ros_arduino_python arduino.launch
... logging to /home/robot/.ros/log/26e050c2-9bfe-11e5-b637-40f02f469e9c/roslaunch-robot-os-15096.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://robot-os:58763/

SUMMARY
========

PARAMETERS
 * /arduino/base_controller_rate: 10
 * /arduino/base_frame: base_link
 * /arduino/baud: 57600
 * /arduino/encoder_resolution: 20
 * /arduino/gear_reduction: 1.0
 * /arduino/motors_reversed: True
 * /arduino/port: /dev/ttyACM4
 * /arduino/rate: 50
 * /arduino/sensors/arduino_led/direction: output
 * /arduino/sensors/arduino_led/pin: 13
 * /arduino/sensors/arduino_led/rate: 5
 * /arduino/sensors/arduino_led/type: Digital
 * /arduino/sensorstate_rate: 10
 * /arduino/timeout: 0.1
 * /arduino/use_base_controller: True
 * /arduino/wheel_diameter: 0.146
 * /arduino/wheel_track: 0.2969
 * /rosdistro: jade
 * /rosversion: 1.11.16

NODES
  /
    arduino (ros_arduino_python/arduino_node.py)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found
process[arduino-1]: started with pid [15114]
[DEBUG] [WallTime: 1449403808.755147] init_node, name[/arduino], pid[15114]
[DEBUG] [WallTime: 1449403808.755488] binding to 0.0.0.0 0
[DEBUG] [WallTime: 1449403808.755694] bound to 0.0.0.0 58098
[DEBUG] [WallTime: 1449403808.759198] ... service URL is rosrpc://robot-os:58098
[DEBUG] [WallTime: 1449403808.759411] [/arduino/get_loggers]: new Service instance
[DEBUG] [WallTime: 1449403808.761027] ... service URL is rosrpc://robot-os:58098
[DEBUG] [WallTime: 1449403808.761239] [/arduino/set_logger_level]: new Service instance
/home/robot/catkin_ws/src/ros_arduino_bridge/ros_arduino_python/nodes/arduino_node.py:62: SyntaxWarning: The publisher should be created with an explicit keyword argument 'queue_size'. Please see http://wiki ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2015-12-07 07:03:33 -0600

Dor gravatar image

thank you very much for your reply! :) i was able to fix this issue by changing the "gear reduction" in my configuration file, by putting "#" before it.

about the encoder, i will soon recieve my encoder that i ordered online. it is 20 ticks per one revoulution, so thats why i wrote this value. and it is mounted straight on the wheel

thanks again! :)

edit flag offensive delete link more

Comments

Glad you got it working!

Pi Robot gravatar image Pi Robot  ( 2015-12-07 08:00:11 -0600 )edit
0

answered 2015-12-06 21:28:35 -0600

Pi Robot gravatar image

First, be sure to place your robot on blocks before continuing your testing with ROS since without encoders, the robot could move VERY fast depending on your settings. Next, I noticed your encoder_resolution is set quite small (20) in your config file. (The value I use for Polulu 131:1 gear motors with integrated encoders is 8384.) This value is used to compute wheel speed in encoder ticks per second so with a value as low as 20, you will have to use higher velocity values in your Twist command to get the robot to move. So instead of a z: value of 0.5, try 1.0, then 5.0, 10.0, etc. until you get the robot to move.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-12-06 06:35:25 -0600

Seen: 406 times

Last updated: Dec 07 '15