An open API service indexing awesome lists of open source software.

https://github.com/kernelshreyak/robotics

Collection of my IoT and Robotics codes
https://github.com/kernelshreyak/robotics

cad circuit-design circuits freecad industrial-robotics iot microcontrollers robotics simulation webots

Last synced: 15 days ago
JSON representation

Collection of my IoT and Robotics codes

Awesome Lists containing this project

README

          

# Robotics Project Portfolio

A grab bag of robotics experiments that span circuit-level simulations, full Webots and CoppeliaSim environments, OPC UA industrial IoT ingest scripts, and the CAD that ties them together. Each folder is self-contained so you can focus on the subsystem you care about.

## Repository Layout

| Path | Contents |
| ---- | -------- |
| `turret_simulation/` | Webots project for a manually driven turret (controllers, worlds, custom PROTO, shared assets). |
| `shooter_mechanism/` | Webots arena for a dual-wheel shooter plus its controller sources and binaries. |
| `conveyor_belt/` | Webots supervisor that keeps packages gliding across a frictional conveyor demo. |
| `copelliasim/` | Ready-to-run `.ttt` scenes and Lua scripts for Pioneer P3-DX and Robotnik mobile robots. |
| `industrial-iot/` | Python OPC UA ingestion examples and a `venv/` stub for Codesys/Kepware integrations. |
| `sorting_machine/` | Webots WIP conveyor belt that will sort incoming boxes by color and size. |
| `panda-reach-and-pick/` | MP4 demos for a Panda reach-and-pick reinforcement learning script. |
| `ros2-experiments/` | Gazebo Sim and ROS 2 examples, currently including a 4-wheel basic vehicle with `cmd_vel` teleop. |
| `circuit_simulations/` | SimulIDE `.sim1` schematic of a series voltage regulator. |
| `part_design_cad/` | FreeCAD, OBJ/MTL, and Blender sources for the turret tripod mechanics. |

## Prerequisites

| Domain | Tools |
| ------ | ----- |
| Webots projects | Webots R2023b+, `gcc`/`make` (or MSVC on Windows). |
| ROS 2 + Gazebo demos | ROS 2 Jazzy+ with Gazebo Harmonic / `gz sim` 8.x and `ros_gz_bridge`. |
| CoppeliaSim scenes | CoppeliaSim Edu 4.6+ with Lua API enabled. |
| Industrial IoT demos | Python 3.10+, `pip install opcua`, access to an OPC UA server (Codesys, Kepware Simulation Server, etc.). |
| Circuit simulation | SimulIDE 1.x or another tool that opens `.sim1` XML circuits. |
| CAD assets | FreeCAD 0.21+, Blender 3.x for editing, any viewer for OBJ/MTL export. |

> Tip: keep Python dependencies inside `industrial-iot/venv` (already ignored) so simulator SDK files don’t leak into commits.

## Turret Simulation (Webots)

- **Where**: `turret_simulation/controllers/turret_manual/`, `worlds/Turret Control Simulation.wbt`, `protos/Turret.proto`, and OBJ tripod meshes in `assets/`.
- **Controls**: `A/D` yaw, `W/S` pitch with live angle readouts (`turret_manual.c`).
- **Build & run**:
```bash
cd turret_simulation/controllers/turret_manual
make
webots ../../worlds/"Turret Control Simulation.wbt"
```
Select the `turret_manual` controller when prompted (or set it in the world file).

## Shooter Mechanism (Webots)

- **Controller**: `controllers/my_Shooter_controller/my_Shooter_controller.c` spins two wheels in opposite directions at ~50% of their rated speed, reading the max velocity at runtime.
- **World**: `worlds/Shooter_arena.wbt` contains the shooter, targets, and arena walls.
- **Build**:
```bash
cd shooter_mechanism/controllers/my_Shooter_controller
make
webots ../../worlds/Shooter_arena.wbt
```
Tweak `shoot_speed` before compiling if you swap motors.

## Conveyor Belt (Webots)

- **World**: `conveyor_belt/worlds/conveyor_belt_test.wbt` contains a belt, arena, and a handful of boxed packages (`DEF PACKAGE1`, `PACKAGE2`, etc.).
- **Controller**: `controllers/conveyor_controller/conveyor_controller.c` runs as a supervisor robot; it enumerates up to ten packages, computes the delta between the desired belt speed (`BELT_SPEED`) and each box’s velocity, and applies a corrective force along +X so the boxes coast smoothly despite friction (`ContactProperties` uses 0.1 μ).
- **Run it**:
```bash
cd conveyor_belt/controllers/conveyor_controller
make
webots ../../worlds/conveyor_belt_test.wbt
```
Keep the DEF names contiguous (`PACKAGE1`, `PACKAGE2`, …) so the controller auto-discovers them. Adjust `BELT_MIN_X/Z` bounds to match your belt geometry if you stretch it, otherwise the force cuts off early and parcels stall near the edges.

## Sorting Machine (Webots, WIP)

- **Status**: Conveyor belt is wired up; sorting mechanism is in progress to route boxes by color and size.
- **World**: `sorting_machine/worlds/sorting_machine.wbt` contains the roller conveyor and a starter scene.
- **Controller**: `sorting_machine/controllers/sorting_machine_conveyer/sorting_machine_conveyer.c` spins up to 25 roller motors (`roller_motor1..N`) at a fixed velocity for now.
- **Known limitations / next steps**:
- Add color/size detection (camera or distance sensors + classification).
- Implement diverter or gate actuators to route boxes into bins.
- Spawn varied box sizes/colors and add per-box metadata for sorting logic.
- Tune roller speeds, friction, and timing so boxes align before sorting.
- **Run it**:
```bash
cd sorting_machine/controllers/sorting_machine_conveyer
make
webots ../../worlds/sorting_machine.wbt
```

## Panda Reach-and-Pick Demos

`panda-reach-and-pick/` contains MP4 clips of a Panda arm reach-and-pick reinforcement learning demo based on:

```text
https://github.com/kernelshreyak/ai-ml-learning/blob/master/reinforcement-learning/panda_reach_cube.py
```

**Still frames (2s mark)**

| Clip | Frame |
| ---- | ----- |
| `panda-pick-episode-0.mp4` | ![Panda pick episode 0 at 2s](panda-reach-and-pick/panda-pick-episode-0-2s.png) |
| `panda-pick-episode-0 (1).mp4` | ![Panda pick episode 0 alt at 2s](panda-reach-and-pick/panda-pick-episode-0-1-2s.png) |
| `panda-reach-pick-episode-0.mp4` | ![Panda reach-pick episode 0 at 2s](panda-reach-and-pick/panda-reach-pick-episode-0-2s.png) |
| `panda-reach-pick-episode-0 (1).mp4` | ![Panda reach-pick episode 0 alt at 2s](panda-reach-and-pick/panda-reach-pick-episode-0-1-2s.png) |

## ROS 2 Experiments

Located in `ros2-experiments/`:

- `basic-vehicle/models/basic_vehicle/model.sdf`: 4-wheel skid-steer vehicle for Gazebo Sim with driven wheel joints and a `gz::sim::systems::DiffDrive` plugin listening on `/cmd_vel`.
- `basic-vehicle/worlds/basic_vehicle_world.sdf`: flat plane world that spawns the vehicle at the origin.
- `basic-vehicle/drive_vehicle.py`: lightweight ROS 2 keyboard teleop that publishes `geometry_msgs/msg/Twist`.

**Run**

```bash
export GZ_SIM_RESOURCE_PATH=$PWD/ros2-experiments/basic-vehicle/models:$GZ_SIM_RESOURCE_PATH
gz sim ros2-experiments/basic-vehicle/worlds/basic_vehicle_world.sdf
```

In a second terminal:

```bash
source /opt/ros/$ROS_DISTRO/setup.bash
ros2 run ros_gz_bridge parameter_bridge /cmd_vel@geometry_msgs/msg/Twist@gz.msgs.Twist
```

In a third terminal:

```bash
source /opt/ros/$ROS_DISTRO/setup.bash
python3 ros2-experiments/basic-vehicle/drive_vehicle.py
```

Use `w/s` for forward and reverse, `a/d` to steer, `x` or space to stop, and `q` to quit the teleop script.

## CoppeliaSim Scenes

| File | Purpose |
| ---- | ------- |
| `Pioneer.ttt` + `pioneer_script.lua` | Pioneer P3-DX demo that drives forward indefinitely (`vel = 2`). |
| `robotnik_motion.ttt` + `robotnik_movement.lua` | Robotnik Summit XL routine with scripted forward/backward phases (`T1 = 26`, `T2 = 30`). |
| `conveyer_belt.ttt` | Conveyor layout (ready for scripting). |

**Usage**

1. Launch CoppeliaSim → `File > Open scene...` → select a `.ttt`.
2. Ensure the paired Lua script is attached as a child script.
3. Press *Play*; edit the Lua files for more advanced logic (sensor feedback, PID, etc.).

## Industrial IoT OPC UA Demos

Located in `industrial-iot/`:

- `ingest.py`: Connects to a Codesys PLC at `opc.tcp://192.168.29.10:4840`, reads button state plus set/actual conveyor speeds, and logs them every 0.5 s.
- `opcua_ingest.py`: Lightweight poller for Kepware/KIT Simulation Server (`SERVER_URL = "opc.tcp://shreyak-laptop:53530/OPCUA/SimulationServer"`, `NODE_ID = "ns=3;i=1003"`).

**Setup**

```bash
cd industrial-iot
python -m venv venv
source venv/bin/activate
pip install opcua
python ingest.py
```

Swap out the endpoint URL and node IDs for your PLC, and replace the `print()` calls with MQTT publishes, database writes, or cloud ingestion SDKs as needed.

## CAD: Turret Tripod

`part_design_cad/` contains the mechanical source of the turret base:

- Edit solids in `turret_tripod.FCStd` (FreeCAD) and meshes in `turret_tripod.blend`.
- Export updated OBJ/MTL pairs when you need to refresh the Webots assets (`turret_simulation/assets/`).
- Backup files (`*.FCBak`, `.blend1`) are kept alongside the masters for quick rollback.

## Circuit Simulation

`circuit_simulations/series_voltage_regulator.sim1` is an XML-based SimulIDE project for a MOSFET series regulator with oscilloscope probes, push-button, and measurement instrumentation.

1. Launch SimulIDE (or another `.sim1`-compatible simulator).
2. Open the file and run the transient analysis to inspect the scope traces.
3. Edit component values in the GUI or directly within the XML for version-controlled tweaks.

## Development Notes

- Keep generated artifacts (`build/`, controller binaries, `venv/`) out of commits or list them in `.gitignore`.
- Re-export shared meshes from CAD whenever you change geometry so CoppeliaSim and Webots stay aligned.
- Document new experiments in this README so others can discover and reuse them quickly.

## License

No explicit license file exists yet. Add one (e.g., MIT, Apache-2.0) if you plan to publish or distribute the assets.