Skip to content
Draft
Show file tree
Hide file tree
Changes from 5 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
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,19 @@ nc.connect_robot(
)

# Create a dataset for recording
nc.create_dataset(
dataset = nc.create_dataset(
name="My Robot Dataset",
description="Example dataset with multiple data types"
)
dataset = nc.connect_dataset(dataset)

# Recording and streaming data
nc.start_recording()
dataset.start_recording()
t = time.time()
nc.log_joint_positions(positions={'joint1': 0.5, 'joint2': -0.3}, timestamp=t)
nc.log_rgb(name="top_camera", rgb=image_array, timestamp=t)
# Stop recording, the dataset is automatically uploaded to the cloud
nc.stop_recording()
dataset.stop_recording()

# Kick off cloud training
job_data = nc.start_training_run(
Expand Down Expand Up @@ -169,4 +170,4 @@ If you use Neuracore in your research, please consider citing:
year = {2026},
url = {https://github.com/NeuracoreAI/neuracore}
}
```
```
5 changes: 3 additions & 2 deletions docs/data_daemon.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,12 @@ import neuracore as nc

def main():
nc.login()
dataset = nc.connect_dataset("My Robot Dataset")

# The daemon starts automatically when needed
nc.start_recording()
dataset.start_recording()
# ...
nc.stop_recording()
dataset.stop_recording()
```

Choosing a profile when using auto-start:
Expand Down
7 changes: 4 additions & 3 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ nc.connect_robot(
import time

# Create a dataset for recording
nc.create_dataset(
dataset = nc.create_dataset(
name="My Robot Dataset",
description="Example dataset with multiple data types"
)
dataset = nc.connect_dataset(dataset)

# Start recording
nc.start_recording()
dataset.start_recording()

# Log various data types with timestamps
t = time.time()
Expand All @@ -80,7 +81,7 @@ custom_sensor_data = np.array([1.2, 3.4, 5.6])
nc.log_custom_1d("force_sensor", custom_sensor_data, timestamp=t)

# Stop recording
nc.stop_recording()
dataset.stop_recording()
```

#### Live Data Streaming Control
Expand Down
23 changes: 16 additions & 7 deletions examples/example_data_collection_bigym.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@


def run_episode(
episode_idx: int, record: bool, demo: Demo, env: Any, render: bool
episode_idx: int,
record: bool,
demo: Demo,
env: Any,
render: bool,
dataset: nc.Dataset | None = None,
) -> bool:
"""Run one demonstration episode and optionally record it."""
print(f"\n=== Starting Episode {episode_idx} ===")
Expand All @@ -45,7 +50,7 @@ def run_episode(
try:
# Start neuracore recording if required
if record:
nc.start_recording()
dataset.start_recording()

for step in demo._steps:
# Log current joint positions and velocities
Expand Down Expand Up @@ -93,10 +98,10 @@ def run_episode(
if record:
if success:
print("Episode successful → finalizing recording...")
nc.stop_recording(wait=True)
dataset.stop_recording(wait=True)
else:
print("Episode failed → cancelling recording...")
nc.cancel_recording()
dataset.cancel_recording()

print(f"=== Episode {episode_idx} done | success={success} ===")
return success
Expand All @@ -120,11 +125,14 @@ def main(num_episodes: int, record: bool, recording_name: str, render: bool) ->

if record:
# Create a dataset to start recording episodes into
nc.create_dataset(
created_dataset = nc.create_dataset(
name=recording_name,
description="Example Bigym data collection on the ReachTarget environment",
)
dataset = nc.connect_dataset(created_dataset)
print("Created dataset.")
else:
dataset = None

# Create ReachTarget Bigym environment
env = make_env()
Expand All @@ -144,6 +152,7 @@ def main(num_episodes: int, record: bool, recording_name: str, render: bool) ->
demo=demos[episode_idx],
env=env,
render=render,
dataset=dataset,
)

if success:
Expand All @@ -152,8 +161,8 @@ def main(num_episodes: int, record: bool, recording_name: str, render: bool) ->

except KeyboardInterrupt:
print("\nInterrupted by user.")
if record:
nc.cancel_recording()
if dataset is not None:
dataset.cancel_recording()
finally:
env.close()
print(
Expand Down
8 changes: 5 additions & 3 deletions examples/example_data_collection_vx300s.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ def main(args):
# Setup parameters
record = args["record"]
num_episodes = args["num_episodes"]
dataset = None

if record:
nc.create_dataset(
name="My Example Dataset",
description="This is an example dataset",
)
dataset = nc.connect_dataset("My Example Dataset")
print("Created Dataset...")

try:
Expand All @@ -46,7 +48,7 @@ def main(args):

# Start recording if enabled
if record:
nc.start_recording()
dataset.start_recording()

# Log initial state
t = time.time()
Expand Down Expand Up @@ -83,13 +85,13 @@ def main(args):
# Stop recording if enabled
if record:
print("Finishing recording...")
nc.stop_recording()
dataset.stop_recording()
print("Finished recording!")

print(f"Episode {episode_idx} done")
except KeyboardInterrupt:
if record:
nc.cancel_recording()
dataset.cancel_recording()
raise


Expand Down
25 changes: 15 additions & 10 deletions examples/getting_started_with_neuracore.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"2. **Register a robot** with Neuracore by providing an MJCF model, and see it show up in your web dashboard overview.\n",
"3. **Real-time monitoring** of your robot behavior in simulation.\n",
"4. **Create a new dataset** in the \"Data\" page of your web dashboard.\n",
"5. **Record and upload data**: upload robot demonstrations to the cloud with `nc.start_recording()`.\n",
"5. **Record and upload data**: upload robot demonstrations to the cloud with `dataset.start_recording()`.\n",
"6. **Visualize collected data** on the web dashboard.\n",
"7. **Train your first policy** on your freshly collected dataset.\n",
"8. **Deploy your policy** in simulation and track its behavior in real time."
Expand Down Expand Up @@ -293,6 +293,7 @@
" demo: Optional[Demo] = None,\n",
" policy=None,\n",
" record: bool = False,\n",
" dataset=None,\n",
") -> bool:\n",
" \"\"\"Run one simulation episode and optionally record it.\n",
"\n",
Expand All @@ -316,7 +317,7 @@
" try:\n",
" # Start a new recording to upload logs on Neuracore\n",
" if record:\n",
" nc.start_recording()\n",
" dataset.start_recording()\n",
"\n",
" for step_idx in range(max_steps):\n",
" # Log current joint positions and velocities\n",
Expand Down Expand Up @@ -366,10 +367,10 @@
" if record:\n",
" if success:\n",
" print(\"Episode successful → finalizing recording...\")\n",
" nc.stop_recording(wait=True)\n",
" dataset.stop_recording(wait=True)\n",
" else:\n",
" print(\"Episode failed → cancelling recording...\")\n",
" nc.cancel_recording()\n",
" dataset.cancel_recording()\n",
"\n",
" print(f\"=== Episode {episode_idx} done | success={success} ===\")\n",
" return success\n",
Expand Down Expand Up @@ -532,10 +533,11 @@
"\n",
"DATASET_NAME = \"Getting started Bigym Example\"\n",
"\n",
"nc.create_dataset(\n",
"created_dataset = nc.create_dataset(\n",
" name=DATASET_NAME,\n",
" description=\"Data collection on the Bigym simulation environments\",\n",
")\n",
"dataset = nc.connect_dataset(created_dataset)\n",
"print(\"Dataset created.\")"
]
},
Expand Down Expand Up @@ -571,13 +573,14 @@
" episode_idx=episode_idx,\n",
" env=env,\n",
" demo=demos[episode_idx],\n",
" record=RECORD\n",
" record=RECORD,\n",
" dataset=dataset,\n",
" )\n",
"\n",
"except KeyboardInterrupt:\n",
" print(\"\\nInterrupted by user.\")\n",
" if RECORD:\n",
" nc.cancel_recording()"
" dataset.cancel_recording()"
]
},
{
Expand Down Expand Up @@ -785,10 +788,11 @@
"robot = nc.connect_robot(robot_name=\"Mujoco UnitreeH1 Example\")\n",
"\n",
"# Create a dataset for collecting episodes at inference time\n",
"nc.create_dataset(\n",
"inference_dataset = nc.create_dataset(\n",
" name=DATASET_NAME+\"_Inference\",\n",
" description=\"Inference rollouts for the Getting started Bigym example\",\n",
")\n",
"inference_dataset = nc.connect_dataset(inference_dataset)\n",
"\n",
"USE_PRETRAINED_MODEL = True\n",
"if USE_PRETRAINED_MODEL:\n",
Expand Down Expand Up @@ -821,7 +825,8 @@
" episode_idx=episode_idx,\n",
" env=env,\n",
" policy=policy,\n",
" record=RECORD\n",
" record=RECORD,\n",
" dataset=inference_dataset,\n",
" )\n",
"\n",
" if success:\n",
Expand All @@ -832,7 +837,7 @@
"except KeyboardInterrupt:\n",
" print(\"\\nInterrupted by user.\")\n",
" if RECORD:\n",
" nc.cancel_recording()\n",
" inference_dataset.cancel_recording()\n",
"finally:\n",
" print(f\"\\nFinished running {NUM_EPISODES} episodes → {success_count} succeeded.\")\n",
" policy.disconnect()"
Expand Down
8 changes: 5 additions & 3 deletions examples/ros_example/ros_example/simulation_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def __init__(self):
self.action_traj = []
self.current_action_traj = []
self.record = True
self.dataset = None

# Initialize environment first, before setting up timers
self.initialize_environment()
Expand All @@ -73,9 +74,10 @@ def __init__(self):
nc.create_dataset(
name=dataset_name, description="ROS2 distributed data collection"
)
self.dataset = nc.connect_dataset(dataset_name)
self.get_logger().info(f"Created dataset: {dataset_name}")

nc.start_recording()
self.dataset.start_recording()
self.get_logger().info("Started recording")

# Create all timers in a specific order, with simulation_step last
Expand Down Expand Up @@ -128,7 +130,7 @@ def simulation_step(self):
self.obs, _, _ = self.env.step(np.array(list(action.values())))
else:
if self.record:
nc.stop_recording()
self.dataset.stop_recording()
self.get_logger().info("Recording stopped")

# Increment episode counter
Expand All @@ -148,7 +150,7 @@ def simulation_step(self):
self.current_action_traj = self.action_traj.copy()

if self.record:
nc.start_recording()
self.dataset.start_recording()
self.get_logger().info("Recording Started")

except Exception as e:
Expand Down
Loading