Skip to content
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

Scripts for auto-generating robot packages #3

Merged

Conversation

shaun-edwards
Copy link
Contributor

Initial PR for robot package generation scripts. See package README for a quick tutorial. Remaining items (not included in this PR)

  • Python documentation
  • Wiki tutorials

@shaun-edwards
Copy link
Contributor Author

@gavanderhoorn, can you review?

@shaun-edwards
Copy link
Contributor Author

An example of how to utilize this package for specific vendors can be found here.

@gavanderhoorn
Copy link
Member

@gavanderhoorn, can you review?

Will do, but later this week, if ok.

project(industrial_robot_pkg_gen)

find_package(catkin REQUIRED COMPONENTS
xacro
Copy link
Member

Choose a reason for hiding this comment

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

add rospy

Copy link
Member

Choose a reason for hiding this comment

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

But only if you actually use it, obviously.

<rosparam command="load" file="$(find @(package))/config/joint_names_@(model).yaml" />

<include file="$(find @[if prefix]@(prefix)_driver@[else]driver@[end if])/launch/robot_state.launch">
<arg name="robot_ip" value="$(arg robot_ip)" />
Copy link
Member

Choose a reason for hiding this comment

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

Extraneous whitespace.

@gavanderhoorn
Copy link
Member

Visual review: this looks ok. General comments:

  1. we should probably take this opportunity to get indentation right, once and for all
  2. should we use anon nodes for rviz, robot_state_publisher, joint_state_publisher and other nodes that get started from 'includable' launchfiles?
  3. scripts that deal with user input should probably do some more validation on that input. Especially names that get used in directory / file creation.
  4. Perhaps we want to extend the text printed after package generation a bit: call users attention to values that would need to be updated, parameters set, files added, etc.

@shaun-edwards
Copy link
Contributor Author

Thanks for taking the time to review.

  1. we should probably take this opportunity to get indentation right, once and for all

Agreed, I will fix (thanks for pointing them out in the source comments)

2.should we use anon nodes for rviz, robot_state_publisher, joint_state_publisher and other nodes that get started from 'includable' launchfiles?

I'm not sure where we draw the line. I've always used namespacing as you suggested in your comments. I'm inclined to keep it that way, but if you can come up with a good reason to use anonymous names, let me know.

3.scripts that deal with user input should probably do some more validation on that input. Especially names that get used in directory / file creation.

Agreed

4.Perhaps we want to extend the text printed after package generation a bit: call users attention to values that would need to be updated, parameters set, files added, etc.

Agreed. I'm open to suggestions here. I tried to avoid an explicit reliance on rospy, but I had trouble finding a terminal printing library that would emphasis the TODOs (this was the best i found )

Finally, I think I will change the options hierarchy. The current script has global options and sub-command options. This breaks up the help text and is not like any other ROS script I can find.

@gavanderhoorn
Copy link
Member

Thanks for taking the time to review.

no problem.

Trying to run this today, with the following command line:

rosrun industrial_robot_pkg_gen package_generator support m123ijk5g [email protected]

Results in the following trace:

Namespace(author=None, email='[email protected]', func=<bound method SupportSubCmd._execute of <industrial_robot_pkg_gen.cmd_line_interface.SupportSubCmd instance at 0xb726162c>>, model='m123ijk5g', num_joints=6, pkg_vers='0.0.1', prefix=None, t_paths=['industrial_robot_pkg_gen/resources'])
Template path(s): ['/home/user/ros/ws/src/industrial_experimental/industrial_robot_pkg_gen/resources']
Generating support directories for model:  m123ijk5g
Traceback (most recent call last):
  File "/home/user/ros/ws/src/industrial_experimental/industrial_robot_pkg_gen/scripts/package_generator", line 11, in <module>
    cli.run()
  File "/home/user/ros/ws/src/industrial_experimental/industrial_robot_pkg_gen/src/industrial_robot_pkg_gen/cmd_line_interface.py", line 38, in run
    args.func(args)
  File "/home/user/ros/ws/src/industrial_experimental/industrial_robot_pkg_gen/src/industrial_robot_pkg_gen/cmd_line_interface.py", line 98, in _execute
    generator.generate_package(args.prefix, args.model, args.num_joints, args.author, args.email, args.pkg_vers, template_paths)
  File "/home/user/ros/ws/src/industrial_experimental/industrial_robot_pkg_gen/src/industrial_robot_pkg_gen/generators.py", line 63, in generate_package
    em_params = self._load_em_params(package, model, num_joints, author, author_email, version, prefix)
  File "/home/user/ros/ws/src/industrial_experimental/industrial_robot_pkg_gen/src/industrial_robot_pkg_gen/generators.py", line 110, in _load_em_params
    em.expand('@{prefix = "' + prefix + '"}', em_params)
TypeError: cannot concatenate 'str' and 'NoneType' objects

prefix is indeed None. Adding --prefix=something (before the support command verb) lets it run successfully.

Finally, I think I will change the options hierarchy. The current script has global options and sub-command options. This breaks up the help text and is not like any other ROS script I can find.

yes, the current setup is a bit unintuitive. I had to look twice where the --prefix arg should go.

@gavanderhoorn
Copy link
Member

Also: I'm guessing this is currently 'debug' level output, but I think the "loading .. outputting .. generating .." text is a bit much. Perhaps some sort of summary at the end? "Generated N files, support package directory: /path/to/pkg/dir".

template_paths = self._eval_t_paths(args.t_paths)

# Author email used in place of empty author name
if(not args.author): args.author = args.email
Copy link
Member

Choose a reason for hiding this comment

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

Might be an idea to only use the part of the email address before the @. fi: [email protected] -> author = k.c.jones.

@shaun-edwards
Copy link
Contributor Author

@gavanderhoorn, please approve. Unaddressed items have been added to issue #4.

@shaun-edwards
Copy link
Contributor Author

+1....needed for ROSCon, so I'm merging myself.

shaun-edwards added a commit that referenced this pull request Sep 7, 2014
Scripts for auto-generating robot packages
@shaun-edwards shaun-edwards merged commit e04011f into ros-industrial-attic:hydro-devel Sep 7, 2014
@gavanderhoorn
Copy link
Member

Sorry about that, I was OoO. Will do a post-merge review next week.

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