-
Notifications
You must be signed in to change notification settings - Fork 12
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
Is it possible to start a roscore using rospypi from Python code? #62
Comments
It seems the code doesn't work with the current version of rospypi:
This is because According to the original source code, you can avoid this eror by specifying
(The error means There may be some other errors to get it working, but let me think a workaround for those problems. |
It seems However, roscore was launched successfully by avoiding the configuration loader part. import roslaunch
from roslaunch.config import ROSLaunchConfig
from roslaunch.core import Param
from roslaunch.parent import ROSLaunchParent
from roslaunch.rlutil import get_or_generate_uuid
uuid = get_or_generate_uuid(options_runid=None, options_wait_for_master=False)
roslaunch.configure_logging(uuid)
launch = ROSLaunchParent(uuid, roslaunch_files=[], is_core=True)
# Set ROSLaunchConfig to avoid using rospkg
config = ROSLaunchConfig()
# The following parameters are required as some processes use them:
# e.g. https://github.com/ros/ros_comm/blob/f5fa3a168760d62e9693f10dcb9adfffc6132d22/tools/roslaunch/src/roslaunch/parent.py#L194
config.params["/rosversion"] = Param("/rosversion", "1.15.13")
config.params["/rosdistro"] = Param("/rosdistro", "noetic")
config.assign_machines()
launch.config = config
launch.start()
input("Press Enter to shutdown")
launch.shutdown() memo
|
I think import sys
import rosmaster
rosmaster.rosmaster_main([sys.argv[0], "--core"]) |
First of all, I admire the project! I was wondering whether it is possible to start a roscore from code using rospypi.
This is possible using standard rospy (taken from https://answers.ros.org/question/215600/how-can-i-run-roscore-from-python/):
Is something similar also possible using rospypi?
The text was updated successfully, but these errors were encountered: