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

Add documentation on msg generation #5

Open
TimWhiting opened this issue Nov 12, 2020 · 6 comments
Open

Add documentation on msg generation #5

TimWhiting opened this issue Nov 12, 2020 · 6 comments
Labels
documentation Improvements or additions to documentation medium priority

Comments

@TimWhiting
Copy link
Collaborator

TimWhiting commented Nov 12, 2020

https://github.com/TimWhiting/gendart is a message generation package for dartros. I need to more fully document how to use it.

Essentially the basics are to clone the gendart repository into your catkin workspace, and then run catkin_make. As long as some catkin package depends on message generation it should generate messages. I'm trying to remember if there was anything else I needed to make it work.

The generated messages will be in the devel folder of your workspace more specifically: devel/share/gendart/ros/{name_of_msg_package}.

You can depend on this in your dart node via a path dependency.
Assuming your dart node is in the src folder this would look like this:

# pubspec.yaml
dependencies:
  sensor_msgs:
    path: ../../devel/share/gendart/ros/sensor_msgs

Then to use it to publish an image you might do something like this:

import 'package:dartros/dartros.dart';
import 'package:dartx/dartx.dart';
import 'package:sensor_msgs/msgs.dart';

Future<void> main(List<String> args) async {
  final node = await initNode('test_node', args);
  final img_msg = Image(
      header: null,
      height: 600,
      width: 1024,
      encoding: 'rgba8',
      is_bigendian: 0,
      step: 1024 * 4,
      data: List.generate(600 * 1024 * 4, (_) => 255));
  final pub = node.advertise<Image>('/robot/head_display', Image.$prototype);
  await Future.delayed(2.seconds);
  while (true) {
    pub.publish(img_msg, 1);
    await Future.delayed(2.seconds);
  }
}
This was referenced Nov 12, 2020
@TimWhiting TimWhiting added the documentation Improvements or additions to documentation label Nov 14, 2020
@TimWhiting
Copy link
Collaborator Author

TimWhiting commented Nov 18, 2020

@knuesel, can you update the documentation if anything changes when you add the action messages / rework message generation. I've put the above information on pub.dev now.

@knuesel
Copy link
Contributor

knuesel commented Nov 18, 2020

OK! Not sure if I'll have time to work on it this week, but I'll keep it in mind anyway.

@TimWhiting
Copy link
Collaborator Author

Yeah, no hurries. I was just putting some basic documentation on the README, and wanted to link you into this issue so that we can make sure the documentation stays up to date if anything changes.

@knuesel
Copy link
Contributor

knuesel commented Dec 17, 2020

I've left the "big changes" on the side for now since it works, might revisit in the future. I didn't notice anything to change in the documentation.

@TimWhiting
Copy link
Collaborator Author

Thats fine, at some point an example or something for Actions would be great.

@knuesel
Copy link
Contributor

knuesel commented Dec 18, 2020

Then in might make sense to move the Coffee test to the dartros repository (in example/, with the generated message files in a subdirectory)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation medium priority
Projects
None yet
Development

No branches or pull requests

2 participants