# Error when running StetchBodyNode from stretch\_driver

**URL:** https://forum.hello-robot.com/t/error-when-running-stetchbodynode-from-stretch-driver/148
**Category:** Ask
**Created:** [April 6, 2021, 3:11am UTC](https://forum.hello-robot.com/t/error-when-running-stetchbodynode-from-stretch-driver/148 "2021-04-06T03:11:18Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Robot\_Lover](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@Robot\_Lover](https://forum.hello-robot.com/u/Robot_Lover)
#### Post date: [April 6, 2021, 3:11am UTC](https://forum.hello-robot.com/t/error-when-running-stetchbodynode-from-stretch-driver/148/1 "2021-04-06T03:11:18Z")

</div>

In a python file I have imported the StretchBodyNode from stretch\_driver.py as a class and am running the following code.

```auto
node = StretchBodyNode()
node.main()

```

However, when I call main, I get the following error:

```auto
Traceback (most recent call last):
  File "stretch_driver.py", line 622, in <module>
    node.main()
  File "stretch_driver.py", line 513, in main
    filename = rospy.get_param('~controller_calibration_file')
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/client.py", line 467, in get_param
    return _param_server[param_name] #MasterProxy does all the magic for us
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/msproxy.py", line 123, in __getitem__
    raise KeyError(key)
KeyError: '~controller_calibration_file'

```

I"m not sure what the issue is - there are no similar errors online. Could it be because I am just trying to run the python file and have not integrated it with anything in ROS?

---

<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: [April 6, 2021, 9:43pm UTC](https://forum.hello-robot.com/t/error-when-running-stetchbodynode-from-stretch-driver/148/2 "2021-04-06T21:43:59Z")

</div>

Hi @Robot_Lover, your diagnosis is correct. Trying to run the StretchBodyNode directly using the Python interpreter will not work because StretchBodyNode is a ROS node that uses the ROS ecosystem for various functionalities, such as the [parameter server](http://wiki.ros.org/Parameter%20Server), [message passing](http://wiki.ros.org/Messages), and [much more](http://wiki.ros.org/ROS/Introduction).

In particular, the KeyError you’re seeing above is appearing because the ROS parameter sever is not active. This parameter server is tied to a [ROS master](http://wiki.ros.org/Master), so we can launch a master and the StretchBodyNode node using the following commands:

```auto
roscore

[in a separate terminal, because the old one will not accept new commands until you have quit roscore using Ctrl-C]

rosrun stretch_core stretch_driver

```

`roscore` launches a master here, and the `rosrun` command runs the stretch\_driver node. With the node active, you can interact with it by passing it ROS messages, whether from the commandline or from another Python/C++ node. You may refer to the [Python ROS Node tutorial](http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28python%29) on the ROS wiki to see how to do this.

---

<div class="post-metadata">

### Author: ![Robot\_Lover](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@Robot\_Lover](https://forum.hello-robot.com/u/Robot_Lover)
#### Post date: [April 8, 2021, 4:09am UTC](https://forum.hello-robot.com/t/error-when-running-stetchbodynode-from-stretch-driver/148/3 "2021-04-08T04:09:17Z")

</div>

Hi @bshah ,

Thanks for your response! I’ve looked through the Python ROS Node tutorial and I understand how to create publisher/subscriber nodes that communicate with each other, but I want to get clarification on how I would pass the stretch\_driver node instructions.

Would I be publishing/subscribing to topics contained in stretch\_driver (along the vein of

```auto
pub = rospy.Publisher('chatter', String, queue_size=10)
or 
rospy.Subscriber("chatter", String, callback)

```

Thank you so much for your help! Also is there a timeline for when the ROS tutorials for stretch or the stretch simulator will be out?

---

<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: [April 9, 2021, 6:56am UTC](https://forum.hello-robot.com/t/error-when-running-stetchbodynode-from-stretch-driver/148/4 "2021-04-09T06:56:08Z")

</div>

Hi @Robot_Lover, that’s the right idea. You can create a ROS package with a single node that defines subscribers and publishers. By publishing to the right topics, you can give the robot commands to execute. You may find a list of these topics using the “rostopic” tool as discussed [in this post](https://forum.hello-robot.com/t/basic-ros-code-for-the-stretch-robot/143/5).

In terms of timing, we plan to begin releasing ROS tutorials throughout the summer, with the first one coming near start of June. Additionally, we are tentatively looking at a beta release for the Stretch simulator sometime in the fall.

Glad to help and let me know if you have more questions!

---

<div class="post-metadata">

### Author: ![Robot\_Lover](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@Robot\_Lover](https://forum.hello-robot.com/u/Robot_Lover)
#### Post date: [April 12, 2021, 6:32am UTC](https://forum.hello-robot.com/t/error-when-running-stetchbodynode-from-stretch-driver/148/5 "2021-04-12T06:32:51Z")

</div>

Hi Binit,

Two additional questions. First, if I’m trying to create a Python class to perform basic actions on the Stretch Robot, should I initialize the class as type StretchBodyNode or type HelloNode? I noticed that in the demos, only type HelloNode was used to make the class.

In addition, I’m still struggling a bit with regards to actually getting the robot to move using commands from the command line by publishing a topic. Is it possible that you could write out a sample command that you would use to move the base of the robot forward by x units by publishing to a topic once you’ve started roscore and rosrun stretch\_core stretch\_driver?

Thanks!
