This repository provides a ROS-based implementation for controlling the Sawyer robot using natural language commands interpreted by OpenAI’s GPT API. The system converts language commands into executable robot actions via MoveIt in a simulated Gazebo environment. Visual input is not used; control is based solely on textual instructions.
ros_ws/
├── src/
│ ├── sawyer_llm_executor/
│ │ ├── scripts/
│ │ │ ├── fake_joint_states.py
│ │ │ ├── joint_states_relay.py
│ │ │ ├── llm_command_listener.py
│ │ │ ├── gpt.py
│ │ │ └── sawyer_action.py
│ └── (standard Intera SDK, simulator, and MoveIt packages)
- Ubuntu 20.04
- ROS Noetic
- Intera SDK and Sawyer Simulator
- MoveIt for Sawyer
- Python 3.x
- OpenAI API Key (exported via environment variable
OPENAI_API_KEY)
-
Clone the Repository
git clone https://github.com/saumanraaj/Sawyer_LLM_Control.git cd Sawyer_LLM_Control -
Source the Intera Environment
source intera.sh sim -
Build the Workspace
cd ~/ros_ws catkin_make source devel/setup.bash
-
Launch the Gazebo World with Sawyer
roslaunch sawyer_gazebo sawyer_world.launch
-
Start the Intera Interface
rosrun intera_interface joint_trajectory_action_server.py
-
Launch Sawyer MoveIt Configuration
roslaunch sawyer_moveit_config sawyer_moveit.launch
-
Publish Joint States
- If robot is not publishing
/robot/joint_states, use:rosrun sawyer_llm_executor fake_joint_states.py
- Otherwise, relay the joint states:
rosrun sawyer_llm_executor joint_states_relay.py
- If robot is not publishing
-
Run the GPT Command Listener
rosrun sawyer_llm_executor llm_command_listener.py
Once the GPT listener node is active, you can publish text commands:
rostopic pub /llm/user_input std_msgs/String "data: 'move forward by 10 centimeters'"The system will:
- Send the command to the GPT API
- Parse the returned JSON structure
- Use MoveIt to execute corresponding actions
- Default z-height is 0.6 meters.
- Gripper actions (open/close) will be ignored if the robot does not detect a gripper.
- The MoveIt planner handles IK and motion; collision avoidance is not guaranteed.
- Requires a valid OpenAI GPT API key via
OPENAI_API_KEY.
This project builds upon the official Rethink Robotics Sawyer SDK, Gazebo simulation environment, MoveIt, and OpenAI's GPT models.