> For the complete documentation index, see [llms.txt](https://campus-rover.gitbook.io/lab-notebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://campus-rover.gitbook.io/lab-notebook/fiiva/sdf_to_urdf.md).

# sdf\_to\_urdf.md

### Authors - Alexion Ramos & Ilan Hascal

## Creating a Gazebo Model

For some users it is easier to create a model through the given Gazebo simulator in the Model Editor than having to write a custom file. The problem that arises is using objects and specific services else where in a project can be difficult due to the extension names of the file.

## Building Saving a model

When you want to build a model in Gazebo it is best that you do it in the Model Editor that you can get you with CTRl m

Once the model is built and you save it to the right directory it is saved as an .sdf file

## Why is .sdf not useful for Autonomous Pacman and how it conflicts with Services?

For the sake of the autonomous pacman project, our goal was to implement collectibles that pacman could pick up to make him "invincible". Though ,the gazebo SpawnModel & DeleteModel services expect a .urdf file in order to track the model down to Spawn or Delete. Example of spawning a custom .urdf is below.

```python
    spawn_model_client = rospy.ServiceProxy('/gazebo/spawn_sdf_model', SpawnModel)
    spawn_model_client(
    model_name='TESTCYLINDER',
    model_xml=open('/my_ros_data/catkin_ws/src/ros-autonomous-pacman/models/TESTCYLINDER/TESTCYLINDER.urdf', 'r').read(), 
    initial_pose=Pose(),
    reference_frame='world'
    )
```

Documetnation for Spawn - <http://docs.ros.org/en/jade/api/gazebo\\_msgs/html/srv/SpawnModel.html> Documentation for Delete - <http://docs.ros.org/en/jade/api/gazebo\\_msgs/html/srv/DeleteModel.html>

## Solution

After reasearching it was with great pleasure that we found an open source library that allows you to put input the name of the .sdf file and then converts it to .urdf as output to where you specify. It is a really straight forward process that can be done by using the following links below

Github repo - <https://github.com/andreasBihlmaier/pysdf> Youtube video instruction - <https://www.youtube.com/watch?v=8g5nMxhi\\_Pw>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://campus-rover.gitbook.io/lab-notebook/fiiva/sdf_to_urdf.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
