In this video, the third of a series, we are going to show how to move a robot with a python script by using the ROS Development Studio environment (http://rds.theconstructsim.com)
This video shows:
1- How to create a new ROS project and how to open it for development
2- How to launch a simulation to test your program, with any of the robots already integrated in the system
3- How to move a robot by command line
4- How to create the python script that moves/rotates the robot.
You can access the ROS Development Studio here: http://rds.theconstructsim.com
The code used during the video was the following:
#! /usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
from time import sleep
rospy.init_node(‘rotate’)
publisher = rospy.Publisher(‘/cmd_vel’, Twist, queue_size=1)
rotate_right = True
while not rospy.is_shutdown():
msg = Twist()
msg.angular.z = 0.1 if rotate_right else -0.1
publisher.publish(msg)
rospy.loginfo(‘Msg published.’)
rotate_right = not rotate_right
sleep(10)
0 Comments