-
Notifications
You must be signed in to change notification settings - Fork 948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read and write ROS controllers yaml file #951
Read and write ROS controllers yaml file #951
Conversation
96d30f6
to
4979db2
Compare
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.
Great work! Sorry for the intense review, I just care a lot about quality :)
{ | ||
std::string name_; // controller name | ||
std::string type_; // controller type | ||
std::vector<std::string> joints_; // joints names this controller |
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.
comment: "joints controlled by this controller"
/** | ||
* Controllers settings which may be set in the config files | ||
*/ | ||
struct Controller |
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.
more descriptive name for the struct... maybe "ROSControlConfig"?
"Controller" is way too generic
@@ -221,6 +231,15 @@ class MoveItConfigData | |||
/// Email of the author of this config | |||
std::string author_email_; | |||
|
|||
/// Name of the group that holds all the joints to be used by sim contollers | |||
std::string controllers_initial_group_; |
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.
rename sim_controllers_initial_group_
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.
I removed the sim_controllers
part as it is still to be decided which is the best screen to put them, I put it in the description.
std::string controllers_initial_group_; | ||
|
||
/// Name of the initial pose to be used by sim contollers | ||
std::string controllers_initial_pose_; |
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.
sim_controllers_...
/// Name of the initial pose to be used by sim contollers | ||
std::string controllers_initial_pose_; | ||
|
||
/// Controllers config data |
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.
more descriptive comment, define "controller" please
void editSelected(); | ||
|
||
/// Called from Double List widget to highlight a joint | ||
// void previewClickedJoint( std::string name ); |
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.
remove
@@ -282,6 +282,7 @@ void PlanningGroupsWidget::loadGroupsTree() | |||
btn_delete_->hide(); | |||
} | |||
|
|||
current_edit_group_.clear(); |
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.
these kinds of changes should be in a separate PR... this one is way too big already
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.
I wasn't so sure too, but from the feedback I got from PR where I removed the unused variable, "it is advised not to open too small PR"
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.
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.
Yes there's a middle ground :-)
One line change is a bit small, but many hundreds of lines is getting large.
@@ -431,6 +431,10 @@ bool StartScreenWidget::loadExistingFiles() | |||
.append(kinematics_yaml_path.make_preferred().native().c_str())); | |||
} | |||
|
|||
fs::path controllers_yaml_path = config_data_->config_pkg_path_; |
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.
add comment explaining what this is
} | ||
|
||
// ****************************************************************************************** | ||
// Add a Follow Joint Trajectory action Controller for each Planning Group |
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.
"Add a FollowJointTrajectory action controller from ros_control for each Planning Group"
// ****************************************************************************************** | ||
// Add a Follow Joint Trajectory action Controller for each Planning Group | ||
// ****************************************************************************************** | ||
void ControllersWidget::addDefaultControllers() |
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.
can you also, by default, add a joint_state_controller/JointStateController? those are equally important
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.
Yes I already do that in moveit_data_config
@ https://github.com/ros-planning/moveit/pull/951/files#diff-b722193e66bd85583ac56b9d68186447R666
12067a5
to
09d4cac
Compare
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.
This is looking really good! All it needs is the unit test.
@@ -220,6 +221,7 @@ private Q_SLOTS: | |||
EndEffectorsWidget* efw_; | |||
VirtualJointsWidget* vjw_; | |||
PassiveJointsWidget* pjw_; | |||
ControllersWidget* cw_; |
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.
these abbreviated variable names are bad practice, but they are my fault 7 years ago when I was a younger programmer. can you add a TODO to make them not abbreviated? I don't want to make this PR any bigger itself.
c385519
to
87f7177
Compare
As suggested by @davecoleman this PR now does only deal with reading and writing the |
moveit::core::RobotModelConstPtr robot_model; | ||
}; | ||
|
||
TEST(MoveItConfigData, ReadingControllers) |
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.
The test is still not completely implemented, I've a problem setting the robot_model
in config_data
. I've spend some time trying to figure out how to set it in the test, so for efficiency I thought I would ask for ideas here.
find_package(moveit_resources REQUIRED) | ||
include_directories(${moveit_resources_INCLUDE_DIRS}) | ||
|
||
catkin_add_gtest(test_writting_ros_controllers test/moveit_config_data_test.cpp) |
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.
"writing" (misspelled)
@@ -459,107 +614,6 @@ std::vector<OMPLPlannerDescription> MoveItConfigData::getOMPLPlanners() | |||
return planner_des; | |||
} | |||
|
|||
// ****************************************************************************************** |
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.
just curious - why move these files? it makes reviewing harder because i can't tell what has actually changed
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.
Sorry I didn't understand, which files?
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.
oops i mean functions.... why move the functions to a different location in the file?
#include <boost/filesystem.hpp> // for creating folders/files | ||
#include <moveit/setup_assistant/tools/moveit_config_data.h> | ||
|
||
// #include <moveit/setup_assistant/src/widgets/controllers_widget.h> |
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.
remove
|
||
// #include <moveit/setup_assistant/src/widgets/controllers_widget.h> | ||
|
||
// This tests adding FollowJointTrajectory controllers for each planning group to ros_controller.yaml |
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.
"This test adds..."
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.
This tests adding FollowJointTrajectory
controllers, isn't that Okay?
|
||
srdf_model.reset(new srdf::Model()); | ||
std::string xml_string; | ||
std::fstream xml_file((res_path / "pr2_description/urdf/robot.xml").string().c_str(), std::fstream::in); |
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.
lets move away from using the PR2 but rather the Franka Emika robot instead. we might need to add Franka Emika into moveit_resources. @mlautman any opinions?
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.
I'm strongly in favor of replacing the PR2 with the Panda wherever possible. @mohmadAyman a small side project that would be a huge improvement would be to add the Panda to moveit_resources
so that it can be used in this test.
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.
Sure, will add it in a separate PR.
// Read ros_controllers.yaml | ||
// config_data_->inputROSControllersYAML("ros_controllers.yaml"); | ||
|
||
// Verify that we read the file correctly |
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.
seems to be on the right track!
87f7177
to
cb70c23
Compare
cb70c23
to
ad63be1
Compare
// ****************************************************************************************** | ||
// Output kinematic config files | ||
// ****************************************************************************************** | ||
bool MoveItConfigData::outputKinematicsYAML(const std::string& file_path) |
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.
@davetcoleman
I didnt change anything in these functions, does git sees that as a diff because I've added the setRobotModel
function above?
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.
not sure what you mean 'diff'?
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.
Looks like you moved them up in the file? I think this is why git sees this as a large diff.
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.
Sorry just saw the comment, I mean the difference that git
saw.
Ping @davetcoleman @mcevoyandy |
void MoveItConfigData::setRobotModel(robot_model::RobotModelPtr robot_model) | ||
{ | ||
robot_model_ = robot_model; | ||
robot_model_const_ = robot_model; |
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.
just curious: do you know why i originally had to add a const and non-const version of robot_model? this is very hacky. shame on me (~6 years ago)
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 the robot_model_const_
is only used in getRobotModel
, while robot_model_
is used whenever we are to edit sth in the robot model.
We can remove robot_model_const_
and just const_cast
the robot_model_
in the getRobotModel()
, does that sound better?
// ****************************************************************************************** | ||
// Output kinematic config files | ||
// ****************************************************************************************** | ||
bool MoveItConfigData::outputKinematicsYAML(const std::string& file_path) |
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.
not sure what you mean 'diff'?
@mcevoyandy please review |
@davetcoleman lgtm. |
Great job @mohmadAyman !! |
Thank you 😺 |
Description
Adding functions to read and write
ros_contollers.yaml
file.Adding an automated way to add FollowJointTrajectory action controller for each planning group, e.g.
@davetcoleman @mcevoyandy
Checklist