Skip to content

Instantly share code, notes, and snippets.

@PierrickKoch
Created February 18, 2013 19:30
Show Gist options
  • Select an option

  • Save PierrickKoch/4979946 to your computer and use it in GitHub Desktop.

Select an option

Save PierrickKoch/4979946 to your computer and use it in GitHub Desktop.
"""
Run the following commands::
export PYTHONPATH=/usr/local/lib/python3.3/site-packages/:$PYTHONPATH
blender /usr/local/share/morse/data/morse_default.blend -P morse_wargs.py -- 5
"""
from morse.builder import *
def import_atrv(mw):
# Append ATRV robot to the scene
atrv = ATRV()
# Append an actuator
motion = MotionVW()
motion.translate(z=0.3)
atrv.append(motion)
# Append a Gyroscope sensor
gyroscope = Gyroscope()
gyroscope.translate(z=0.83)
atrv.append(gyroscope)
# Configuring the middlewares
gyroscope.add_stream(mw)
motion.add_stream(mw)
return atrv
import sys
num_robots = 1
if '--' in sys.argv:
id_robot = sys.argv.index('--') + 1
try:
num_robots = int(sys.argv[id_robot])
except Exception as e:
print("ERROR : Couldn't parse args : %s\n%s"%(str(sys.argv), str(e)))
for id_robot in range(num_robots):
robot = import_atrv('ros')
robot.translate(x=id_robot*2)
robot.name = "robot%i"%id_robot
env = Environment('indoors-1/indoor-1')
env.aim_camera([1.0470, 0, 0.7854])
del env
# rostopic pub -1 /robot1/motion geometry_msgs/Twist "{linear: {x: .1}, angular: {z: .1}}"
# rostopic pub -1 /robot2/motion geometry_msgs/Twist "{linear: {x: .1}, angular: {z: .1}}"
# rostopic pub -1 /robot3/motion geometry_msgs/Twist "{linear: {x: .1}, angular: {z: .1}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment