ros_arduino_bridge cant get my robot to move
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 rosarduinobridge 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.ros.org/rospy/Overview/Publishers%20and%20Subscribers for more information.
self.cmd_vel_pub = rospy.Publisher('cmd_vel', Twist)
/home/robot/catkin_ws/src/ros_arduino_bridge/ros_arduino_python/nodes/arduino_node.py:66: SyntaxWarning: The publisher should be created with an explicit keyword argument 'queue_size'. Please see http://wiki.ros.org/rospy/Overview/Publishers%20and%20Subscribers for more information.
self.sensorStatePub = rospy.Publisher('~sensor_state', SensorState)
[DEBUG] [WallTime: 1449403808.781244] ... service URL is rosrpc://robot-os:58098
[DEBUG] [WallTime: 1449403808.781487] [/arduino/servo_write]: new Service instance
[DEBUG] [WallTime: 1449403808.783167] ... service URL is rosrpc://robot-os:58098
[DEBUG] [WallTime: 1449403808.783440] [/arduino/servo_read]: new Service instance
[DEBUG] [WallTime: 1449403808.786278] ... service URL is rosrpc://robot-os:58098
[DEBUG] [WallTime: 1449403808.791414] [/arduino/digital_set_direction]: new Service instance
[DEBUG] [WallTime: 1449403808.793254] ... service URL is rosrpc://robot-os:58098
[DEBUG] [WallTime: 1449403808.793464] [/arduino/digital_write]: new Service instance
[DEBUG] [WallTime: 1449403808.794963] ... service URL is rosrpc://robot-os:58098
[DEBUG] [WallTime: 1449403808.795202] [/arduino/analog_write]: new Service instance
Connecting to Arduino on port /dev/ttyACM4 ...
Connected at 57600
Arduino is ready.
[INFO] [WallTime: 1449403812.907653] Connected to Arduino on port /dev/ttyACM4 at 57600 baud
/home/robot/catkin_ws/src/ros_arduino_bridge/ros_arduino_python/src/ros_arduino_python/arduino_sensors.py:139: SyntaxWarning: The publisher should be created with an explicit keyword argument 'queue_size'. Please see http://wiki.ros.org/rospy/Overview/Publishers%20and%20Subscribers for more information.
self.pub = rospy.Publisher("~sensor/" + self.name, Digital)
[INFO] [WallTime: 1449403812.915751] arduino_led {'rate': 5, 'type': 'Digital', 'direction': 'output', 'pin': 13}
Updating PID parameters
/home/robot/catkin_ws/src/ros_arduino_bridge/ros_arduino_python/src/ros_arduino_python/base_controller.py:90: SyntaxWarning: The publisher should be created with an explicit keyword argument 'queue_size'. Please see http://wiki.ros.org/rospy/Overview/Publishers%20and%20Subscribers for more information.
self.odomPub = rospy.Publisher('odom', Odometry)
[INFO] [WallTime: 1449403812.944339] Started base controller for a base of 0.2969m wide with 20 ticks per rev
[INFO] [WallTime: 1449403812.944715] Publishing odometry data at: 10.0 Hz using base_link as base frame
[DEBUG] [WallTime: 1449403812.966070] connecting to robot-os 58098
but when i run a twist command
$ rostopic pub -1 /cmd_vel geometry_msgs/Twist '{ angular: {z: 0.5} }'
nothing happans except for these lines:
[DEBUG] [WallTime: 1449405147.509166] connecting to robot-os 43763
[DEBUG] [WallTime: 1449405150.440228] connecting to robot-os 43763
please help :)
Asked by Dor on 2015-12-06 07:35:25 UTC
Answers
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.
Asked by Pi Robot on 2015-12-06 22:28:35 UTC
Comments
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! :)
Asked by Dor on 2015-12-07 08:03:33 UTC
Comments
Glad you got it working!
Asked by Pi Robot on 2015-12-07 09:00:11 UTC
Comments