Giving Commands to Stretch in Gazebo

Hi, I am wondering if there is an updated tutorial on giving joint commands to gazebo through ROS.

First I run this in one window, and it launches.
roslaunch stretch_gazebo gazebo.launch rviz:=true

I try to write a node in raspy to give action commands: when I try to initialize a SimpleActionClient, it isn’t working:
self.trajectory_arm_client = actionlib.SimpleActionClient( '/stretch_arm_controller/follow_joint_trajectory', FollowJointTrajectoryAction) server_reached = self.trajectory_arm_client.wait_for_server(timeout=rospy.Duration(60.0)) rospy.loginfo("Waiting for server_reached") rospy.loginfo("Server Reached:{0}".format(server_reached))

It outputs Server Reached:false

Hi @jehan, your code is correct, so the issue is probably related to networking. Are you running your node on the same machine that’s running Gazebo?

The following code returns “Server reached: True” when I run it:

import rospy
import actionlib
from control_msgs.msg import FollowJointTrajectoryGoal, FollowJointTrajectoryAction


class TempNode():

    def __init__(self):
        pass

    def main(self):
        rospy.init_node('temp_node')
        self.trajectory_arm_client = actionlib.SimpleActionClient('/stretch_arm_controller/follow_joint_trajectory', FollowJointTrajectoryAction)
        server_reached = self.trajectory_arm_client.wait_for_server()
        print(f'Server reached: {server_reached}')

if __name__ == '__main__':
    node = TempNode()
    node.main()