Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codelab Updates #1091

Merged
merged 6 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions simulation/samples/CppSample/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.gradle/
.vscode/
.wpilib/
.settings/
build/
.settings/

1 change: 1 addition & 0 deletions simulation/samples/JavaSample/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ simgui.json
.gradle/
.vscode/
.wpilib/
.settings/
build/
ctre_sim/
bin/
59 changes: 59 additions & 0 deletions tutorials/APS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
author: Synthesis Team
summary: How to use Autodesk Platform Services to store and load Synthesis assemblies.
id: APSCodelab
tags: Autodesk, APS, Autodesk Platform Services, Fusion
categories: Services
environments: Synthesis
status: Draft
feedback link: https://github.com/Autodesk/synthesis/issues

# Autodesk Platform Services

## APS (Fusion)

### Login

In order to make use of the Autodesk Platform Services (APS) integration, you first have to log in. This can be done with the middle toolbar button.

![aps toolbar button](img/aps/aps-button-fusion.png)

![aps login](img/aps/aps-login-fusion.png)

Once logged in, you'll be able to see your name in the main export panel.

![aps info](img/aps/aps-info-fusion.png)

### Export Option

To store an export in your current project, make sure the "Export Location" option is set to "Upload".

![upload location option](img/aps/aps-location-fusion.png)

## APS (Synthesis)

### Login

To log into your Autodesk account, open the left menu and click on "APS Login".

![left menu in synthesis](img/aps/aps-left-menu-fission.png)

![login page](img/aps/aps-login-fission.png)

Upon successful login, you should see a notification in the bottom-right, as well as a greeting and your profile picture replacing the "APS Login" button.

![aps login notification](img/aps/aps-notif-fission.png)

![aps profile](img/aps/aps-profile-fission.png)

### Importing

Once logged in, when you open the "Spawn Asset" panel, the remote assets section will begin to search your projects and show any and all Synthesis assemblies available for importing.

![spawn asset panel](img/aps/import-fission.png)

After you've imported them for the first time, they will be saved for later use and won't require APS login to access so long as they stay saved in your browser.

## Need More Help?

If you need help with anything regarding Synthesis or it's related features please reach out through our
[discord sever](https://www.discord.gg/hHcF9AVgZA). It's the best way to get in contact with the community and our current developers.
136 changes: 114 additions & 22 deletions tutorials/CodeSimulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,135 @@ feedback link: https://github.com/Autodesk/synthesis/issues

# Code Simulation in Synthesis

## Setup

### Setup (Project Side)
## Setup (Robot Code Side)

The Synthesis simulator comes with code simulation already integrated. However, a development environment for what ever code your are trying to simulate will be required.
Synthesis' code simulation relies on the WPILib HALSim extensions, specifically the websocket-client extension. To enable this for your project, add the following lines to
your `build.gradle` file.
Synthesis' code simulation relies on the WPILib HALSim extensions, specifically the websocket-client extension. You'll need to make the following changes to your `build.gradle` in order to properly simulate your code in Synthesis.

### 1. Desktop Support

You'll need to enable desktop support for your project in order to run the HALSim:

```java
def includeDesktopSupport = true
```

### 2. Websocket Server Extension

In order to communicate with your browser, you'll need to enable the websocket server extension with the following:

```java
wpi.sim.envVar("HALSIMWS_HOST", "127.0.0.1")
wpi.sim.addWebsocketsClient().defaultEnabled = true
wpi.sim.addWebsocketsServer().defaultEnabled = true
```

### 3. SyntheSim (Optional)

For CAN-based device support (TalonFX, CANSparkMax, most Gyros), you'll need our own library--SyntheSim. Currently only available for Java, SyntheSim adds additional support for third party devices that don't follow WPILib's web socket specification. It's still in early development, so you'll need to clone and install the library locally in order to use it:

```sh
$ git clone https://github.com/Autodesk/synthesis.git
$ cd synthesis/simulation/SyntheSimJava
$ ./gradlew build && ./gradlew publishToMavenLocal
```

Next, you'll need to have the local maven repository is added to your project by making sure the following is included in your `build.gradle` file:

```java
repositories {
mavenLocal()
...
}
```

Finally, you can add the SyntheSim dependency to your `build.gradle`:

```java
dependencies {
...
implementation "com.autodesk.synthesis:SyntheSimJava:1.0.0"
...
}
```

All of these instructions can be found in the [SyntheSim README](https://github.com/Autodesk/synthesis/blob/prod/simulation/SyntheSimJava/README.md).

SyntheSim is very much a work in progress. If there is a particular device that isn't compatible, feel free to head to our [GitHub](https://github.com/Autodesk/synthesis) to see about contributing.

### 4. HALSim GUI

This should be added by default, but in case it isn't, add this to your `build.gradle` to enable the SimGUI extension by default.

```java
wpi.sim.addGui().defaultEnabled = true
```

This will allow you to change the state of the robot, as well as hook up any joysticks you'd like to use during teleop. You must use this GUI in order
to bring your robot out of disconnected mode, otherwise we won't be able to change the state of your robot from within the app.

### 5. Start your code

To start your robot code, you can use the following simulate commands with gradle:

```bash
$ ./gradlew simulateJava
```

or for C++:

```bash
$ ./gradlew simulateNative
```

<b>NOTE:</b> The GUI extension interfaces really well and add Joystick/Controller support to your code, whereas Synthesis currently only supports controllers for non-code simulation.
If you wish to test using your controllers, I recommend using the GUI extension in conjunction.
WPILib also has a command from within VSCode you can use the start your robot code:

![image_caption](img/code-sim/wpilib-ext-simulate.png)

## Setup (Synthesis Web-app Side)

Once started, make sure in the SimGUI that your robot state is set to "Disabled", **not** "Disconnected".

### Spawning in a Robot

Open up [Fission](https://synthesis.autodesk.com/fission/) and spawn in a robot. Once spawned in, place it down and open the config panel. This can be
done by using the left-hand menu and navigating to your robot in the config panel, or by right-clicking on your robot and selecting the "Configure" option.

Next, switch the brain currently controlling the robot. In order to give the simulation control over the robot, the brain must be switched from "Synthesis"
to "WPILib". At the moment, only one robot can be controlled by the simulation at a time.

In the top-right, there should be a connection status indicator. If your robot program was running prior to switching to the "WPILib" brain, it should connect
quickly.

### Simulation Configuration

Under your robot in the config panel, there should be a Simulation option now. Here you can find all the settings for the code simulation.

![image_caption](img/code-sim/config-panel-simulation.png)

#### Auto Reconnect

You can enabled auto reconnect incase you are having issues with this. In order for it to take affect, you have to enable the setting, then switch back to the "Synthesis"
brain and then back again to the "WPILib" brain. This setting will be saved.

#### Wiring Panel

### Setup (Robot Side)
This panel can be used to "wire up" your robot. It will show you all the inputs and outputs available from both the simulation and robot. The handles (little circles with
labels) are colored to indicate the type of data they represent. Hover over the information icons for more information.

Inside of Synthesis, you must configure your "IO map" so we know what signals go where. You can access the configuration modal on the side bar.
Once inside the configuration modal, you can add the devices you want to add support for.
<br/>
<b>NOTE:</b> Currently, due to the way the websocket extension works, no CAN devices are supported. We plan on bringing CAN support for the 2023 Summer release or potentially earlier.
At the moment, PWM and Quadrature Encoders (encoders that use 2 DIO ports each) are supported, with more device types and sensors on the way.
![image_caption](img/code-sim/wiring-panel.png)

## Usage
The bottom-left controls can be used to zoom in/out, fit your view to the nodes, and add junction nodes for connection many connections to many connections.

### Synthesis
#### Auto Testing

Inside of Synthesis, open up the DriverStation. Once connected, you can use it like normal. Our DriverStation is currently limited in its features, so if you need anything beyond
enabling and choosing between Telop and Auto, I recommend using the GUI extension for more functionality.
The Auto Testing panel allows for iterative testing of an autonomous routine. I'd recommend making sure that the auto reconnect option is enabled.

### Running the code Simulation
![image_caption](img/code-sim/auto-testing.png)

I recommend using VSCode and the WPILib Suite extension for running the code simulation. Alternatively you can use this command:
`gradlew.bat simulationJava` or `gradlew.bat simulate`
You can specify a max time, alliance station, and game data. Once you've decided on those and have place the robot where you want, you can start your auto routine.
After the specified amount of time, or when the stop button is pressed, the simulation will freeze and you can either reset to where you started, or close the panel.

## Need More Help?

If you need help with anything regarding Synthesis or it's related features please reach out through our
[discord sever](https://www.discord.gg/hHcF9AVgZA). It's the best way to get in contact with the community and our current developers.
[discord server](https://www.discord.gg/hHcF9AVgZA). It's the best way to get in contact with the community and our current developers.
65 changes: 0 additions & 65 deletions tutorials/ConfigMode.md

This file was deleted.

68 changes: 68 additions & 0 deletions tutorials/ConfigureAssets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
author: Synthesis Team
summary: Tutorial for navigating and using the configure assets panel.
id: ConfigureAssets
tags: Configuration, Assets, Options, Customization
categories: Configuration
environments: Synthesis
status: Draft
feedback link: https://github.com/Autodesk/synthesis/issues

# Configure Assets

## Main Panel

Use the configure assets panel to modify assemblies in the scene. You can open it either via the left-hand menu,
or by right clicking on an assembly and selecting "Configure".

## Robots

### Brain

The brain determines what controls the robot. There are currently two options, "Synthesis" and "WPILib".

### Move

Add a gizmo tool to your field to orientate it.

### Intake

Setup the intake zone for your robot.

### Ejector

Setup the ejector position and direction for your robot.

### Configure Joints

Edit the joints on your robot and adjust the speed and force behind them.

### Sequence Joints

Configure joints to work together. Helpful for multi-stage elevators.

### Controls (Synthesis Brain)

Change the controls of the input scheme currently in use, as well as switch which scheme is actively in use.

### Simulation (WPILib Brain)

Modify the relation between your robot within Synthesis and your code.

## Fields

### Move

Add a gizmo tool to your field to orientate it.

### Scoring Zones

Add, modify, and delete scoring zones.

## Input

This works the same as the controls section for the robot. You can modify the controls for the schemes, as well as add and delete them.

## Need More Help?

If you need help with anything regarding Synthesis or it's related features please reach out through our
[discord sever](https://www.discord.gg/hHcF9AVgZA). It's the best way to get in contact with the community and our current developers.
Loading
Loading