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

Turtlebot wont move (MATLAB)

asked 2017-10-10 12:37:57 -0500

Cullen Dubbs gravatar image

updated 2017-10-17 13:01:45 -0500

Hi I'm trying to run some very basic code to move my turtlebot.

i am using ROS Indigo on Ubuntu 14.04.2

I am communicating through MATLAB and I should have everything setup fine(keyword should).

turtlebot ip matlab ip

They ping each other fine

My matlab code is this:

robot = rospublisher('/mobile_base/commands/velocity')
velmsg = rosmessage(robot)
velmsg.Linear.X = .1
send( robot , velmsg )

this is after running rosinit to I get

 Initializing global node /matlab_global_node_99074 with NodeURI

I have setup the bashrc as such

echo export ROS_HOSTNAME= >> ~/.bashrc
echo export ROS_MASTER_URI= >> ~/.bashrc
sudo sh -c 'ROS_HOSTNAME= >> /opt/ros/indigo/setup.bash'

i double checked my bashrc and the env variables are there.

turtlebot moves with keyboard operation fine.

Quick note** I had all this working fine on one laptop, came back to try on a different laptop, didn't work anymore.

I am really not sure what i am missing. i have spent about a week searching for answers.

quick overview of what i do.


new terminal

roslaunch turtlebot.bringup minimal.launch

turtelbot beeps run the code on matlab no errors on matlab side

turtlebot doesn't move... it is supposed to lurch forward really quick and stop. I have seen this exact code work(matlab)

when i run rostopic list i see all the commands (including velocity)

I am unsure where to look or find issues. I am assuming the turtlebot isn't receiving the commands?

Any help would be wonderful since i am getting zero errors anywhere

Thanks! (also pretty new to Linux, sorry if i ask for simple clarifications)


I just tried to some communications test bewteen the turtlebot and the matlab computer: I WAS able to recieve scan data from the turtlebot but still NOT able to move the turtlebot

my 'rostopic' list contains


(only posted ones that are relevant to movement/question)

after doing some more research i found a hand tool called 'roswtf'

another question made mention of getting similar errors

I also have

* /mobile_base_nodelet_manager:
   * /mobile_base/commands/controller_info
   * /mobile_base/commands/external_power
   * /mobile_base/commands/reset_odometry
   * /mobile_base/commands/sound
   * /cmd_vel_mux/input/safety_controller
   * /cmd_vel_mux/input/navi
   * /mobile_base/commands/digital_output
   * /mobile_base/commands/led1
   * /mobile_base/commands/led2
   * /mobile_base/commands/motor_power

I have no issue using teleop but I'm wondering if our issues could be related.

Also I found some more info about '/mobile_base/commands/velocity' through matlab.

Publisher with properties:

         TopicName: '/mobile_base/commands/velocity'
        IsLatching: 1
    NumSubscribers: 0
       MessageType: 'geometry_msgs/Twist'

ROS Twist message with properties:

    MessageType: 'geometry_msgs/Twist'
         Linear: [1×1 Vector3]
        Angular: [1×1 Vector3]

rostopic info '/mobile_base/commands/velocity'
Type: geometry_msgs ...
edit retag flag offensive close merge delete


It may be a network issue. Can you update your question to include the env variables (ROS_MASTER, ROS_IP if you're using IP's or ROS_HOSTNAME you're using host names) for the computers that you're using?

jayess gravatar image jayess  ( 2017-10-17 13:07:13 -0500 )edit

2 Answers

Sort by » oldest newest most voted

answered 2017-10-10 21:02:37 -0500

jayess gravatar image

I don't think that you're publishing to the correct topic (unless that topic is being remaped). From a quick search in the GitHub repo it looks like you should be publishing to the cmd_vel topic or some variant of it. The /mobile_base/commands/velocity topic looks like it's used for muxing the navigation commands. If you really are supposed to be publishing to the /mobile_base/commands/velocity topic then please update your question with the results of rostopic list.

As a side note, please take a look at the environment variables page on the wiki. If you're going to be using an IP instead of a host name then you should use ROS_IP not ROS_HOSTNAME. I've also never seen anyone use

sudo sh -c 'ROS_HOSTNAME= >> /opt/ros/indigo/setup.bash'


edit flag offensive delete link more


Thanks for the answer! I remember seeing ROS_IP floating around on some wikis, wasnt sure what the difference was between that and ROS_HOSTNAME.

I never considered that i need to use a different topic. I will try that as well! Results to follow soon!

Cullen Dubbs gravatar image Cullen Dubbs  ( 2017-10-11 17:04:05 -0500 )edit

Ok so here is the 'rostopic list' ,atleast the ones I see on the list that pertain to this problem /cmd_vel_mux/active
/cmd_vel_mux/parameter 1

Cullen Dubbs gravatar image Cullen Dubbs  ( 2017-10-12 08:47:24 -0500 )edit

I am going to try some things now, will report soon

Cullen Dubbs gravatar image Cullen Dubbs  ( 2017-10-12 08:48:35 -0500 )edit

Please update your question with this information.

jayess gravatar image jayess  ( 2017-10-12 08:57:30 -0500 )edit

Encoding the ROS+HOSTNAME into the setup files in /opt/ros is highly not recommended. That file is versioned inside a debian package should not be mutated. Any changes you make there are subject to changes anytime you change networks and will be lost if the package updates.

tfoote gravatar image tfoote  ( 2017-10-12 12:51:10 -0500 )edit

Ya i was following the matlab setup steps for turtlebot and the filesystem they say to run that in didnt exist for me so i assumed it was different for me but im not sure i even need to do that, could that be negativley affecting connectivity?

Cullen Dubbs gravatar image Cullen Dubbs  ( 2017-10-13 19:50:04 -0500 )edit

@Cullen Dubbs: probably not, but you should remove what you added to /opt/ros/kinetic/setup.bash anyway.

gvdhoorn gravatar image gvdhoorn  ( 2017-10-14 02:45:28 -0500 )edit

answered 2017-10-24 08:02:49 -0500

Cullen Dubbs gravatar image


Turns out it was the firewall. I needed to allow matlab and on some computers that was already the case.

My final network setup that works was simply

ROS_HOSTNAME= turtlebot IP


and thats it!

Matlab autosets everything else for you using 'rosinit'


edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-10-10 12:37:57 -0500

Seen: 878 times

Last updated: Oct 24 '17