ROS Basics in 5 days: Part I unable to move robot

I’m having a hard time starting up this assignment. Learnt in section 4 is that we should adjust the launch file (in this case main.launch) and create a Python file that will actually create the ‘wall following’ behavior.

To test if I would be able to launch anything correctly I created a node in the main.launch file like this:

Afterwards I just created a in which I just put the code of a previous example (where we needed to turn when coming close to a wall, because I know the robot would at least start moving). looks as followed:

After compiling via catkin_make, and doing source devel/setup.bash I will launch:
roslaunch realrobotlab main.launch

I don’t get what I’m doing wrong, or how should actually start… can someone maybe explain a little bit how should tackle assignments like this?

use inside your callback function this on line 9

global move

How do you actually mean?
Like: def callback(global move):

Or like in all the commands:
if msg.ranges[360] > 1:
global move.linear.x = 10
global move.angular.z = 0.0

Try declaring move = Twist() before rospy.Subscriber()

This didn’t make any difference

I see that your code is within the simulation_ws, and it shouldn’t. That workspace is only for simulation related code.

You should instead be creating your files in catkin_ws, like you have learned in the course.

First you need to create your own package in ~/catkin_ws/src, and then create a launch directory where you will add main.launch, and your should be in the src folder, after making it executable with chmod +x

Then, you can compile, source the correct workspace, and see if the robot starts moving

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.