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

add x,y,theta arguments #21

Merged
merged 2 commits into from
Sep 2, 2023
Merged
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 include/rcss3d_nao/rcss3d_nao_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class Rcss3dNaoNode : public rclcpp::Node
rclcpp::Subscription<rcss3d_agent_msgs::msg::Beam>::SharedPtr beamSub;

void perceptCallback(const rcss3d_agent_msgs::msg::Percept & percept);
void beamToInitialPose(double x, double y, double theta);
};

} // namespace rcss3d_nao
Expand Down
15 changes: 15 additions & 0 deletions src/rcss3d_nao_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ Rcss3dNaoNode::Rcss3dNaoNode(const rclcpp::NodeOptions & options)
std::string rcss3d_host = this->declare_parameter<std::string>("rcss3d/host", "127.0.0.1");
int rcss3d_port = this->declare_parameter<int>("rcss3d/port", 3100);
std::string team = this->declare_parameter<std::string>("team", "Anonymous");
double theta = this->declare_parameter<double>("theta", 0.0);
int unum = this->declare_parameter<int>("unum", 0);
double x = this->declare_parameter<double>("x", 0.0);
double y = this->declare_parameter<double>("y", 0.0);

// Create Rcss3dAgent
params = std::make_unique<rcss3d_agent::Params>(model, rcss3d_host, rcss3d_port, team, unum);
Expand Down Expand Up @@ -80,6 +83,9 @@ Rcss3dNaoNode::Rcss3dNaoNode(const rclcpp::NodeOptions & options)
[this](rcss3d_agent_msgs::msg::Beam::SharedPtr cmd) {
rcss3dAgent->sendBeam(*cmd);
});

// Beam robot
beamToInitialPose(x, y, theta);
}

Rcss3dNaoNode::~Rcss3dNaoNode()
Expand Down Expand Up @@ -172,6 +178,15 @@ void Rcss3dNaoNode::perceptCallback(const rcss3d_agent_msgs::msg::Percept & perc
}
}

void Rcss3dNaoNode::beamToInitialPose(double x, double y, double theta)
{
rcss3d_agent_msgs::msg::Beam beam;
beam.x = x;
beam.y = y;
beam.rot = theta;
rcss3dAgent->sendBeam(beam);
}

} // namespace rcss3d_nao

#include "rclcpp_components/register_node_macro.hpp"
Expand Down