Skip to content

Commit 54306c1

Browse files
committed
Merge branch 'feature/multiple_ols20'
2 parents 26281f0 + f867e6f commit 54306c1

6 files changed

+80
-16
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ install(DIRECTORY include/${PROJECT_NAME}/
294294
install(FILES
295295
launch/sick_line_guidance.launch
296296
launch/sick_line_guidance_can2ros_node.launch
297+
launch/sick_line_guidance_ols20_twin.launch
297298
launch/sick_line_guidance_ros2can_node.launch
298299
launch/sick_canopen_simu.launch
299300
mls/SICK-MLS.eds

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ source ./install/setup.bash
8686
```
8787
after modifications.
8888

89-
See https://github.com/SICKAG/sick_line_guidance/tree/master/doc/sick_line_guidance_configuration.md for details about the
90-
sick_line_guidance driver and sensor configuration.
89+
See [sick_line_guidance configuration](doc/sick_line_guidance_configuration.md) for details about the
90+
sick_line_guidance driver and sensor configuration. See [Configuration for multiple devices](doc/sick_line_guidance_configuration.md#configuration-for-multiple-devices) for the configuration of multiple devices, f.e. of two OLS20 devices.
9191

9292
# Starting
9393

doc/sick_line_guidance_configuration.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,9 @@ Device specific settings can be configured in section "nodes/node1/dcf_overlay".
179179
Set the CAN-ID of your device with `id: 0x0A # CAN-Node-ID of MLS (default: 0x0A)` and
180180
configure device specific settings in section `dcf_overlay` by appending a line `"objectindex": "parametervalue"` for each parameter.
181181
182-
## yaml configuration for multiple can devices
182+
## Configuration for multiple devices
183183
184-
If you want to use multiple can devices (MLS or OLS) on one system, you have to append multiple nodes in your yaml-file. Each node must contain the configuration of
185-
one can device as shown above. Just make sure to use different node names for each device:
184+
If you want to use multiple can devices (MLS or OLS) on one system, you have to append multiple nodes in your yaml-file. Each node must contain the configuration of one can device as shown above. Make sure to use different node names for each device:
186185
```yaml
187186
nodes:
188187
node1:
@@ -191,11 +190,22 @@ nodes:
191190
id: ... # CAN-ID for the 2. device
192191
```
193192
194-
If you configure different measurement topics for each can device (f.e. `sick_topic: "ols20-1"` for the first OLS20 and `sick_topic: "ols20-1"` for the second OLS20 device),
195-
you have to start multiple sick_line_guidance_cloud_publisher nodes, too. Otherwise, measurement messges from this device can't be transformed to PointCloud2 messsages.
193+
If you configure different measurement topics for each can device (f.e. `sick_topic: "ols20A"` for the first OLS20 and `sick_topic: "ols20B"` for the second OLS20 device), you have to start multiple sick_line_guidance_cloud_publisher nodes, too. Otherwise, measurement messges from this device can't be transformed to PointCloud2 messsages.
194+
196195
Append multiple sick_line_guidance_cloud_publisher nodes in file sick_line_guidance.launch, each sick_line_guidance_cloud_publisher node configured with the corresponding
197196
ros topic in parameter `"mls_topic_publish"` resp. `"ols_topic_publish"`.
198197

198+
Launchfile [sick_line_guidance_ols20_twin.launch](../launch/sick_line_guidance_ols20_twin.launch) and yaml-configuration [sick_line_guidance_ols20_twin.yaml](../ols/sick_line_guidance_ols20_twin.yaml) show an example how to run two OLS20 devices with can node ids 0x0A and 0x0B. Run the example with
199+
```
200+
rosrun rviz rviz &
201+
roslaunch -v --screen sick_line_guidance sick_line_guidance_ols20_twin.launch
202+
```
203+
The point clouds of both OLS20 devices will be published on topic "cloudA" and "cloudB" with frame ids "olsA_frame" and "olsB_frame". Use a static_transform_publisher to setup a transform for each OLS frame to a reference coordinate system, e.g.
204+
```
205+
rosrun tf static_transform_publisher 0 0 0 0 0 0 olsA_frame cloud 10
206+
rosrun tf static_transform_publisher 0 0 0 0 0 0 olsB_frame cloud 10
207+
```
208+
199209
## Read and write parameter during runtime
200210
201211
You can read and write to the object dictionary of a can device on runtime, too, by using the ros services implemented by the canopen driver.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<launch>
2+
3+
<!-- sick_line_guidance: configuration for two OLS20 devices (can node ids A and B) -->
4+
<arg name="yaml" default="sick_line_guidance_ols20_twin.yaml"/>
5+
<rosparam command="load" file="$(find sick_line_guidance)/$(arg yaml)" /> <!-- Global CAN configuration two OLS20 devices (can node ids A and B) incl. link to eds-file -->
6+
7+
<!-- sick_line_guidance: run canopen_chain_node -->
8+
<!-- to run sick_line_guidance_can_chain_node in gdb: add parameter launch-prefix="gdb -ex run - -args": -->
9+
<!-- node name="sick_line_guidance_can_chain_node" pkg="sick_line_guidance" type="sick_line_guidance_can_chain_node" launch-prefix="gdb -ex run - -args" output="screen" -->
10+
<node name="sick_line_guidance_can_chain_node" pkg="sick_line_guidance" type="sick_line_guidance_can_chain_node" output="screen" >
11+
<rosparam command="load" file="$(find sick_line_guidance)/$(arg yaml)" /> <!-- Private CAN configuration for canopen_chain_node by ols or mls yaml-file -->
12+
<param name="diagnostic_topic" type="str" value="diagnostics" /> <!-- ROS topic for diagnostic messages -->
13+
</node>
14+
15+
<!-- sick_line_guidance: run sick_line_guidance_node, which implements the ROS driver for OLS and MLS -->
16+
<node name="sick_line_guidance_node" pkg="sick_line_guidance" type="sick_line_guidance_node" output="screen" >
17+
<param name="diagnostic_topic" type="str" value="diagnostics" /> <!-- ROS topic for diagnostic messages -->
18+
<param name="can_connect_init_at_startup" type="bool" value="true" /> <!-- Additional CAN configuration: if true, canopen services are initialized at startup -->
19+
<param name="initial_sensor_state" type="int" value="7" /> <!-- initial sensor states (f.e. 0x07 for 3 detected lines, or 8 to indicate sensor error) -->
20+
<param name="subscribe_queue_size" type="int" value="16" /> <!-- buffer size for ros messages -->
21+
<param name="max_sdo_rate" type="double" value="100.0" /> <!-- max. sdo query and publish rate -->
22+
<param name="max_num_retries_after_sdo_error" type="int" value="2" /> <!-- After SDO error, the SDO query is repeated max. N times (default: N=2). If the SDO error persists, the can driver is shutdown and restarted. -->
23+
</node>
24+
25+
<!-- sick_line_guidance: cloud_publisher_node to convert OLS_Measurement messages of first OLS20 device (can node id A) to PointCloud2 (topic "cloudA", frame id "olsA_frame") -->
26+
<node name="sick_line_guidance_cloudA_publisher" pkg="sick_line_guidance" type="sick_line_guidance_cloud_publisher" output="screen" >
27+
<param name="mls_topic_publish" type="str" value="mlsA" /> <!-- MLS_Measurement data are published in topic "/mlsA" -->
28+
<param name="ols_topic_publish" type="str" value="olsA" /> <!-- OLS_Measurement data are published in topic "/olsA" -->
29+
<param name="cloud_topic_publish" type="str" value="cloudA" /> <!-- sensor_msgs::PointCloud messages are published in topic "/cloudA" -->
30+
<param name="mls_cloud_frame_id" type="str" value="mlsA_frame" /> <!-- MLS PointCloud data are published with frame id "mlsA_frame" -->
31+
<param name="ols_cloud_frame_id" type="str" value="olsA_frame" /> <!-- OLS PointCloud data are published with frame id "olsA_frame" -->
32+
<param name="subscribe_queue_size" type="int" value="1" /> <!-- buffer size for ros messages -->
33+
</node>
34+
35+
<!-- sick_line_guidance: cloud_publisher_node to convert OLS_Measurement messages of second OLS20 device (can node id B) to PointCloud2 (topic "cloudB", frame id "olsB_frame") -->
36+
<node name="sick_line_guidance_cloudB_publisher" pkg="sick_line_guidance" type="sick_line_guidance_cloud_publisher" output="screen" >
37+
<param name="mls_topic_publish" type="str" value="mlsB" /> <!-- MLS_Measurement data are published in topic "/mlsB" -->
38+
<param name="ols_topic_publish" type="str" value="olsB" /> <!-- OLS_Measurement data are published in topic "/olsB" -->
39+
<param name="cloud_topic_publish" type="str" value="cloudB" /> <!-- sensor_msgs::PointCloud messages are published in topic "/cloudB" -->
40+
<param name="mls_cloud_frame_id" type="str" value="mlsB_frame" /> <!-- MLS PointCloud data are published with frame id "mlsB_frame" -->
41+
<param name="ols_cloud_frame_id" type="str" value="olsB_frame" /> <!-- OLS PointCloud data are published with frame id "olsB_frame" -->
42+
<param name="subscribe_queue_size" type="int" value="1" /> <!-- buffer size for ros messages -->
43+
</node>
44+
45+
</launch>

ols/sick_line_guidance_ols20_twin.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ nodes:
1919

2020
# sick_line_guidance configuration of this node:
2121
sick_device_family: "OLS20" # can devices currently supported: "OLS10", "OLS20" or "MLS"
22-
sick_topic: "ols" # OLS_Measurement messages are published in topic "/ols"
22+
sick_topic: "olsA" # OLS_Measurement messages are published in topic "/ols"
2323
sick_frame_id: "ols20A_measurement_frame" # OLS_Measurement messages are published with frame_id "ols_measurement_frame"
2424

2525
# device configuration of writable parameter by dcf_overlay: "objectindex": "parametervalue"
@@ -39,6 +39,6 @@ nodes:
3939

4040
# sick_line_guidance configuration of this node:
4141
sick_device_family: "OLS20" # can devices currently supported: "OLS10", "OLS20" or "MLS"
42-
sick_topic: "ols" # OLS_Measurement messages are published in topic "/ols"
42+
sick_topic: "olsB" # OLS_Measurement messages are published in topic "/ols"
4343
sick_frame_id: "ols20B_measurement_frame" # OLS_Measurement messages are published with frame_id "ols_measurement_frame"
4444

src/sick_line_guidance_cloud_publisher.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,18 +129,26 @@ int main(int argc, char** argv)
129129
{
130130
ros::init(argc, argv, "sick_line_guidance_cloud_publisher");
131131
ros::NodeHandle nh;
132+
ros::NodeHandle nh_priv("~");
132133

133134
int subscribe_queue_size = 1;
134135
std::string ols_topic_publish = "ols", mls_topic_publish = "mls", cloud_topic_publish = "cloud";
135-
nh.param("/sick_line_guidance_cloud_publisher/mls_topic_publish", mls_topic_publish, mls_topic_publish);
136-
nh.param("/sick_line_guidance_cloud_publisher/ols_topic_publish", ols_topic_publish, ols_topic_publish);
137-
nh.param("/sick_line_guidance_cloud_publisher/cloud_topic_publish", cloud_topic_publish, cloud_topic_publish);
138-
nh.param("/sick_line_guidance_cloud_publisher/mls_cloud_frame_id", mls_cloud_frame_id, mls_cloud_frame_id);
139-
nh.param("/sick_line_guidance_cloud_publisher/ols_cloud_frame_id", ols_cloud_frame_id, ols_cloud_frame_id);
140-
nh.param("/sick_line_guidance_cloud_publisher/subscribe_queue_size", subscribe_queue_size, subscribe_queue_size); // buffer size for ros messages
141-
136+
nh_priv.param("mls_topic_publish", mls_topic_publish, mls_topic_publish);
137+
nh_priv.param("ols_topic_publish", ols_topic_publish, ols_topic_publish);
138+
nh_priv.param("cloud_topic_publish", cloud_topic_publish, cloud_topic_publish);
139+
nh_priv.param("mls_cloud_frame_id", mls_cloud_frame_id, mls_cloud_frame_id);
140+
nh_priv.param("ols_cloud_frame_id", ols_cloud_frame_id, ols_cloud_frame_id);
141+
nh_priv.param("subscribe_queue_size", subscribe_queue_size, subscribe_queue_size); // buffer size for ros messages
142+
143+
142144
ROS_INFO_STREAM("sick_line_guidance_cloud_publisher: version " << sick_line_guidance::Version::getVersionInfo());
143145
ROS_INFO_STREAM("sick_line_guidance_cloud_publisher started.");
146+
ROS_INFO_STREAM("sick_line_guidance_cloud_publisher: mls_topic=" << mls_topic_publish);
147+
ROS_INFO_STREAM("sick_line_guidance_cloud_publisher: ols_topic=" << ols_topic_publish);
148+
ROS_INFO_STREAM("sick_line_guidance_cloud_publisher: cloud_topic=" << cloud_topic_publish);
149+
ROS_INFO_STREAM("sick_line_guidance_cloud_publisher: mls_frame_id=" << mls_cloud_frame_id);
150+
ROS_INFO_STREAM("sick_line_guidance_cloud_publisher: ols_frame_id=" << ols_cloud_frame_id);
151+
ROS_INFO_STREAM("sick_line_guidance_cloud_publisher: queue_size=" << subscribe_queue_size);
144152
cloud_publisher = nh.advertise<sensor_msgs::PointCloud2>(cloud_topic_publish, 1);
145153
ros::Subscriber ols_subscriber = nh.subscribe(ols_topic_publish, subscribe_queue_size, olsMessageCb);
146154
ros::Subscriber mls_subscriber = nh.subscribe(mls_topic_publish, subscribe_queue_size, mlsMessageCb);

0 commit comments

Comments
 (0)