Lidar data works perfectly fine, however, I cannot move the bot. Can anyone see what I'm doing wrong?
Connectioin Info:
rosshutdown
setenv('ROS_MASTER_URI','http://10.0.0.4:11311')
setenv('ROS_IP','10.0.0.4')
rosinit('http://10.0.0.4:11311', 'NodeHost', '10.0.0.169')
Rostopic List
>> rostopic list
/battery_state
/cmd_vel
/cmd_vel_rc100
/diagnostics
/firmware_version
/imu
/joint_states
/magnetic_field
/motor_power
/odom
/reset
/rosout
/rosout_agg
/rpms
/scan
/sensor_state
/sound
/tf
/version_info
>>
Here is my script:
TurtleBot_Topic.vel = '/cmd_vel';
TurtleBot_Topic.laser = '/scan';
laser_sub = rossubscriber(TurtleBot_Topic.laser);
velocity_pub = rospublisher(TurtleBot_Topic.vel, 'geometry_msgs/Twist');
velocity_msg = rosmessage(velocity_pub);
tic
while toc<10
scan_data = receive(laser_sub);
cart = readCartesian(scan_data, 'RangeLimit', [0.12 3.5]);
plot(cart(:,1),cart(:,2), 'o');
velocity_msg.Angular.Z = 0.0;
velocity_msg.Linear.X = 0.2;
send(velocity_pub, velocity_msg);
end
All help is appreciated.
PS: I had a much more detailed report, pressed a wrong key and it all got deleted :(

댓글 수: 6

Sai Bhargav Avula
Sai Bhargav Avula 2019년 7월 31일
편집: Sai Bhargav Avula 2019년 8월 1일
The code looks fine can you update you question with the ROS_MASTER, ROS_IP env variables. It might be network issue.
rosshutdown
setenv('ROS_MASTER_URI','http://10.0.0.4:11311')
setenv('ROS_IP','10.0.0.4')
rosinit('http://10.0.0.4:11311', 'NodeHost', '10.0.0.169')
Sai Bhargav Avula
Sai Bhargav Avula 2019년 8월 1일
This seems fine. It can be the firewall. You need to allow matlab on some computer.
Previn Savaya
Previn Savaya 2019년 8월 1일
I already disabled firewall. Very strange issue. Especially the fact that the lidar Data is received.
Is it possible that the publishers just don’t work? Can I manually check what is being published to what topic? The turtlebot says it is subscribed to all the topics.
Sai Bhargav Avula
Sai Bhargav Avula 2019년 8월 1일
Try echoing the /cmd_vel topic and check for the values.
vel_msg = rostopic("echo", /cmd_vel)
Previn Savaya
Previn Savaya 2019년 8월 1일
Ok, I’m not at my workstation now but as soon as I can I will check it out and update you.

댓글을 달려면 로그인하십시오.

 채택된 답변

Previn Savaya
Previn Savaya 2019년 8월 4일

0 개 추천

I believe I solved this issue. It did have something to do with the communication.
I replaced the IP of the turtlebot with the IP of my actual computer that is running matlab and it worked. Not sure why, but it does!
So for my network configuration this is what I have:
ROS MASTER = IP OF VIRTUAL REMOTE DESKTOP (Oracle Virtual Machine) (roscore command runs on this)
ROS IP = IP OF MY PC THAT IS RUNNING MATLAB (My pc's ip address... AKA IPCONFIG in command prompt)
Somehow this solved my problem.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Publishers and Subscribers에 대해 자세히 알아보기

질문:

2019년 7월 28일

답변:

2019년 8월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by