roslib 0.0.3

roslib #

A library for communicating to a ROS node over websockets with rosbridge, heavily influenced by roslibjs and follows the same structure.

THIS IS AN INCOMPLETE LIBRARY

List of feature implementation statuses (essentially a list of features required to reach roslibjs's level) #

  • [X] Core:
    • [x] ROS connection object
    • [x] Topic object (subscribe, unsubscribe, publish, advertise, unadvertise)
    • [x] Service object (call, advertise, unadvertise)
    • [x] Request object (provides typing and naming to any potential ROS request)
    • [x] Param object (get, set, delete)
  • [ ] Actionlib:
    • [ ] ActionClient
    • [ ] ActionListener
    • [ ] Goal
    • [ ] SimpleActionServer
  • [ ] Support TCP connections
  • [ ] TFClient (listen to TFs from tf2_web_republisher
  • [ ] URDF (Box, Color, Cylinder, Joint, Material, Mesh, Model, Sphere, Types, Visual)
  • [ ]

Testing #

In order to successfully run the tests a ros node must be accessible with packages ros-{distro}-rosbridge-server and ros-{distro}-rospy-tutorials installed. And it must be running these three processes:

  1. roscore
  2. rlaunch rosbridge_server rosbridge_websocket.launch
  3. rosrun rospy_tutorials add_two_ints_server

[0.0.1] - Initial pre-release for visibility

  • Core ROS communication features work (Topics, Services, Requests, Params)

[0.0.2] - Formatting issues

  • Updated package description.
  • Added an example.
  • Ran flutter format.

[0.0.3] - Updated Example

  • updated example
  • fixed flutter suggestions

example/main.dart

import 'package:flutter/material.dart';
import 'package:roslib/roslib.dart';

void main() {
  runApp(ExampleApp());
}

class ExampleApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Roslib Example',
      home: HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  HomePage({Key key}) : super(key: key);

  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  Ros ros = Ros(url: 'ws://10.0.2.2:9090');

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Roslib Example'),
      ),
      body: StreamBuilder<Object>(
          stream: ros.statusStream,
          builder: (context, snapshot) {
            return Center(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.center,
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  ActionChip(
                    label: Text(snapshot.data == Status.CONNECTED
                        ? 'DISCONNECT'
                        : 'CONNECT'),
                    backgroundColor: snapshot.data == Status.CONNECTED ? Colors.green[300] : Colors.grey[300],
                    onPressed: () {
                      if (snapshot.data == Status.CONNECTED)
                        ros.close();
                      else
                        ros.connect();
                    },
                  ),
                ],
              ),
            );
          }),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  roslib: ^0.0.3

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:roslib/roslib.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
30
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
63
Learn more about scoring.

We analyzed this package on Sep 13, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
flutter 0.0.0
web_socket_channel ^1.0.12 1.0.15
Transitive dependencies
async 2.3.0
charcode 1.1.2
collection 1.14.11 1.14.12
convert 2.1.1
crypto 2.1.3
meta 1.1.7
sky_engine 0.0.99
stream_channel 2.0.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test