How can I correct the problem in a simple question
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 simple_topic_publisher.py. 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:
move_robot.py
import rospy
from geometry_msgs.msg import Twist
rospy.init_node('move_robot_node')
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():
pub.publish(move)
rate.sleep()
move_robot.launch
<launch>
<node pkg="exercise_21" type="move_robot.py" name="move_robot_node" output="screen" />
</node>
</launch>
package.xml
<?xml version="1.0"?>
<package>
<name>exercise_21</name>
<version>0.0.0</version>
<description>The exercise_21 package</description>
<maintainer email="user@todo.todo">user</maintainer>
<license>TODO</license>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>
<build_depend>std_msgs</build_depend>
<run_depend>roscpp</run_depend>
<run_depend>rospy</run_depend>
<run_depend>std_msgs</run_depend>
<export>
</export>
</package>
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?
You should make short question that the answer is for eliminating single problem at a time.