Skip to content

Reimplemented server response-waiting functionalities inside the methods of move_group_interface#2863

Closed
CihatAltiparmak wants to merge 7 commits intomoveit:mainfrom
CihatAltiparmak:fix/move_group_interface_response_waiting_implementation
Closed

Reimplemented server response-waiting functionalities inside the methods of move_group_interface#2863
CihatAltiparmak wants to merge 7 commits intomoveit:mainfrom
CihatAltiparmak:fix/move_group_interface_response_waiting_implementation

Conversation

@CihatAltiparmak
Copy link
Copy Markdown
Member

Description

Firstly, this pull request is created in order to solve this issue #2859 . I still have to apply some test such that this PR works for move2_tutorials and so on. I already have tested this PR on rviz but i need to try this part more to see if any corruption occurs for this PR.

I haven't tested computeCartesianMethod, getPlannerParams, setPlannerParams(acutally there is a posibility that i tested getPlannerParam and setPlannerParam implicitly while testing rviz and getInterfaceDescriptions, or else rviz gets stuck related to node spining)

I have removed callback_thread_ because it's not necessary to yield CPU continuously during move_group_interface to work. Instead of this, i just made a implementation for spinning only when client send a request from move_group_interface. I also have added private node for move_group_interface to handle its client jobs.

I also have to give anonymous node name to pnode_ . I will work on this as well.

I need some review from variable naming to logic.

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extend the tutorials / documentation reference
  • Document API changes relevant to the user in the MIGRATION.md notes
  • Create tests, which fail without this PR reference
  • Include a screenshot if changing a GUI
  • While waiting for someone to review your request, please help review another open pull request to support the maintainers

…ods of move_group_interface

- Reimplemented getPlannerParams, setPlannerParams, getInterfaceDescription, getInterfaceDescriptions, plan, execute, move and computeCartesianPath methods of move_group_interface using rclcpp's own api
- Removed callback_thread_
@CihatAltiparmak CihatAltiparmak marked this pull request as draft June 7, 2024 19:43
@sjahr sjahr requested review from henningkayser and sjahr June 10, 2024 14:16
@CihatAltiparmak CihatAltiparmak marked this pull request as ready for review June 24, 2024 12:34
@CihatAltiparmak
Copy link
Copy Markdown
Member Author

CihatAltiparmak commented Jun 24, 2024

Hello @sjahr , it seems ready, but not ready for merging, i need a second eye. I only spin now when the methods like plan, execute etc. are called instead of spinning during lifetime of MoveGroupInterface instance. But I want to ask a question.

  • With my modification, This instance(move_group_interface) cannot be used concurrently like this because of both of two threads will try to spin separately. In old implementation, it seems below pseudo code works. Should we also support to be able to implement codes like below?
move_group_interface = MoveGroupInterface(...)
thread1[move_group_interface] = {move_group_interface.plan()}
thread2[move_group_interface] = {move_group_interface.plan()}

thread1.start()
thread2.start()

@CihatAltiparmak CihatAltiparmak mentioned this pull request Jun 24, 2024
6 tasks
Copy link
Copy Markdown
Contributor

@sjahr sjahr left a comment

Choose a reason for hiding this comment

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

Thanks! How have you tested this? With the move_group tutorial?


/** \brief Get the descriptions of all planning plugins loaded by the action server */
bool getInterfaceDescriptions(std::vector<moveit_msgs::msg::PlannerInterfaceDescription>& desc) const;
bool getInterfaceDescriptions(std::vector<moveit_msgs::msg::PlannerInterfaceDescription>& desc,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you mind adding documentation for the new duration parameter? I know the current documentation doesn't do that but this is a good chance to improve that

* target.
* This call is not blocking (does not wait for the execution of the trajectory to complete).
* \param [in] server_timeout period of time duration for waiting server's response. Function returns TIME_OUT in case
* that server doesn't answer whether the request is accepted or rejected within certain period of time \param [in]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unfortunately, pre-commit regularly messes with the doxygen formatting. Once the PR is ready to be merged and approved you'll need to fix issues like this

return false;
}

const auto& response = future_response.get();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just to be save, you should maybe check for the future validity before trying to get it, right?

return false;
}

const auto& response = future_response.get();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here


response = future_response.get();
for (unsigned int i = 0, end = response->params.keys.size(); i < end; ++i)
result[response->params.keys[i]] = response->params.values[i];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Prefere .at(i) over [i] to get an out of bounds segfault if something fails


moveit::core::MoveItErrorCode execute(const moveit_msgs::msg::RobotTrajectory& trajectory, bool wait,
const std::vector<std::string>& controllers = std::vector<std::string>())
const std::vector<std::string>& controllers,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sanity check, you're removing this because it is properly set in the header right?

server_timeout.to_chrono<std::chrono::duration<double>>()) !=
rclcpp::FutureReturnCode::SUCCESS)
{
RCLCPP_ERROR(logger_, "MoveGroupInterface::execute() get sent call failed :(");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You should make this error message more descriptive. Try to explain what failed and why

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You'll probably need to update all error messages like this

@CihatAltiparmak CihatAltiparmak marked this pull request as draft July 17, 2024 00:19
@github-actions
Copy link
Copy Markdown

This PR is stale because it has been open for 45 days with no activity. Please tag a maintainer for help on completing this PR, or close it if you think it has become obsolete.

@github-actions github-actions bot added the stale label Sep 18, 2024
@mergify
Copy link
Copy Markdown

mergify bot commented Sep 18, 2024

This pull request is in conflict. Could you fix it @CihatAltiparmak?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants