cd ~/ros2_ws/src
git clone https://github.com/CoreSenseEU/coresense_instrumentation
cd ~/ros2_ws
colcon build --symlink-install --packages-up-to coresense_instrumention
Click to expand
def generate_launch_description():
names = ['scan_raw',
'nav_vel',
'image_raw']
topics = ['/scan_raw',
'/nav_vel',
'/head_front_camera/rgb/image_raw']
msgs = ['sensor_msgs::msg::LaserScan',
'geometry_msgs::msg::Twist',
'sensor_msgs::msg::Image']
node_types = ['Producer',
'Consumer',
'Producer']
ns = ''
composable_nodes = []
for topic, msg, name, node_type in zip(topics, msgs, names, node_types):
composable_node = ComposableNode(
package='coresense_instrumentation_driver',
plugin='coresense_instrumentation_driver::Instrumentation'
+ node_type + '<' + msg + '>',
name=name + '_node',
namespace=ns,
parameters=[{'topic': topic,
'topic_type': msg,
'type': node_type}],
)
composable_nodes.append(composable_node)
container = ComposableNodeContainer(
name='coresense_container',
namespace=ns,
package='rclcpp_components',
executable='component_container',
composable_node_descriptions=composable_nodes,
output='screen',
)
You have to indicate the name you will give to your nodes, the topic you subscribe to, the type of message and whether you are going to subscribe or publish to the topic.
ros2 launch coresense_instrumentation_driver coresense_instrumentation_driver.launch.py
ros2 launch coresense_instrumentation_rviz coresense_instrumentation_rviz.launch.py
Click to expand
When you launch rviz, you will see on your right a panel like this, but with your nodes. Through the following buttons, you can activate/deactivate your nodes and create/delete your publishers/subscribers