Skip to content

Commit

Permalink
Merge pull request PepperlFuchs#1 from PepperlFuchs/fix/port
Browse files Browse the repository at this point in the history
use port declared in configuration to establish connection
  • Loading branch information
ptruka authored Feb 1, 2024
2 parents 3e5d0b2 + 1d03d86 commit 6b5f0f7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/pf_driver/src/pf/pf_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ bool PFInterface::init(std::shared_ptr<HandleInfo> info, std::shared_ptr<ScanCon

if (info->handle_type == HandleInfo::HANDLE_TYPE_UDP)
{
transport_ = std::make_unique<UDPTransport>(info->hostname);
transport_ = std::make_unique<UDPTransport>(info->hostname, info->port);
if (!transport_->connect())
{
RCLCPP_ERROR(node_->get_logger(), "Unable to establish UDP connection");
Expand Down
8 changes: 8 additions & 0 deletions src/pf_driver/src/pf/pfsdp_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ void PFSDPBase::request_handle_tcp(const std::string& port, const std::string& p
{
query["packet_type"] = config_->packet_type;
}
if (!port.empty())
{
query["port"] = port;
}
else if (info_->port.compare("0") != 0)
{
query["port"] = info_->port;
}
auto resp = get_request("request_handle_tcp", { "handle", "port" }, query);

info_->handle = resp["handle"];
Expand Down
1 change: 1 addition & 0 deletions src/pf_driver/src/ros/ros_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ int main(int argc, char* argv[])

std::string device, transport_str, scanner_ip, port, topic, frame_id, packet_type;
int samples_per_scan, start_angle, max_num_points_scan, watchdogtimeout, num_layers;
port = "0";
num_layers = 0;
bool watchdog, apply_correction = 0;

Expand Down

0 comments on commit 6b5f0f7

Please sign in to comment.