Beispiel #1
0
def main():
    with rosenv.RosEnv() as re:
        re.add_package("com_github_robotwebtools_rosbridge_suite/rosapi")
        re.add_package(
            "com_github_robotwebtools_rosbridge_suite/rosbridge_server")
        re.add_package("com_github_robotwebtools_tf2_web_republisher",
                       "tf2_web_republisher")
        re.add_package("com_github_ros_common_msgs/actionlib_msgs")
        re.add_package("com_github_ros_common_msgs/nav_msgs")
        re.add_package("com_github_ros_common_msgs/sensor_msgs")
        re.add_package(
            "com_github_ros_planning_navigation_msgs/move_base_msgs")
        re.add_package("com_github_ros_ros_comm/tools/rosgraph")
        re.add_package("com_github_ros_ros_comm/tools/roslaunch")
        re.add_package("com_github_ros_ros_comm/tools/rosnode")
        re.add_to_path("com_github_ros_catkin")
        re.add_to_path("com_github_ros_infrastructure_rospkg")
        re.add_binary("com_github_robotwebtools_rosbridge_suite/rosapi_node",
                      "rosapi")
        re.add_binary(
            "com_github_robotwebtools_rosbridge_suite/rosbridge_websocket",
            "rosbridge_server")

        launch = os.path.join(
            re.runfiles,
            "cloud_robotics/src/docker/ros_websocket/websocket.launch")

        import roslaunch
        roslaunch.main(["roslaunch", "--wait", launch])
Beispiel #2
0
def main():
    with rosenv.RosEnv() as re:
        re.add_package("com_github_ros_ros_comm/tools/rosgraph")
        re.add_package("com_github_ros_ros_comm/tools/roslaunch")
        re.add_package("com_github_ros_ros_comm/tools/rosout")
        re.add_binary("com_github_ros_ros_comm/rosout", "rosout")
        re.add_to_path("com_github_ros_infrastructure_rospkg")
        re.add_to_path("com_github_ros_ros_comm")

        import roslaunch
        roslaunch.main(["roscore", "--core"] + sys.argv[1:])
Beispiel #3
0
def main():
    basedir = os.path.dirname(__file__)
    launch_file = os.path.join(basedir, 'roscore_sim.launch')

    with rosenv.RosEnv() as re:
        re.add_package("com_github_ros_ros_comm/tools/rosgraph")
        re.add_package("com_github_ros_ros_comm/tools/roslaunch")
        re.add_package("com_github_ros_ros_comm/tools/rosout")
        re.add_binary("com_github_ros_ros_comm/rosout", "rosout")
        re.add_to_path("com_github_ros_infrastructure_rospkg")
        re.add_to_path("com_github_ros_ros_comm")

        import roslaunch
        uuid = roslaunch.rlutil.get_or_generate_uuid(None, False)
        roslaunch.configure_logging(uuid)
        launch = roslaunch.parent.ROSLaunchParent(uuid, [launch_file])
        launch.start()
        launch.spin()
Beispiel #4
0
def main():
  with rosenv.RosEnv() as re:
    re.add_package("com_github_ros_ros_comm/tools/rosgraph")

    ros_adapter.main()
Beispiel #5
0
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from prometheus_client import start_http_server, Counter
import rosenv
import rospy
from std_msgs.msg import String

messages = Counter('messages', 'Messages received')


def callback(data):
    rospy.loginfo(rospy.get_caller_id() + 'i heard %s', data.data)
    messages.inc()


if __name__ == '__main__':
    start_http_server(8000)
    with rosenv.RosEnv() as re:
        re.add_package('com_github_ros_ros_comm/tools/rosgraph')
        rospy.init_node('listener', anonymous=True)
        rospy.Subscriber('chatter', String, callback)
        rospy.spin()