Hi guys, I try to move the robot Sawyer from rethinkrobotics to a given point. My base program for this is here. Because it doesn't work well just typing in coordinates I want to try to simulate the movement or at least read out the joint positions with rviz. Therefor I completed the MoveIt tutorial from rethinkrobotics and now I try to apply the python tutorial to reach my goal.
Right now I am trying to get the first lines of code from the given example working (just to "printing robot state") but rviz won't start. The output in the console seems to be like it should be, the action server is up and running and rviz works fine if I start it manually by
$ roslaunch sawyer_moveit_config sawyer_moveit.launch
So I leave that console window open and start the example which should start rviz, but nothing happens. Any ideas?
Here's the part of the code example I want to work (cleaned it a bit):
#!/usr/bin/env python
################### CORRECT STARTUP ###################
# $ rosrun file.py joint_states:=/robot/joint_states
#######################################################
#######################################################
## BEGIN_SUB_TUTORIAL imports
##
## To use the python interface to move_group, import the moveit_commander
## module. We also import rospy and some messages that we will use.
import sys
import copy
import rospy
import moveit_commander
import moveit_msgs.msg
import geometry_msgs.msg
## END_SUB_TUTORIAL
from std_msgs.msg import String
def move_group_python_interface_tutorial():
## BEGIN_TUTORIAL
##
## Setup
## ^^^^^
## CALL_SUB_TUTORIAL imports
##
## First initialize moveit_commander and rospy.
print "============ Starting tutorial setup"
moveit_commander.roscpp_initialize(sys.argv)
rospy.init_node('move_group_python_interface_tutorial',
anonymous=True)
## Instantiate a RobotCommander object. This object is an interface to
## the robot as a whole.
robot = moveit_commander.RobotCommander()
## Instantiate a PlanningSceneInterface object. This object is an interface
## to the world surrounding the robot.
scene = moveit_commander.PlanningSceneInterface()
## Instantiate a MoveGroupCommander object. This object is an interface
## to one group of joints. In this case the group is the joints in the left
## arm. This interface can be used to plan and execute motions on the left
## arm.
group = moveit_commander.MoveGroupCommander("right_arm")
## We create this DisplayTrajectory publisher which is used below to publish
## trajectories for RVIZ to visualize.
display_trajectory_publisher = rospy.Publisher(
'/move_group/display_planned_path',
moveit_msgs.msg.DisplayTrajectory,
queue_size=20)
## Wait for RVIZ to initialize. This sleep is ONLY to allow Rviz to come up.
print "============ Waiting for RVIZ..."
rospy.sleep(10)
print "============ Starting tutorial "
## Getting Basic Information
## ^^^^^^^^^^^^^^^^^^^^^^^^^
##
## We can get the name of the reference frame for this robot
print "============ Reference frame: %s" % group.get_planning_frame()
## We can also print the name of the end-effector link for this group
print "============ Reference frame: %s" % group.get_end_effector_link()
## We can get a list of all the groups in the robot
print "============ Robot Groups:"
print robot.get_group_names()
## Sometimes for debugging it is useful to print the entire state of the
## robot.
print "============ Printing robot state"
print robot.get_current_state()
print "============"
## When finished shut down moveit_commander.
moveit_commander.roscpp_shutdown()
## END_TUTORIAL
print "============ STOPPING"
if __name__=='__main__':
try:
move_group_python_interface_tutorial()
except rospy.ROSInterruptException:
pass
Originally posted by Robot Nr.5 on ROS Answers with karma: 3 on 2017-08-03
Post score: 0