[RDS] 003 – ROS Development Studio Howto #3 move a robot with a python script

Written by Ruben Alves

09/02/2018

 

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)

Topics:

Discover How to Equip Your Teams with ROS Skills Fast

The Construct For Enterprise

Check Out These Related Posts

5 Mistakes Robotics & ROS Teachers Make

5 Mistakes Robotics & ROS Teachers Make

Last week, a colleague of mine asked me for advice on how to teach ROS at university because she is going to start delivering a ROS class next month. Then I decided to record this video with 5 mistakes I have made in the past while teaching ROS at the university. I hope that this video is useful for you and helps you avoid the mistakes that I made so you can start delivering ROS classes smoothly.

read more

0 Comments

Submit a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share This