tgu / RosSwift

ROS Robotic Operating System - Swift implementation of core client libraries and rosmaster. Based on roscpp.
MIT License
58 stars 17 forks source link

Question on usage in ubuntu 20.04 #6

Closed TheFern2 closed 2 years ago

TheFern2 commented 2 years ago

I have swift 5.5.3 on Ubuntu 20.04 just testing the waters with swift, how do we use this library? I know very little about swift packages.

tgu commented 2 years ago

There are many swift package tutorials (such as https://theswiftdev.com/swift-package-manager-tutorial/

Basically you should first create a swift package

mkdir minimalRos
cd minimalRos
swift package init --type executable

and then add the necessary rosswift dependencies

import PackageDescription

let package = Package(
    name: "minimalRos",
    products: [
        .executable(name: "minimalRos", targets: ["minimalRos"]),
    ],
    dependencies: [
        .package(url: "https://github.com/tgu/RosSwift.git", from: "1.3.3"),
    ],
    targets: [
        .target(
            name: "minimalRos",
            dependencies: [
                .product(name: "RosSwift", package: "RosSwift"),
                .product(name: "msgs", package: "RosSwift"),
                .product(name: "RosTime",  package: "RosSwift")])
    ]
)

Look at the code in publisher and listener examples to find guidance how to use RosSwift (You need to be familiar with the Ros Operating system)

TheFern2 commented 2 years ago

Thank you @tgu that should get me started. I am familiar with roscpp and rospy, I should be able to figure out the rest.