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

Optionally publish output_paths with a header #147

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ add_message_files(
MeasurementDataMsg.msg
MonitoringCaseMsg.msg
OutputPathsMsg.msg
OutputPathsStampedMsg.msg
RawMicroScanDataMsg.msg
ScanPointMsg.msg
)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ All Parameters can be passed as commandline argument to the launch file.
| ------------- | ------ | ------- | ------------ | ------------- |
| sensor_ip | String | 192.168.1.11 | ✔ | IP address of the sensor. |
| host_ip | String | 192.168.1.9 | ✔ | IP address of the receiving host/target computer. |
| output_paths_header | Boolean | False | ✔ | If OutputPathsStampedMsg should be used instead of OutputPathsMsg. |
| interface_ip | String | 0.0.0.0 | | Interface IP address of the receiving host computer, this needs to be set if the host IP is in the multicast IP range. The default is an undefined IP address and will return an error when multicast is used without a correct interface |
| host_udp_port | Integer | 0 | | Host UDP Port. Zero allows system chosen port. |
| frame_id | String | scan | | The frame name of the sensor message |
Expand Down
3 changes: 3 additions & 0 deletions include/sick_safetyscanners/SickSafetyscannersRos.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include <sick_safetyscanners/ExtendedLaserScanMsg.h>
#include <sick_safetyscanners/FieldData.h>
#include <sick_safetyscanners/OutputPathsMsg.h>
#include <sick_safetyscanners/OutputPathsStampedMsg.h>
#include <sick_safetyscanners/RawMicroScanDataMsg.h>
#include <sick_safetyscanners/SickSafetyscanners.h>
#include <sick_safetyscanners/SickSafetyscannersConfigurationConfig.h>
Expand Down Expand Up @@ -157,6 +158,8 @@ class SickSafetyscannersRos
dynamic_reconfigure::Server<sick_safetyscanners::SickSafetyscannersConfigurationConfig>
m_dynamic_reconfiguration_server;

bool m_output_paths_header;

std::string m_frame_id;
double m_time_offset;
double m_range_min;
Expand Down
4 changes: 3 additions & 1 deletion launch/sick_safetyscanners.launch
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
<arg name="measurement_data" default="True" />
<arg name="intrusion_data" default="True" />
<arg name="application_io_data" default="True" />
<arg name="use_persistent_config" default="False" />
<arg name="use_persistent_config" default="False" />
<arg name="output_paths_header" default="False" />

<!-- Launch Sick SickSafetyscanners Ros Driver Node -->
<node pkg="sick_safetyscanners" type="sick_safetyscanners_node" name="sick_safetyscanners" output="screen" ns="sick_safetyscanners">
Expand All @@ -38,6 +39,7 @@
<param name="intrusion_data" type="bool" value="$(arg intrusion_data)" />
<param name="application_io_data" type="bool" value="$(arg application_io_data)" />
<param name="use_persistent_config" type="bool" value="$(arg use_persistent_config)" />
<param name="output_paths_header" type="bool" value="$(arg output_paths_header)" />
</node>


Expand Down
2 changes: 2 additions & 0 deletions msg/OutputPathsStampedMsg.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Header header
OutputPathsMsg output_paths
32 changes: 29 additions & 3 deletions src/SickSafetyscannersRos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,16 @@ SickSafetyscannersRos::SickSafetyscannersRos()
m_extended_laser_scan_publisher =
m_nh.advertise<sick_safetyscanners::ExtendedLaserScanMsg>("extended_laser_scan", 100);
m_raw_data_publisher = m_nh.advertise<sick_safetyscanners::RawMicroScanDataMsg>("raw_data", 100);
m_output_path_publisher =
m_nh.advertise<sick_safetyscanners::OutputPathsMsg>("output_paths", 100);
if (m_output_paths_header)
{
m_output_path_publisher =
m_nh.advertise<sick_safetyscanners::OutputPathsStampedMsg>("output_paths", 100);
}
else
{
m_output_path_publisher =
m_nh.advertise<sick_safetyscanners::OutputPathsMsg>("output_paths", 100);
}
m_field_service_server =
m_nh.advertiseService("field_data", &SickSafetyscannersRos::getFieldData, this);

Expand Down Expand Up @@ -196,6 +204,12 @@ bool SickSafetyscannersRos::readParameters()
}
m_communication_settings.setHostUdpPort(host_udp_port);

m_output_paths_header = false;
if (!m_private_nh.getParam("output_paths_header", m_output_paths_header))
{
ROS_WARN("Using default OutputPathsMsg (without header).");
}

ROS_WARN("If not further specified the default values for the dynamic reconfigurable parameters "
"will be loaded.");

Expand Down Expand Up @@ -281,7 +295,19 @@ void SickSafetyscannersRos::receivedUDPPacket(const sick::datastructure::Data& d
m_extended_laser_scan_publisher.publish(extended_scan);

sick_safetyscanners::OutputPathsMsg output_paths = createOutputPathsMessage(data);
m_output_path_publisher.publish(output_paths);
if (m_output_paths_header)
{
sick_safetyscanners::OutputPathsStampedMsg stamped_output_paths;
stamped_output_paths.header.seq = extended_scan.laser_scan.header.seq;
stamped_output_paths.header.stamp = extended_scan.laser_scan.header.stamp;
stamped_output_paths.header.frame_id = extended_scan.laser_scan.header.frame_id;
stamped_output_paths.output_paths = output_paths;
m_output_path_publisher.publish(stamped_output_paths);
}
else
{
m_output_path_publisher.publish(output_paths);
}
}

m_last_raw_data = createRawDataMessage(data);
Expand Down