[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:
Masterclass 2023 batch2 blog banner

Check Out These Related Posts

129. ros2ai

129. ros2ai

I would like to dedicate this episode to all the ROS Developers who believe that ChatGPT or...

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.

Pin It on Pinterest

Share This