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

Launch packages from HMI display menu Entry "My Program" #13

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sumedhreddy90
Copy link
Contributor

@sumedhreddy90 sumedhreddy90 commented Aug 10, 2022

This PR enables users to launch their program/ programs from HMI display of TB4 by pressing "My Program" on the available menu list.
Usage:

  1. Launch Tb4 Ignition bringup by running below launch file
ros2 launch hmi_simulation_project_manager tb4_ignition.launch.py 
  1. run hmi_simulation_project_manager manager script before pressing the button on the turtlebot4 display. By running this script, I am initiating all the required node to run a motion planner
ros2 run hmi_simulation_project_manager manager

Note:

  1. In this example, we are launching unit02_simulation_motion_planner as an example
  2. Make sure to source install Turtlebot4 packages from below PR
    Add Menu Entry to HMI display "My Program" turtlebot4#24

@sumedhreddy90
Copy link
Contributor Author

[TODO] Launch multiple launch files one after the other

@kscottz kscottz self-assigned this Aug 12, 2022
Copy link
Collaborator

@kscottz kscottz left a comment

Choose a reason for hiding this comment

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

Something seems really fishy here. I think you may have over-complicating or over-thinking how this could happen. Alternatively I may not have a sufficient understanding of the situation.

I found a few things I think are suspect:

  • I don't understand why this PR has copies of an existing package's messages.
  • It is unclear to me why you are using subprocess to kick off a launch file.
  • Is there a second pull request that updates the turtlebot4 menu with menu options?
  • How are students supposed to add their project to this node.

I don't understand why we can't make a set of simple menu items on the TurtleBot screen and those options issue a message. On the lesson side a simple node that listens for those messages and triggers a student project (using a message / service call/ or action call) should be sufficient.

Let's find some time to chat on Monday.

# Then return Success message upon successful request exectution
if(request.my_program_on):
self.get_logger().info('My Program Mode is turned on')
subprocess.call(["bash", '/home/sumedh/workspace/src/TurtleBot4Lessons/projects/hmi_simulation_project_manager/config/auto_launch.bash'])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Uhhhhhhhhhhhh. This is a hard coded path. I am not sure how I feel about calling subprocess to run a script from inside a node.

Did you follow this pattern from someone else? At bare minimum the bath needs to be relative.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed the hardcode path. I generally prefer going with relative path. However, the relative path isnt working. Hence, during testing, I used the complete path. In my recent commits, I changed it to relative path.
Yes, calling subprocess to run a script is possible and is friendly. Please refer to one of the implementation by Tully foote and Alejandro in one of their repo's.
https://github.com/osrf/drone_demo/blob/master/sitl_launcher/scripts/launch_drone_ros2.py
Please refer to line number 172

projects/turtlebot4_msgs/CHANGELOG.rst Outdated Show resolved Hide resolved
@@ -0,0 +1,29 @@
from setuptools import setup
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is unclear to me what this is for. Why does a ROS node need a setup.py file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please refer to https://docs.ros.org/en/galactic/Tutorials/Intermediate/Launch/Launch-system.html. This import is an inbuilt packages used to setup the ROS2 package. This is generated when we create a new ROS2 package ros2 pkg create --build-type ament_python <package_name>

projects/turtlebot4_msgs/msg/UserButton.msg Outdated Show resolved Hide resolved
projects/turtlebot4_msgs/msg/UserDisplay.msg Outdated Show resolved Hide resolved
@@ -0,0 +1,76 @@
from asyncio import FastChildWatcher
import string
from tkinter.messagebox import NO
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

You seem to have a lot of extra import statements that aren't used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These imports seems to be like auto generated by visual studio code. I will remove them

description='Goal position in X and Y coordinates')]


def generate_launch_description():
Copy link
Collaborator

Choose a reason for hiding this comment

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

My understanding of launch isn't that great. Can you explain a bit about what is going on here?

Copy link
Contributor Author

@sumedhreddy90 sumedhreddy90 Aug 15, 2022

Choose a reason for hiding this comment

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

Here, In this example, as a sample I am firing Nodes required for running motion planner algorithm. The TODO is that the program manager launch will make sure to maintain a queue of all student packages. Which inturn executes one by one in the Queue. This needs to be discussed on how to architect it.

@sumedhreddy90
Copy link
Contributor Author

sumedhreddy90 commented Aug 13, 2022

  • I don't understand why this PR has copies of an existing package's messages.

I removed the turtlebot4_msgs from the projects folder. That was an uncertain commit.

@sumedhreddy90
Copy link
Contributor Author

sumedhreddy90 commented Aug 13, 2022

  • Is there a second pull request that updates the turtlebot4 menu with menu options?

Please refer to the below pull request
turtlebot/turtlebot4#24

@sumedhreddy90 sumedhreddy90 requested a review from kscottz August 15, 2022 16:00
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