Hello, i try to run gazebo using:
roslaunch realrobotlab main.launch
as mentioned in the notebook of the new rosject created for ros basics, but it will not launch. It launched a few days ago. Can i somehow reset the rosject. Also, error said another gazebo instance is running.
Hello @ToniSolo ,
It may happen that your files were not loaded properly.
Or the ROS_PACKAGE_PATH
is not set properly
Could you check these?
Let me know if that works for you
Regards
1 Like
I saw another post that saiid to zoom out at gazebo. It worked.
Thanks btw.
1 Like
Hi,
I would also have similar questions but related to the setup of the environment. It is not explained where we should write our code. Is it in catkin_ws or simulation_ws? How to configure launch file for simulation?
I would appreciate any support.
Thank you
Igor
Hello @iv20023 ,
You can use catkin_ws
.
The simulation_ws
is a workspace used for simulations, if you like this pattern of development. It’s not mandatory =)
Please, let me know if it clarified your doubts
Regards
1 Like
Dear Marco,
I would like to understand how to configure the launch file for simulation because this is not clear at all.
I created the ‘my_turtle_movement.py’ file in order to move Turtlebot3 along the wall.
Node name inside that file is declared as: rospy.init_node(‘wall_follower’)
Structure is shown on the photo below.
I would like to understand on how to configure the launch file so that I can simulate turtlebot3 movements properly. Now, I have the following in the launch file:
<!-- simulation -->
<include file="$(find realrobotlab)/launch/realrobotlab_v1_world.launch">
<arg name="gui" value="true"/>
</include>
</launch>
I also show how ‘realrobototlab_v1_world.launch’ looks like but that was set as per default. Can you support me on how the launch file should look like?
Where do I specify my package name and node name?
Thank you for support
Hello @iv20023
You can include the simulation launch file in your program launch file.
Please check thess references:
It would be something like
<include file="$(package_name)/launch/my_launch_file.launch" />
This way you can just launch a single file, instead of launching 2 in different terminals.
The include
tag can go anywhere after you have opened <launch>
Dear Marco,
This what you have described is just not working. I am talking about this task that we should make.
When I enter command in terminal roslaunch realrobotlab main.launch, I get the following:
Also, I decided to make robot control in catkin_ws and question is what is the proper way to define the launch file. I stucked here and can not continue to course. If I do not get the proper support, I will need to cancel my subsription because how other colleages are done this task?
Thank you for support
Igor V
Hi Igor,
Now that you shown the error in the terminal, it is more clear for me.
You may have some typo in the launch file, please check mine attached, I could launch the simulation from the original rosject.
If you can to copy and paste the code and try there, could you?
<launch>
<!-- simulation -->
<include file="$(find realrobotlab)/launch/realrobotlab_v1_world.launch">
<arg name="gui" value="true"/>
</include>
<!-- robot -->
<include file="$(find turtlebot3_gazebo)/launch/put_robot_in_world.launch">
<arg name="x" value="0.1"/>
<arg name="y" value="0.3"/>
<arg name="z" value="0.05"/>
<arg name="roll" value="0.0"/>
<arg name="pitch" value="0.0"/>
<arg name="yaw" value="0" />
<!-- <arg name="model" value="burger_rrl"/> -->
<arg name="model" value="burger"/>
</include>
</launch>
Please, let me know if that basic example works for you.
1 Like
Dear Marco,
From some reason, simulation world shows up now and I am able to control the turtlebot3 by using the following comand. → roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
From some reason, I still can not control the turtlebot3 from my program. I created the launch file and software script as following (give only linear component) move.linear.x = 0.3 but turtlebot continues to turn around (I suppose still receiving the commands from the previous commands via teleop_key.
My script file looks like this
#! /usr/bin/env python
import rospy
from sensor_msgs.msg import LaserScan
from geometry_msgs.msg import Twist
def callback(msg): # get the laser scan message
right_dist = min(min(msg.ranges[0:30]), 10)
front_dist = min(min(msg.ranges[350:370]), 10)
print("right dist is %f" % (right_dist))
print("front dist is %f" % (front_dist))
move = Twist()
move.linear.x = 0.3
pub.publish(move)
rospy.init_node('wall_follower') # we create a node called wall follower
pub = rospy.Publisher('/cmd_vel', Twist, queue_size=1)
right_dist = None
front_dist = None
sub = rospy.Subscriber('/scan', LaserScan, callback) # we subscribe to laser scan and put info in msg
rate = rospy.Rate(2)
#move = Twist()
while not rospy.is_shutdown():
pub.publish(move)
rate.sleep()
My launch file looks like this and I am still not sure if it is correct. Can you please support where might be a problem so that I can continue the course?
<launch>
<!-- simulation -->
<include file="$(find realrobotlab)/launch/realrobotlab_v1_world.launch">
<arg name="gui" value="true"/>
</include>
<node pkg ="my_turtle_pkg"
type="my_turtle_movement"
name="wall_follower"
output="screen">
</node>
</launch>
Finally, when I try to see what is sent via cmd_vel topic I get the following
Hi @iv20023 ,
I just tested the script you pasted and it seems it can control the robot, until it hits the wall.
About the launch file, you should refer the python script with its extension, like below:
<launch>
<!-- simulation -->
<include file="$(find realrobotlab)/launch/realrobotlab_v1_world.launch">
<arg name="gui" value="true"/>
</include>
<node pkg ="my_turtle_pkg"
type="my_turtle_movement.py"
name="wall_follower"
output="screen">
</node>
</launch>
But it didn’t work here because when the node starts, the simulation is still loading. There are some ways to handle this, but for the sake of simplicity, I would recommend you to launch the simulation and start your script in a different tab.
Please, let me know if you can see the topics and robot moving doing it like this.
Dear Marco,
I started the simulation as it was requested in the task by using
roslaunch realrobotlab main.launch
main.lunch script looks like below (I am still not sure that for simulation I should comment everything that is related to the real robot.
<!-- simulation -->
<include file="$(find realrobotlab)/launch/realrobotlab_v1_world.launch">
<arg name="gui" value="true"/>
</include>
<!-- robot -->
<include file="$(find turtlebot3_gazebo)/launch/put_robot_in_world.launch">
<arg name="x" value="0.1"/>
<arg name="y" value="0.3"/>
<arg name="z" value="0.05"/>
<arg name="roll" value="0.0"/>
<arg name="pitch" value="0.0"/>
<arg name="yaw" value="0" />
<!-- <arg name="model" value="burger_rrl"/> -->
<arg name="model" value="burger"/>
</include>
</launch>
Then, I created the separate lauch file as you recommend above in your message from 12th April:
I run the launch file as following in the separate tab and get the error as below:
Where is actually the problem?
Thank you for support
Igor V