# Giving Commands to Stretch in Gazebo

**URL:** <https://forum.hello-robot.com/t/giving-commands-to-stretch-in-gazebo/857>\
**Category:** Ask\
**Created:** [December 5, 2023, 5:32pm UTC](https://forum.hello-robot.com/t/giving-commands-to-stretch-in-gazebo/857 "2023-12-05T17:32:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jehan](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/jehan/32/347_2.png) [@jehan](https://forum.hello-robot.com/u/jehan)\
**Post date:** [December 5, 2023, 5:32pm UTC](https://forum.hello-robot.com/t/giving-commands-to-stretch-in-gazebo/857/1 "2023-12-05T17:32:00Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![bshah](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/bshah/32/55_2.png) [@bshah](https://forum.hello-robot.com/u/bshah)\
**Post date:** [December 6, 2023, 7:56pm UTC](https://forum.hello-robot.com/t/giving-commands-to-stretch-in-gazebo/857/2 "2023-12-06T19:56:50Z")

</div>

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:

```python
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()

```
