turtlebot3 not moving with ros and matlab robotics system toolbox

6 views (last 30 days)
Hi there, I cannot make my turtlebot3 move.
I followed the Turtlebot3 emanual http://emanual.robotis.com/docs/en/platform/turtlebot3/overview/, using Linux based on Raspbian for my turtlebot and the Matlab tutorial 'Getting started with a real turtlebot' https://de.mathworks.com/help/robotics/examples/get-started-with-a-real-turtlebot.html
I'm using ROS 1.12.12 on my Turtlebot3 Waffle Pi with OpenCR v1.1.2 and am communicating throught Matlab R2018a (with ROSTtoolbox) on a lenovo thinkpad x121e with win 7 ultimate x64 system. Using ethernet cable, all firewalls deactivated.
Turtlebot3 ip is 169.254.96.117, Matlab laptop uses 169.254.96.70, they ping each other.
I already checked https://answers.ros.org/question/272722/turtlebot-wont-move-matlab/ and https://de.mathworks.com/matlabcentral/answers/119559-why-is-the-ros-subscriber-callback-in-matlab-not-triggered-when-messages-are-published-from-an-exter and https://nl.mathworks.com/matlabcentral/answers/196911-use-matlab-robotics-system-toolbox-to-receive-ros-message but all those answers didn't solve my problem.
I am able to recieve compressed images from the pi camera.
What I do:
Starting terminal on Turtlebot3
pi@lane_assist:~ $ sudo nano ~/.bashrc
The last 3 lines of this file are
export ROS_MASTER_URI=http://169.254.96.117:11311
export ROS_IP=169.254.96.117
export TURTLEBOT3_MODEL=waffle_pi
Then I'm launching ROS on Turtlebot3
pi@lane_assist:~ $ roslaunch turtlebot3_bringup turtlebot3_robot.launch
... logging to /home/pi/.ros/log/6b1f4796-5e5e-11e8-9737-b827eb81deb2/roslaunch-lane_assist-889.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://169.254.96.117:36215/
SUMMARY
========
PARAMETERS
* /rosdistro: kinetic
* /rosversion: 1.12.12
* /turtlebot3_core/baud: 115200
* /turtlebot3_core/port: /dev/ttyACM0
* /turtlebot3_lds/frame_id: base_scan
* /turtlebot3_lds/port: /dev/ttyUSB0
NODES
/
turtlebot3_core (rosserial_python/serial_node.py)
turtlebot3_diagnostics (turtlebot3_bringup/turtlebot3_diagnostics)
turtlebot3_lds (hls_lfcd_lds_driver/hlds_laser_publisher)
auto-starting new master
process[master]: started with pid [900]
ROS_MASTER_URI=http://169.254.96.117:11311
setting /run_id to 6b1f4796-5e5e-11e8-9737-b827eb81deb2
process[rosout-1]: started with pid [913]
started core service [/rosout]
process[turtlebot3_core-2]: started with pid [916]
process[turtlebot3_lds-3]: started with pid [917]
process[turtlebot3_diagnostics-4]: started with pid [918]
[INFO] [1527062028.753037]: ROS Serial Python Node
[INFO] [1527062028.779238]: Connecting to /dev/ttyACM0 at 115200 baud
[INFO] [1527062031.090808]: Note: publish buffer size is 1024 bytes
[INFO] [1527062031.092832]: Setup publisher on sensor_state [turtlebot3_msgs/SensorState]
[INFO] [1527062031.104666]: Setup publisher on version_info [turtlebot3_msgs/VersionInfo]
[INFO] [1527062031.117409]: Setup publisher on imu [sensor_msgs/Imu]
[INFO] [1527062031.136734]: Setup publisher on cmd_vel_rc100 [geometry_msgs/Twist]
[INFO] [1527062031.196269]: Setup publisher on odom [nav_msgs/Odometry]
[INFO] [1527062031.207955]: Setup publisher on joint_states [sensor_msgs/JointState]
[INFO] [1527062031.220119]: Setup publisher on battery_state [sensor_msgs/BatteryState]
[INFO] [1527062031.234520]: Setup publisher on magnetic_field [sensor_msgs/MagneticField]
[INFO] [1527062035.993428]: Setup publisher on /tf [tf/tfMessage]
[INFO] [1527062036.011202]: Note: subscribe buffer size is 1024 bytes
[INFO] [1527062036.013037]: Setup subscriber on cmd_vel [geometry_msgs/Twist]
[INFO] [1527062036.036048]: Setup subscriber on sound [turtlebot3_msgs/Sound]
[INFO] [1527062036.054081]: Setup subscriber on motor_power [std_msgs/Bool]
[INFO] [1527062036.074894]: Setup subscriber on reset [std_msgs/Empty]
[INFO] [1527062036.103111]: ------turtlebot matla move--------------------
[INFO] [1527062036.108906]: Connected to OpenCR board!
[INFO] [1527062036.557876]: This core(v1.1.2) is compatible with TB3 Waffle or Waffle Pi
[INFO] [1527062036.561891]: --------------------------
[INFO] [1527062036.565490]: Start Calibration of Gyro
[INFO] [1527062036.569355]: Calibration End
[ WARN] [1527062037.011487913]: Check OpenCR update and change your firmware!!
And then I'm starting MATLAB, using the following Code:
ipadress = '169.254.96.117'
rosinit(ipadress)
rostopic list
velsub=rossubscriber('/cmd_vel')
velpub = rospublisher('/cmd_vel',rostype.geometry_msgs_Twist)
velmsg = rosmessage(velpub)
velmsg.Linear.X = 0.01
velmsg.Angular.Z = 0.01
send(velpub,velmsg)
The Code taken form the command window is:
ipadress = '169.254.96.117'
ipadress =
'169.254.96.117'
rosinit(ipadress)
Initializing global node /matlab_global_node_48143 with NodeURI http://169.254.96.70:50988/
rostopic list
/battery_state
/cmd_vel
/cmd_vel_rc100
/diagnostics
/imu
/joint_states
/magnetic_field
/motor_power
/odom
/reset
/rosout
/rosout_agg
/rpms
/scan
/sensor_state
/sound
/tf
/version_info
velsub=rossubscriber('/cmd_vel')
velsub =
Subscriber with properties:
TopicName: '/cmd_vel'
MessageType: 'geometry_msgs/Twist'
LatestMessage: [0×1 Twist]
BufferSize: 1
NewMessageFcn: []
velpub = rospublisher('/cmd_vel',rostype.geometry_msgs_Twist)
velpub =
Publisher with properties:
TopicName: '/cmd_vel'
IsLatching: 1
NumSubscribers: 0
MessageType: 'geometry_msgs/Twist'
velmsg = rosmessage(velpub)
velmsg.Linear.X = 0.01
velmsg.Angular.Z = 0.01
send(velpub,velmsg)
velmsg =
ROS Twist message with properties:
MessageType: 'geometry_msgs/Twist'
Linear: [1×1 Vector3]
Angular: [1×1 Vector3]
Use showdetails to show the contents of the message
velmsg =
ROS Twist message with properties:
MessageType: 'geometry_msgs/Twist'
Linear: [1×1 Vector3]
Angular: [1×1 Vector3]
Use showdetails to show the contents of the message
velmsg =
ROS Twist message with properties:
MessageType: 'geometry_msgs/Twist'
Linear: [1×1 Vector3]
Angular: [1×1 Vector3]
Use showdetails to show the contents of the message
rostopic info /cmd_vel
Type: geometry_msgs/Twist
Publishers:
* /matlab_global_node_90049 (http://169.254.96.70:51028/)
Subscribers:
* /turtlebot3_core (http://169.254.96.117:35571/)
* /matlab_global_node_90049 (http://169.254.96.70:51028/)
What am I missing? Any help would be wonderful.
Thank you!

Answers (2)

Stefanie Schwarz
Stefanie Schwarz on 18 Jun 2018
We suggest you try the following:
1. Ensure the data is being received by the turtlebot3.
On the hardware, execute:
$ rostopic echo /cmd_vel
Then send the message from the MATLAB instance, and check on the command prompt (with the above echo command) if the data published by the MATLAB node is received.
We suspect the network is not set up correctly.
2. If the data is not seen on the hardware, then while connecting from the windows host, the user can do the following:
>> rosinit('http://169.254.96.117:11311', 'NodeHost', '169.254.96.70')
This is making sure the MATLAB node is advertising itself correctly.
Then redo the above process of confirming if the data is being received on the hardware or not.
  1 Comment
Stefanie Schwarz
Stefanie Schwarz on 20 Jun 2018
Addendum: For the case that the above steps show that the MATLAB node is publishing fine, and the rosnode for the robot is also receiving correctly, then the only conclusion that we have is that the motor is not connected, or not responding to these cmd_vel commands.
Please go outside MATLAB and send the cmd_vel command directly from a Linux command prompt as shown here:
$ rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '{linear: {x: 0.1, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}'
This way you can ensure that you are able to debug directly by publishing from Linux and checking the rostopic echo command from Linux itself. With the outcome of this, you may reach out to ROBOTIS and ask for further assistance as the issue is beyond the scope of MATLAB.

Sign in to comment.


naria
naria on 3 Sep 2018
Hi Dear Axel Hänel
I have bought turtlebot3 recently. but i am not an expert of ROS. i am more comfortable with matlab. can you please provide me your step by step guide on how to operate turtlebot3 using matlab? thanks

Categories

Find more on Network Connection and Exploration in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!