Skip to content
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
184 changes: 24 additions & 160 deletions .basedpyright/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,14 @@
}
],
"./positronic/cfg/policy.py": [
{
"code": "reportMissingImports",
"range": {
"startColumn": 9,
"endColumn": 42,
"lineCount": 1
}
},
{
"code": "reportArgumentType",
"range": {
Expand Down Expand Up @@ -8215,54 +8223,6 @@
"lineCount": 1
}
},
{
"code": "reportCallIssue",
"range": {
"startColumn": 4,
"endColumn": 73,
"lineCount": 1
}
},
{
"code": "reportArgumentType",
"range": {
"startColumn": 31,
"endColumn": 57,
"lineCount": 1
}
},
{
"code": "reportCallIssue",
"range": {
"startColumn": 4,
"endColumn": 67,
"lineCount": 1
}
},
{
"code": "reportArgumentType",
"range": {
"startColumn": 31,
"endColumn": 51,
"lineCount": 1
}
},
{
"code": "reportCallIssue",
"range": {
"startColumn": 4,
"endColumn": 83,
"lineCount": 1
}
},
{
"code": "reportArgumentType",
"range": {
"startColumn": 31,
"endColumn": 52,
"lineCount": 1
}
},
{
"code": "reportOperatorIssue",
"range": {
Expand Down Expand Up @@ -8537,14 +8497,6 @@
"lineCount": 1
}
},
{
"code": "reportArgumentType",
"range": {
"startColumn": 55,
"endColumn": 63,
"lineCount": 1
}
},
{
"code": "reportAttributeAccessIssue",
"range": {
Expand Down Expand Up @@ -10541,6 +10493,14 @@
}
],
"./positronic/simulator/robolab/env.py": [
{
"code": "reportMissingImports",
"range": {
"startColumn": 7,
"endColumn": 12,
"lineCount": 1
}
},
{
"code": "reportMissingImports",
"range": {
Expand Down Expand Up @@ -10891,6 +10851,14 @@
}
],
"./positronic/simulator/robolab/validate.py": [
{
"code": "reportMissingImports",
"range": {
"startColumn": 7,
"endColumn": 12,
"lineCount": 1
}
},
{
"code": "reportMissingImports",
"range": {
Expand Down Expand Up @@ -10997,22 +10965,6 @@
"lineCount": 1
}
},
{
"code": "reportCallIssue",
"range": {
"startColumn": 11,
"endColumn": 26,
"lineCount": 1
}
},
{
"code": "reportArgumentType",
"range": {
"startColumn": 11,
"endColumn": 26,
"lineCount": 1
}
},
{
"code": "reportAttributeAccessIssue",
"range": {
Expand Down Expand Up @@ -11109,94 +11061,6 @@
"lineCount": 1
}
},
{
"code": "reportAttributeAccessIssue",
"range": {
"startColumn": 36,
"endColumn": 40,
"lineCount": 1
}
},
{
"code": "reportCallIssue",
"range": {
"startColumn": 14,
"endColumn": 33,
"lineCount": 1
}
},
{
"code": "reportArgumentType",
"range": {
"startColumn": 14,
"endColumn": 33,
"lineCount": 1
}
},
{
"code": "reportCallIssue",
"range": {
"startColumn": 15,
"endColumn": 25,
"lineCount": 1
}
},
{
"code": "reportArgumentType",
"range": {
"startColumn": 15,
"endColumn": 25,
"lineCount": 1
}
},
{
"code": "reportCallIssue",
"range": {
"startColumn": 9,
"endColumn": 41,
"lineCount": 1
}
},
{
"code": "reportArgumentType",
"range": {
"startColumn": 9,
"endColumn": 41,
"lineCount": 1
}
},
{
"code": "reportCallIssue",
"range": {
"startColumn": 15,
"endColumn": 39,
"lineCount": 1
}
},
{
"code": "reportArgumentType",
"range": {
"startColumn": 15,
"endColumn": 39,
"lineCount": 1
}
},
{
"code": "reportCallIssue",
"range": {
"startColumn": 35,
"endColumn": 43,
"lineCount": 1
}
},
{
"code": "reportArgumentType",
"range": {
"startColumn": 35,
"endColumn": 43,
"lineCount": 1
}
},
{
"code": "reportArgumentType",
"range": {
Expand Down
19 changes: 10 additions & 9 deletions positronic/cfg/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import pos3

import positronic.cfg.ds as base_cfg
from positronic import keys
from positronic.cfg.ds import internal
from positronic.cfg.eval.real import tasks
from positronic.dataset.episode import Episode
Expand All @@ -20,7 +21,7 @@
def task_code(ep: Episode) -> str:
if 'eval.object' in ep:
return ep['eval.object']
match ep['task']:
match ep[keys.TASK]:
case tasks.TOWELS_TASK:
return 'Towels'
case tasks.SPOONS_TASK:
Expand Down Expand Up @@ -340,9 +341,9 @@ def box_distance_progress(episode: Episode) -> float | None:


def ee_pose_movement(episode: Episode) -> float | None:
if 'robot_state.ee_pose' not in episode:
if keys.EE_POSE not in episode:
return None
signal_values = episode['robot_state.ee_pose'].values()
signal_values = episode[keys.EE_POSE].values()
result = 0.0
prev_translation = signal_values[0][:3]
for ee_pose in signal_values[1:]:
Expand Down Expand Up @@ -486,20 +487,20 @@ def group_fn(episodes: list[Episode]):

def calculate_units(episode: Episode) -> int:
"""Estimates the number of pick-and-place operations. Vibe-coded heuristic."""
if episode['task'] in FIXED_ITEM_COUNTS:
return FIXED_ITEM_COUNTS[episode['task']]
if episode[keys.TASK] in FIXED_ITEM_COUNTS:
return FIXED_ITEM_COUNTS[episode[keys.TASK]]

if 'target_grip' in episode.signals:
grip_sig = episode.signals['target_grip']
elif 'grip' in episode.signals:
grip_sig = episode.signals['grip']
elif keys.GRIP in episode.signals:
grip_sig = episode.signals[keys.GRIP]
else:
return 0

if 'robot_state.ee_pose' not in episode.signals:
if keys.EE_POSE not in episode.signals:
return 0

pose_sig = episode.signals['robot_state.ee_pose']
pose_sig = episode.signals[keys.EE_POSE]

# Sample signals at 10Hz to reduce noise and computation
times = np.arange(episode.start_ts, episode.last_ts, int(1e8))
Expand Down
18 changes: 9 additions & 9 deletions positronic/cfg/codecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import configuronic as cfn

from positronic import geom
from positronic import geom, keys
from positronic.policy.observation import ObservationCodec

RotRep = geom.Rotation.Representation
Expand All @@ -19,27 +19,27 @@ def general_obs(


eepose_grip_obs = general_obs.override(
state_name='observation.state', state_features={'robot_state.ee_pose': 7, 'grip': 1}, image_size=(224, 224)
state_name='observation.state', state_features={keys.EE_POSE: 7, keys.GRIP: 1}, image_size=(224, 224)
)

joints_grip_obs = general_obs.override(
state_name='observation.state', state_features={'robot_state.q': 7, 'grip': 1}, image_size=(224, 224)
state_name='observation.state', state_features={keys.JOINTS: 7, keys.GRIP: 1}, image_size=(224, 224)
)

eepose_grip_joints_obs = general_obs.override(
state_name='observation.state',
state_features={'robot_state.ee_pose': 7, 'grip': 1, 'robot_state.q': 7},
state_features={keys.EE_POSE: 7, keys.GRIP: 1, keys.JOINTS: 7},
image_size=(224, 224),
)

eepose_obs = eepose_grip_obs.override(
image_mappings={'observation.images.left': 'image.wrist', 'observation.images.side': 'image.exterior'}
image_mappings={'observation.images.left': keys.WRIST_IMAGE, 'observation.images.side': keys.EXTERIOR_IMAGE}
)
joints_obs = joints_grip_obs.override(
image_mappings={'observation.images.left': 'image.wrist', 'observation.images.side': 'image.exterior'}
image_mappings={'observation.images.left': keys.WRIST_IMAGE, 'observation.images.side': keys.EXTERIOR_IMAGE}
)
eepose_joints_obs = eepose_grip_joints_obs.override(
image_mappings={'observation.images.left': 'image.wrist', 'observation.images.side': 'image.exterior'}
image_mappings={'observation.images.left': keys.WRIST_IMAGE, 'observation.images.side': keys.EXTERIOR_IMAGE}
)


Expand Down Expand Up @@ -96,14 +96,14 @@ def joint_delta_action(num_joints: int):
return JointDeltaAction(num_joints=num_joints)


traj_ee_action = absolute_pos_action.override(tgt_ee_pose_key='robot_state.ee_pose', tgt_grip_key='grip')
traj_ee_action = absolute_pos_action.override(tgt_ee_pose_key=keys.EE_POSE, tgt_grip_key=keys.GRIP)


@cfn.config(
solver='dls_limits',
tgt_ee_pose_key='robot_command.pose',
tgt_grip_key='target_grip',
current_q_key='robot_state.q',
current_q_key=keys.JOINTS,
num_joints=7,
)
def ik_joints_action(solver, tgt_ee_pose_key, tgt_grip_key, current_q_key, num_joints):
Expand Down
Loading
Loading