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

How can I correct the problem in a simple question

asked 2018-05-30 21:16:25 -0500

Pujie gravatar image

updated 2018-05-30 22:22:10 -0500

ahendrix gravatar image

Recently, I learnt on ros_ignite. I just start learning on topics.

The slogan is: Create a package with a launch file that launches the code Modify the code you used previously to publish data to the /cmd_vel topic. Launch the program and check that the robot moves. 1.- The /cmd_vel topic is the topic used to move the robot. Do a rostopic info /cmd_vel in order to get information about this topic, and identify the message it uses. You have to modify the code to use that message.

2.- In order to fill the Twist message, you need to create an instance of the message. In Python, this is done like this: var = Twist()

3.- In order to know the structure of the Twist messages, you need to use the rosmsg show command, with the type of the message used by the topic /cmd_vel.

4.- In this case, the robot uses a differential drive plugin to move. That is, the robot can only move linearly in the x axis, or rotationaly in the angular z axis. This means that the only values that you need to fill in the Twist message are the linear x and the angular z.

5.- The magnitudes of the Twist message are in m/s, so it is recommended to use values between 0 and 1. For example, 0'5 m/s.

Here is the given code, but there is a problem:

import rospy
from geometry_msgs.msg import Twist

pub = rospy.Publisher('/cmd_vel', Twist, queue_size=1)
rate = rospy.Rate(2)
move = Twist()
move.linear.x = 0.5 #Move the robot with a linear velocity in the x axis
move.angular.z = 0.5 #Move the with an angular velocity in the z axis

while not rospy.is_shutdown(): 


    <node pkg="exercise_21" type="" name="move_robot_node" output="screen" />



<?xml version="1.0"?>
  <description>The exercise_21 package</description>
  <maintainer email="user@todo.todo">user</maintainer>



Problem is:

user:~/catkin_ws$ roslaunch exercise_21 move_robot.launch
... logging to /home/user/.ros/log/d040bc5e-6476-11e8-88f0-065a2c6c1cb0/roslaunch-ip-172-31-47-59-17102.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.

Invalid roslaunch XML syntax: mismatched tag: line 4, column 6
The traceback for the exception was written to the log file

How can I correct the problem?

edit retag flag offensive close merge delete


You should make short question that the answer is for eliminating single problem at a time.

achmad_fathoni gravatar image achmad_fathoni  ( 2018-05-30 22:11:58 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-05-30 22:27:18 -0500

ahendrix gravatar image

This error indicates that there is a syntax error in your launch file: Invalid roslaunch XML syntax: mismatched tag: line 4, column 6

"mismatched tag" in XML means that you have a close tag (starts with </) that the XML parser wasn't expecting. In this case, you've closed the node tag twice: once by using a self-closing tag (<node/>) and again with an explicit close tag on line 4, where the parser pointed out your error (</node>).

You should change your launch file so that you either use matching open and close tags ( <node> and </node> ) or use the self-closing tag ( <node/> )

I suggest

    <node pkg="exercise_21" type="" name="move_robot_node" output="screen" />
edit flag offensive delete link more


Thank you! You are right. But when I changed the .launch file. A new problem occurred... It is said: ERROR: cannot launch node of type [exercise_21/]: can't locate node [] in package [exercise_21] I tried to solve it by chmod +x

Pujie gravatar image Pujie  ( 2018-05-31 03:45:53 -0500 )edit

But a new problem occurred again, it is : Unable to launch [move_robot_node-1]. If it is a script, you may be missing a '#!' declaration at the top. The traceback for the exception was written to the log file. Could you please tell me how to solve this one?

Pujie gravatar image Pujie  ( 2018-05-31 03:47:17 -0500 )edit

I solved problems in I omitted the #! /usr/bin/env python in python file. I used to think it is useless.

Pujie gravatar image Pujie  ( 2018-05-31 04:31:35 -0500 )edit

Question Tools

1 follower


Asked: 2018-05-30 21:16:25 -0500

Seen: 1,007 times

Last updated: May 30 '18