GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — able to get inner content by utilizing GetJsonValueByPath by cielavenir · Pull Request #115 · mujin/controllerclientcpp

Conversation

@cielavenir

@cielavenir cielavenir commented Oct 18, 2022

Copy link
Copy Markdown
Contributor

these will be possible

double max_tool_speed_rot = object->Get<double>("robot_motion_parameters/max_tool_speed_rot");
string ikTypeName = object->Get<string>("robot_motion_parameters/ikTypeName");
map<string, vector<int>> params = object->Get<map<string, vector<int>>>("robot_motion_parameters/int_parameters");

note that we cannot do object->Get<map<string, map<string, vector<int>>>>("robot_motion_parameters");. This is C++ limitation.


We will use GetJsonValueByPath, so we add leading / to field variable (after copying to temporary variable).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cielavenir
able to get inner content by utilizing GetJsonValueByPath
52fe8cb
@cielavenir
cielavenir requested review from kanbouchou, rdiankov and ziyan October 18, 2022 03:27
@cielavenir cielavenir assigned rdiankov Oct 18, 2022
@ziyan

ziyan commented Oct 18, 2022

Copy link
Copy Markdown
Member
  1. who is the user of this?
  2. so much small std::string copy and creation
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rdiankov
rdiankov reviewed Nov 2, 2022
View reviewed changes
Comment thread include/mujincontrollerclient/mujincontrollerclient.h Outdated
if(path[0]!='/') {
path = std::string("/")+field;
}
std::string fieldToConstraint = path.substr(1);

@rdiankov rdiankov Nov 2, 2022

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cielavenir looks pretty inefficient with creating all these strings on the heap, especially when rapidjson doesn't require std::string

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@cielavenir cielavenir Nov 2, 2022

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, alternative ideas are:

  1. use GetJsonValueByPath only when field contains "/"
  2. add a new API named GetPath

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@cielavenir cielavenir Nov 2, 2022

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added GetPath now

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cielavenir

cielavenir commented Nov 2, 2022

Copy link
Copy Markdown
Contributor Author

@ziyan could you check https://github.com/mujin/controllerclientcpp/blob/savebackup/samples/mujinupdatepulseoffset.cpp#L204 ? /cc @kanbouchou

Should I add GetPath()?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cielavenir
separate to GetPath method
813c258
@cielavenir
cielavenir requested a review from lazydroid November 2, 2022 06:42
@cielavenir

cielavenir commented Nov 2, 2022

Copy link
Copy Markdown
Contributor Author

btw I realized std::string fieldToConstraintForCallGet = path.substr(1, path.find('/', 1)); is better, please tell me such matter(s) /cc @lazydroid

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@rdiankov rdiankov rdiankov left review comments
@ziyan ziyan Awaiting requested review from ziyan
@kanbouchou kanbouchou Awaiting requested review from kanbouchou
@lazydroid lazydroid Awaiting requested review from lazydroid

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@rdiankov rdiankov

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@cielavenir @ziyan @rdiankov
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.