Skip to content

Commit

Permalink
Merge pull request #14 from ichiro-its/hotfix/fix-walking-set-config
Browse files Browse the repository at this point in the history
[Hotfix] - Fix Walking Set Config
  • Loading branch information
hiikariri authored Jul 7, 2024
2 parents 51d6a9b + a2d3923 commit 88a87fd
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 9 deletions.
19 changes: 16 additions & 3 deletions src/InitSettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Item = styled(Paper)(({ theme }) => ({

function InitSettings() {
const {
GRPC_WEB_API_URL, published, setPublished, setKinematic, setWalking,
GRPC_WEB_API_URL, published, setPublished, setKinematicValue, setWalkingValue,
} = useContext(WalkContext);

const client = new aruku_interfaces.ConfigClient(GRPC_WEB_API_URL, null, null);
Expand All @@ -34,8 +34,21 @@ function InitSettings() {
if (err) {
console.log(`Unexpected error: code = ${err.code}, message = "${err.message}"`);
} else {
setKinematic(JSON.parse(response.array[0]));
setWalking(JSON.parse(response.array[1]));
const kinematic = JSON.parse(response.array[0]);
const walking = JSON.parse(response.array[1]);

Object.keys(kinematic).forEach(name => {
Object.entries(kinematic[name]).forEach(([key, value]) => {
console.log(typeof value);
setKinematicValue(name, key, value);
});
})

Object.keys(walking).forEach(name => {
Object.entries(walking[name]).forEach(([key, value]) => {
setWalkingValue(name, key, value);
});
})
}
});
};
Expand Down
19 changes: 16 additions & 3 deletions src/WalkSettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Item = styled(Paper)(({ theme }) => ({

function WalkSettings() {
const {
GRPC_WEB_API_URL, published, walking, kinematic, setPublished, setKinematic, setWalking,
GRPC_WEB_API_URL, published, walking, kinematic, setPublished, setKinematicValue, setWalkingValue,
} = useContext(WalkContext);

const client = new aruku_interfaces.ConfigClient(GRPC_WEB_API_URL, null, null);
Expand All @@ -37,8 +37,21 @@ function WalkSettings() {
if (err) {
console.log(`Unexpected error: code = ${err.code}, message = "${err.message}"`);
} else {
setKinematic(JSON.parse(response.array[0]));
setWalking(JSON.parse(response.array[1]));
const kinematic = JSON.parse(response.array[0]);
const walking = JSON.parse(response.array[1]);

Object.keys(kinematic).forEach(name => {
Object.entries(kinematic[name]).forEach(([key, value]) => {
console.log(typeof value);
setKinematicValue(name, key, value);
});
})

Object.keys(walking).forEach(name => {
Object.entries(walking[name]).forEach(([key, value]) => {
setWalkingValue(name, key, value);
});
})
}
});
};
Expand Down
19 changes: 16 additions & 3 deletions src/components/ReloadButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import WalkContext from '../context/WalkContext';

function ReloadButton() {
const {
GRPC_WEB_API_URL, setPublished, setKinematic, setWalking,
GRPC_WEB_API_URL, setPublished, setKinematicValue, setWalkingValue,
} = useContext(WalkContext);

const client = new aruku_interfaces.ConfigClient(GRPC_WEB_API_URL, null, null);
Expand All @@ -21,8 +21,21 @@ function ReloadButton() {
if (err) {
console.log(`Unexpected error: code = ${err.code}, message = "${err.message}"`);
} else {
setKinematic(JSON.parse(response.array[0]));
setWalking(JSON.parse(response.array[1]));
const kinematic = JSON.parse(response.array[0]);
const walking = JSON.parse(response.array[1]);

Object.keys(kinematic).forEach(name => {
Object.entries(kinematic[name]).forEach(([key, value]) => {
console.log(typeof value);
setKinematicValue(name, key, value);
});
})

Object.keys(walking).forEach(name => {
Object.entries(walking[name]).forEach(([key, value]) => {
setWalkingValue(name, key, value);
});
})
}
});

Expand Down

0 comments on commit 88a87fd

Please sign in to comment.