mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-21 19:49:49 +00:00
use image datasets and change ui
This commit is contained in:
committed by
Michel Aractingi
parent
bf08733068
commit
76ddd8b948
@@ -47,11 +47,6 @@ function App() {
|
|||||||
const saved = localStorage.getItem('openarms_config');
|
const saved = localStorage.getItem('openarms_config');
|
||||||
if (saved) {
|
if (saved) {
|
||||||
const loadedConfig = JSON.parse(saved);
|
const loadedConfig = JSON.parse(saved);
|
||||||
// If OpenArms Mini is selected, ensure followers are set to can0/can1
|
|
||||||
if (loadedConfig.leader_type === 'openarms_mini') {
|
|
||||||
loadedConfig.follower_left = 'can0';
|
|
||||||
loadedConfig.follower_right = 'can1';
|
|
||||||
}
|
|
||||||
setConfig(prev => ({ ...prev, ...loadedConfig }));
|
setConfig(prev => ({ ...prev, ...loadedConfig }));
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -93,11 +88,6 @@ function App() {
|
|||||||
if (!localStorage.getItem('openarms_config')) {
|
if (!localStorage.getItem('openarms_config')) {
|
||||||
setConfig(prev => {
|
setConfig(prev => {
|
||||||
const merged = { ...data.config, ...prev };
|
const merged = { ...data.config, ...prev };
|
||||||
// If OpenArms Mini is selected, ensure followers are set to can0/can1
|
|
||||||
if (merged.leader_type === 'openarms_mini') {
|
|
||||||
merged.follower_left = 'can0';
|
|
||||||
merged.follower_right = 'can1';
|
|
||||||
}
|
|
||||||
localStorage.setItem('openarms_config', JSON.stringify(merged));
|
localStorage.setItem('openarms_config', JSON.stringify(merged));
|
||||||
return merged;
|
return merged;
|
||||||
});
|
});
|
||||||
@@ -360,14 +350,6 @@ function App() {
|
|||||||
// Update config and save
|
// Update config and save
|
||||||
const updateConfig = (key, value) => {
|
const updateConfig = (key, value) => {
|
||||||
const updated = { ...config, [key]: value };
|
const updated = { ...config, [key]: value };
|
||||||
|
|
||||||
if (key === 'leader_type') {
|
|
||||||
if (value === 'openarms_mini') {
|
|
||||||
updated.follower_left = 'can0';
|
|
||||||
updated.follower_right = 'can1';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setConfig(updated);
|
setConfig(updated);
|
||||||
saveConfig(updated);
|
saveConfig(updated);
|
||||||
};
|
};
|
||||||
@@ -398,27 +380,6 @@ function App() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (config.leader_type === 'openarms_mini') {
|
if (config.leader_type === 'openarms_mini') {
|
||||||
discoverUsbPorts();
|
discoverUsbPorts();
|
||||||
// Explicitly set follower CAN interfaces when using OpenArms Mini
|
|
||||||
// Followers MUST use can0 = left arm, can1 = right arm
|
|
||||||
// Force these values even if they were previously different
|
|
||||||
const updated = {
|
|
||||||
...config,
|
|
||||||
follower_left: 'can0', // Explicitly set left follower to can0
|
|
||||||
follower_right: 'can1' // Explicitly set right follower to can1
|
|
||||||
};
|
|
||||||
setConfig(updated);
|
|
||||||
saveConfig(updated);
|
|
||||||
} else {
|
|
||||||
// When switching back to OpenArms, restore CAN interface defaults
|
|
||||||
const updated = {
|
|
||||||
...config,
|
|
||||||
leader_left: canInterfaces.includes(config.leader_left) ? config.leader_left : 'can0',
|
|
||||||
leader_right: canInterfaces.includes(config.leader_right) ? config.leader_right : 'can1',
|
|
||||||
follower_left: 'can2', // OpenArms standard: followers on can2/can3
|
|
||||||
follower_right: 'can3'
|
|
||||||
};
|
|
||||||
setConfig(updated);
|
|
||||||
saveConfig(updated);
|
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [config.leader_type]);
|
}, [config.leader_type]);
|
||||||
@@ -563,51 +524,30 @@ function App() {
|
|||||||
<div className="config-section">
|
<div className="config-section">
|
||||||
<h3>Follower Interfaces (CAN)</h3>
|
<h3>Follower Interfaces (CAN)</h3>
|
||||||
|
|
||||||
{config.leader_type === 'openarms_mini' && (
|
|
||||||
<div style={{
|
|
||||||
backgroundColor: '#fff4e6',
|
|
||||||
padding: '0.75rem',
|
|
||||||
borderRadius: '4px',
|
|
||||||
marginBottom: '0.75rem',
|
|
||||||
fontSize: '0.9rem',
|
|
||||||
border: '1px solid #ffd699'
|
|
||||||
}}>
|
|
||||||
🔒 <strong>Auto-assigned:</strong> Follower ports are fixed as can0 (left) and can1 (right) when using OpenArms Mini
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div className="config-grid">
|
<div className="config-grid">
|
||||||
<label>
|
<label>
|
||||||
Follower Left
|
Follower Left
|
||||||
<select
|
<select
|
||||||
value={config.leader_type === 'openarms_mini' ? 'can0' : config.follower_left}
|
value={config.follower_left}
|
||||||
onChange={(e) => updateConfig('follower_left', e.target.value)}
|
onChange={(e) => updateConfig('follower_left', e.target.value)}
|
||||||
disabled={isRecording || robotsReady || config.leader_type === 'openarms_mini'}
|
disabled={isRecording || robotsReady}
|
||||||
>
|
>
|
||||||
{config.leader_type === 'openarms_mini' ? (
|
{canInterfaces.map((iface) => (
|
||||||
<option value="can0">can0 (Auto-assigned)</option>
|
<option key={iface} value={iface}>{iface}</option>
|
||||||
) : (
|
))}
|
||||||
canInterfaces.map((iface) => (
|
|
||||||
<option key={iface} value={iface}>{iface}</option>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
Follower Right
|
Follower Right
|
||||||
<select
|
<select
|
||||||
value={config.leader_type === 'openarms_mini' ? 'can1' : config.follower_right}
|
value={config.follower_right}
|
||||||
onChange={(e) => updateConfig('follower_right', e.target.value)}
|
onChange={(e) => updateConfig('follower_right', e.target.value)}
|
||||||
disabled={isRecording || robotsReady || config.leader_type === 'openarms_mini'}
|
disabled={isRecording || robotsReady}
|
||||||
>
|
>
|
||||||
{config.leader_type === 'openarms_mini' ? (
|
{canInterfaces.map((iface) => (
|
||||||
<option value="can1">can1 (Auto-assigned)</option>
|
<option key={iface} value={iface}>{iface}</option>
|
||||||
) : (
|
))}
|
||||||
canInterfaces.map((iface) => (
|
|
||||||
<option key={iface} value={iface}>{iface}</option>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -410,8 +410,8 @@ def initialize_robot_systems(config: RecordingConfig):
|
|||||||
if key.endswith(".pos"):
|
if key.endswith(".pos"):
|
||||||
action_features_hw[key] = value
|
action_features_hw[key] = value
|
||||||
|
|
||||||
action_features = hw_to_dataset_features(action_features_hw, "action")
|
action_features = hw_to_dataset_features(action_features_hw, "action", use_video=False)
|
||||||
obs_features = hw_to_dataset_features(follower.observation_features, "observation")
|
obs_features = hw_to_dataset_features(follower.observation_features, "observation", use_video=False)
|
||||||
dataset_features = {**action_features, **obs_features}
|
dataset_features = {**action_features, **obs_features}
|
||||||
|
|
||||||
# Create dataset
|
# Create dataset
|
||||||
|
|||||||
Reference in New Issue
Block a user