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

How can I see the default baud rate of the turtlebot_node.py file?

asked 2016-11-05 23:24:42 -0500

Diana_Elyza gravatar image

Hi!!!

I'm newbie in this but I'm trying to use the TurtleBot package in a Roomba 600, but I can't, I think that is by the default rate, but I don't where is the line code to change it, because my robot is working with a baudrate of 115200 and I've read that the old Roomba worked with a default baudrate of 57600. I've opened the turtlebot_node.py file, which it is in /opt/ros/indigo/lib/create_node/, and this is the code:

 #!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2010, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
#  * Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#  * Redistributions in binary form must reproduce the above
#    copyright notice, this list of conditions and the following
#    disclaimer in the documentation and/or other materials provided
#    with the distribution.
#  * Neither the name of Willow Garage, Inc. nor the names of its
#    contributors may be used to endorse or promote products derived
#    from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Revision $Id: __init__.py 11217 2010-09-23 21:08:11Z kwc $

    import roslib; roslib.load_manifest('create_node')

"""
ROS Turtlebot node for ROS built on top of create_driver's
turtlebot implementation. This driver is based on 
otl_roomba by OTL (otl-ros-pkg).

create_driver's turtlebot implementation is based on 
Damon Kohler's pyrobot.py.
"""

import os
import sys
import select
import serial
import termios
import time

from math import sin, cos

import rospkg
import rospy
import tf

from geometry_msgs.msg import Point, Pose, Pose2D, PoseWithCovariance, \
    Quaternion, Twist, TwistWithCovariance, Vector3
from nav_msgs.msg import Odometry
from sensor_msgs.msg import JointState

from create_driver import Turtlebot, MAX_WHEEL_SPEED, DriverError
from create_node.msg import TurtlebotSensorState, Drive, Turtle
from create_node.srv import SetTurtlebotMode,SetTurtlebotModeResponse, SetDigitalOutputs, SetDigitalOutputsResponse
from create_node.diagnostics import TurtlebotDiagnostics
import create_node.robot_types as robot_types
from create_node.covariances import \
     ODOM_POSE_COVARIANCE, ODOM_POSE_COVARIANCE2, ODOM_TWIST_COVARIANCE, ODOM_TWIST_COVARIANCE2
from create_node.songs import bonus

#dynamic reconfigure
import dynamic_reconfigure.server
from create_node.cfg import TurtleBotConfig


class TurtlebotNode(object):

    _SENSOR_READ_RETRY_COUNT = 5 

    def __init__(self, default_port='/dev/ttyUSB0', default_update_rate=30.0):

        """
        @param default_port: default tty port to use for establishing
            connection to Turtlebot.  This will be overriden by ...
(more)
edit retag flag offensive close merge delete

Comments

self.robot.start(self.port, robot_types.ROBOT_TYPES[self.robot_type].baudrate) looks more promising; I think you should have a look through the robot_types module. (disclosure: I don't know anything about the create driver; I just read a lot of code)

ahendrix gravatar image ahendrix  ( 2016-11-05 23:57:16 -0500 )edit

Thanks a lot!!!

I'll check it

Greetings!!!

Diana_Elyza gravatar image Diana_Elyza  ( 2016-11-06 22:11:31 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-11-06 19:17:56 -0500

tfoote gravatar image

As @ahendrix suggested the robot_type seems to encode the default baud rate: https://github.com/turtlebot/turtlebo...

If you set the parameter ~robot_type parameter to roomba I suspect it will work as you want. From here: https://github.com/turtlebot/turtlebo...

edit flag offensive delete link more

Comments

Thank you very much!!!

I will read these parameters.

Greetings!!!

Diana_Elyza gravatar image Diana_Elyza  ( 2016-11-06 22:13:25 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-11-05 23:24:42 -0500

Seen: 320 times

Last updated: Nov 06 '16