ROS Controllers screen added to SA#994
Conversation
cd43756 to
0bdb47e
Compare
|
If pull request #969 turned to need the new struct to be a class, this will too. |
|
Friendly ping @davetcoleman |
| bool outputFakeControllersYAML(const std::string& file_path); | ||
| void outputFollowJointTrajectoryYAML(YAML::Emitter& emitter); | ||
| void outputFollowJointTrajectoryYAML(YAML::Emitter& emitter, | ||
| std::vector<ROSControlConfig>* ros_controllers_config_copy); |
There was a problem hiding this comment.
Because this function modifies the ros_controllers_config_ object, we don't want to modify the original object here.
| bool outputJointLimitsYAML(const std::string& file_path); | ||
| bool outputFakeControllersYAML(const std::string& file_path); | ||
| void outputFollowJointTrajectoryYAML(YAML::Emitter& emitter); | ||
| void outputFollowJointTrajectoryYAML(YAML::Emitter& emitter, |
There was a problem hiding this comment.
add function documentation for these args
| ROSControlConfig* findROSControllerByName(const std::string& controller_name); | ||
|
|
||
| /** | ||
| * delete ros controller by name |
| if (!input_stream.good()) | ||
| { | ||
| ROS_ERROR_STREAM_NAMED("ros_controller.yaml", "Unable to open file for reading " << file_path); | ||
| ROS_INFO_STREAM_NAMED("ros_controller.yaml", "Does not exist " << file_path); |
There was a problem hiding this comment.
shouldn't this be an error or warning?
There was a problem hiding this comment.
I agree a warning maybe better here, initially the package might not has a ros_controllers.yaml, so a warn would do I believe.
| // Read the robot name | ||
|
|
||
| for (YAML::const_iterator controller_it = doc.begin(); controller_it != doc.end(); ++controller_it) | ||
| for (YAML::const_iterator map_it = doc.begin(); map_it != doc.end(); ++map_it) |
There was a problem hiding this comment.
can you make map_it more descriptive / longer?
| } | ||
| else | ||
| } | ||
| else |
There was a problem hiding this comment.
this is very difficult to follow, please split into helper functions
|
|
||
| // ****************************************************************************************** | ||
| // Find controller by name | ||
| // Find ros controller by name |
| } | ||
|
|
||
| } // namespace No newline at end of file | ||
| } // namespace\ |
| return; | ||
| has_loaded = true; | ||
|
|
||
| const std::array<std::string, 10> types = { "effort_controllers/JointTrajectoryController", |
| * copyright notice, this list of conditions and the following | ||
| * disclaimer in the documentation and/or other materials provided | ||
| * with the distribution. | ||
| * * Neither the name of Willow Garage nor the names of its |
There was a problem hiding this comment.
note "Willow Garage" is still in the license here and elsewhere. replace with your name
0bdb47e to
ec5004b
Compare
|
@davetcoleman |
| bool MoveItConfigData::outputROSControllersYAML(const std::string& file_path) | ||
| { | ||
| // Copy ros_control_config_ to a new vector to avoid modifying it | ||
| std::vector<ROSControlConfig> ros_controllers_config_copy(ros_controllers_config_); |
There was a problem hiding this comment.
instead of copy can we call this ros_controllers_config_output?
| * @return void | ||
| */ | ||
| void outputFollowJointTrajectoryYAML(YAML::Emitter& emitter, | ||
| std::vector<ROSControlConfig>* ros_controllers_config_copy); |
There was a problem hiding this comment.
instead of a pointer, pass this in by reference
| // Loop through all controllers | ||
| if (const YAML::Node& controller = controller_it->second) | ||
| for (YAML::const_iterator controller_it = controllers.begin(); controller_it != controllers.end(); | ||
| ++controller_it) |
There was a problem hiding this comment.
move the contents of this for loop into a helper function to make this more readable... named perhaps processROSController(controller_it, ...)
| } | ||
|
|
||
| // ****************************************************************************************** | ||
| // Deletes a ros controller by name |
| // Gets ros_controllers_config_ vector | ||
| // ****************************************************************************************** | ||
| std::vector<ROSControlConfig> MoveItConfigData::getROSControllers() | ||
| std::vector<ROSControlConfig>* MoveItConfigData::getROSControllers() |
There was a problem hiding this comment.
return by reference, not pointer
|
Looks like your other PR caused merge conflicts. otherwise its looking very close! @mcevoyandy please review |
ec5004b to
2fc77a2
Compare
|
@davetcoleman |
| * Helper function for writing follow joint trajectory ROS controllers to ros_controllers.yaml | ||
| * @param YAML Emitter - yaml emitter used to write the config to the ROS controllers yaml file | ||
| * @param vector<ROSControlConfig> - a copy of ROS controllers config which will be modified in the function | ||
| * @return void |
There was a problem hiding this comment.
no need to have this line @return if its void, please remove
| * Helper function for writting Joint State ROS controllers to ros_controller.yaml | ||
| * @param YAML Emitter - yaml emitter used to write the config to the ROS controllers yaml file | ||
| * @param vector<ROSControlConfig> - a copy of ROS controllers config which will be modified in the function | ||
| * @return void |
There was a problem hiding this comment.
no need to have this line @return if its void, please remove
|
|
||
| /** | ||
| * Helper function for parsing ros_controllers.yaml file | ||
| * @param YAML::Node - controllers to be parsed |
There was a problem hiding this comment.
"controllers" --> "individual controller"
|
|
||
| /** | ||
| * \brief Add a Follow Joint Trajectory action Controller for each Planning Group | ||
| * \return bool if controllers were added to the ros_controllers_config_ data structure |
|
|
||
| /** | ||
| * \brief Add a Joint State Controller for each Planning Group | ||
| * \return bool if controllers were added to the ros_controllers_config_ data structure |
| } | ||
|
|
||
| // ****************************************************************************************** | ||
| // Helper function for parsing ros_controllers.yaml file |
There was a problem hiding this comment.
be more descriptive in comment, currently this comment is identical to line 1272. what is different about this function from processROSControllers?
| void ControllerEditWidget::loadControllersTypesComboBox() | ||
| { | ||
| // Only load this combo box once | ||
| static bool has_loaded = false; |
There was a problem hiding this comment.
do not use static, rather make this a member variable of the class
| /* Author: Mohamad Ayman */ | ||
|
|
||
| #ifndef MOVEIT_ROS_MOVEIT_SETUP_ASSISTANT_WIDGETS_CONTROLLER_EDIT_WIDGET_ | ||
| #define MOVEIT_ROS_MOVEIT_SETUP_ASSISTANT_WIDGETS_CONTROLLER_EDIT_WIDGET_ |
There was a problem hiding this comment.
add "H" at end: http://wiki.ros.org/CppStyleGuide#A.23ifndef_guards
|
|
||
| // ****************************************************************************************** | ||
| // Qt Components | ||
| // ****************************************************************************************** |
There was a problem hiding this comment.
this components should be private, not public
| virtual void focusGiven(); | ||
|
|
||
| // ****************************************************************************************** | ||
| // Qt Components |
|
Review from runtime:
|
1330ee8 to
a00ce3d
Compare
|
Is this ready for re-review? |
|
Yes it is ready @davetcoleman |
|
This segfaults when I choose a perception sensor then change screens.
|
|
@davetcoleman I believe this makes sense, since the pull request #1013 [fix bug in perception screen] is not merged yet. |
davetcoleman
left a comment
There was a problem hiding this comment.
Tested locally and it works :)
| // If the setting has joints then it is a controller that needs to be parsed | ||
| if (!control_setting.joints_.empty()) | ||
| { | ||
| if (const YAML::Node& urdf_node = controller_it->second["type"]) |
There was a problem hiding this comment.
I don't think I can put more than one condition in an if statement that has initialization in it, I'm not 100% if it is not possible, but I've tried and it didn't work.
| bool MoveItConfigData::outputROSControllersYAML(const std::string& file_path) | ||
| { | ||
| // Copy ros_control_config_ to a new vector to avoid modifying it | ||
| std::vector<ROSControlConfig> ros_controllers_config_output(ros_controllers_config_); |
There was a problem hiding this comment.
Cand the copy of outputFollowJointTrajectoryYAML be moved into outputFollowJointTrajectoryYAML()? It seems it's not used elsewhere in the function. Also, can you add a comment as to why you are erasing things from the copy?
There was a problem hiding this comment.
I believe you meant ros_controllers_config_output which is a copy of ros_controllers_config_, It is used in the rest of the function outputROSControllersYAML, thats why it is defined there not in outputFollowJointTrajectoryYAML.
I'll add a comment the explains why I erase the controller that I write to the file.
There was a problem hiding this comment.
addressed all comments.
There was a problem hiding this comment.
ros_controllers_config_output is not used in outputROSControllersYAML(), only in outputFollowJointTrajectoryYAML(). please move it there since its only actually used in that helper function
There was a problem hiding this comment.
ros_controllers_config_output is used in outputROSControllersYAML() here .
| // Writes Follow Joint Trajectory ROS controllers to ros_controller.yaml | ||
| outputFollowJointTrajectoryYAML(emitter, ros_controllers_config_output); | ||
|
|
||
| { |
There was a problem hiding this comment.
thats right, thats scoping didn't really make sense
a00ce3d to
c5c667c
Compare
c5c667c to
ba56e13
Compare
|
cherry-picked to melodic great job! |
* Added ros controllers screen to SA * GUI and code fixes * added a ros_control namespace * better docs, moved variables from public to private * reverted joint state controllers change * adding a minor comment
* Added ros controllers screen to SA * GUI and code fixes * added a ros_control namespace * better docs, moved variables from public to private * reverted joint state controllers change * adding a minor comment

Description
This screen main purpose is to automate the process of generating ROS Controllers configuration.
The generated ROS Controllers config is launched by
ros_controllers.launchwhich makes simulating a robot ingazebopossible.This PR is part of upgrading the Setup Assistant.
Checklist