Skip to content
This repository has been archived by the owner on Jun 15, 2021. It is now read-only.

ROBOTIS-move/ros2_examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ROS Packages for reference (ros2_examples)

Build Status

Travis CI (master) Travis CI (develop)
Build Status Build Status

examples_msgs

Message file

  • Count.msg

Service file

  • Calculation.srv

Action file

  • Led.action

examples_rclcpp

Publisher

$ ros2 run examples_rclcpp publisher -c ${comment} -q ${qos_profile}

Subscriber

$ ros2 run examples_rclcpp subscriber -q ${qos_profile}

Server

$ ros2 run examples_rclcpp server
$ ros2 service call /calculate examples_msgs/Calculation "{a: 1, b: 2, arithmetic_operator: "plus"}"

${arithmetic_operator} : plus, minus, multiply, division

Client

$ ros2 run examples_rclcpp client -a ${number} -b ${number} -o ${arithmetic_operator}

${arithmetic_operator} : plus, minus, multiply, division

Action Server

$ ros2 run examples_rclcpp action_server

Action Client

$ ros2 run examples_rclcpp action_client -n ${number}

Launch

$ ros2 launch examples_rclcpp pub.launch.py
$ ros2 launch examples_rclcpp sub.launch.py
$ ros2 launch examples_rclcpp multiple_node.launch.py
$ ros2 launch examples_rclcpp multiple_launch.launch.py

examples_rclpy

Publisher

$ ros2 run examples_rclpy publisher -q ${qos_profile}

Subscriber

$ ros2 run examples_rclpy subscriber -q ${qos_profile}

Server

$ ros2 run examples_rclpy server
$ ros2 service call /calculate examples_msgs/Calculation "{a: 1, b: 2, arithmetic_operator: "plus"}"

Client

$ ros2 run examples_rclpy client -a ${number} -b ${number} -o ${arithmetic_operator}

${arithmetic_operator} : plus, minus, multiply, division

Launch

$ ros2 launch examples_rclpy pub.launch.py
$ ros2 launch examples_rclpy sub.launch.py
$ ros2 launch examples_rclpy multiple_node.launch.py
$ ros2 launch examples_rclpy multiple_launch.launch.py

examples_rqt

Install dependency software for development

  • Qt Creator 4.5.x Based on Qt 5.9.x (GCC 7.3.x, 64 bit)
$ sudo apt install qtcreator

Install dependency package for test

  • teleop_twist_keyboard package
$ cd PATH/THE/YOUR/ROS2_WORKSPACE/src
$ git clone https://github.com/ros2/teleop_twist_keyboard.git
$ cd ..
$ colcon build --symlink-install --packages-select teleop_twist_keyboard

Run Method 1: run examples_rqt

$ ros2 run examples_rqt examples_rqt

Run Method 2: run rqt and add a examples_rqt as plugin

  • Menu > Plugins > Visualization > Viewer
$ rqt

Test: run examples_rqt, teleop_keyboard node, call service

$ ros2 run examples_rqt examples_rqt
$ ros2 run teleop_twist_keyboard teleop_twist_keyboard
$ ros2 topic echo /cmd_vel
$ ros2 service call /led_control std_srvs/srv/SetBool '{data: True}'
$ ros2 service call /led_control std_srvs/srv/SetBool '{data:False}'

examples_tf

Run examples_tf

$ ros2 run examples_tf2 broadcaster
$ ros2 run examples_tf2 listener
$ ros2 run examples_tf2 static_broadcaster
$ ros2 run rviz2 rviz2 -d examples_tf2/rviz/arm.rviz
$ ros2 service call state std_srvs/srv/SetBool "data: false"

examples_lifecycle

Run examples_lifecycle

$ ros2 run examples_lifecycle robot

Launch examples_lifecycle

$ ros2 launch examples_lifecycle bringup.launch.py auto_activate:=False

Lifecycle client

Trigger lifecycle state transition

$ ros2 lifecycle set /example/robot configure
$ ros2 lifecycle set /example/robot activate
$ ros2 lifecycle set /example/robot deactivate
$ ros2 lifecycle set /example/robot shutdown

Get lifecycle state for one or more nodes

$ ros2 lifecycle get /example/robot

Output a list of available transitions

$ ros2 lifecycle list /example/robot

Output a list of nodes with lifecycle

$ ros2 lifecycle nodes