-
Notifications
You must be signed in to change notification settings - Fork 94
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
TwistMux Node dies in ROS2 Jazzy #53
Comments
Had to build from source, I made the following changes: twist_mux.cpp
void TwistMux::init()
{
// Get use stamped parameter
bool use_stamped = false; //changed here, since params are not working
auto nh = std::shared_ptr<rclcpp::Node>(this, [](rclcpp::Node *) {});
// fetch_param(nh, "use_stamped", use_stamped);
/// Get topics and locks:
if(use_stamped)
{
velocity_stamped_hs_ = std::make_shared<velocity_stamped_topic_container>();
getTopicHandles("topics", *velocity_stamped_hs_);
}
else
{
velocity_hs_ = std::make_shared<velocity_topic_container>();
getTopicHandles("topics", *velocity_hs_);
}
lock_hs_ = std::make_shared<lock_topic_container>();
getTopicHandles("locks", *lock_hs_);
/// Publisher for output topic:
if(use_stamped)
{
cmd_pub_stamped_ =
this->create_publisher<geometry_msgs::msg::TwistStamped>(
"cmd_vel_out",
rclcpp::QoS(rclcpp::KeepLast(1)));
}
else
{
cmd_pub_ =
this->create_publisher<geometry_msgs::msg::Twist>(
"cmd_vel_out",
rclcpp::QoS(rclcpp::KeepLast(1)));
}
twist_marker.cpp
class TwistMarkerPublisher : public rclcpp::Node
{
public:
TwistMarkerPublisher()
: Node("twist_marker")
{
std::string frame_id;
double scale;
bool use_stamped = false; //made use_stamped a boolean value for the if check
double z;
this->declare_parameter("frame_id", "base_footprint");
this->declare_parameter("scale", 1.0);
// this->declare_parameter("use_stamped", false); //changed this line
this->declare_parameter("vertical_position", 2.0);
this->get_parameter<std::string>("frame_id", frame_id);
this->get_parameter<double>("scale", scale);
// this->get_parameter<bool>("use_stamped", use_stamped); //and this
this->get_parameter<double>("vertical_position", z);
marker_ = std::make_shared<TwistMarker>(frame_id, scale, z);
if (use_stamped)
{
sub_stamped_ = this->create_subscription<geometry_msgs::msg::TwistStamped>(
"twist", rclcpp::SystemDefaultsQoS(),
std::bind(&TwistMarkerPublisher::callback_stamped, this, std::placeholders::_1));
}
else
{
sub_ = this->create_subscription<geometry_msgs::msg::Twist>(
"twist", rclcpp::SystemDefaultsQoS(),
std::bind(&TwistMarkerPublisher::callback, this, std::placeholders::_1));
}
pub_ =
this->create_publisher<visualization_msgs::msg::Marker>(
"marker",
rclcpp::QoS(rclcpp::KeepLast(1)));
}
include/twist_mux/twist_mux_diagnostics_status.hpp
#include <memory>
namespace twist_mux
{
struct TwistMuxDiagnosticsStatus
{
typedef std::shared_ptr<TwistMuxDiagnosticsStatus> Ptr;
typedef std::shared_ptr<const TwistMuxDiagnosticsStatus> ConstPtr;
double reading_age;
rclcpp::Time last_loop_update;
double main_loop_time;
LockTopicHandle::priority_type priority;
bool use_stamped;
std::shared_ptr<TwistMux::velocity_topic_container> velocity_hs;
std::shared_ptr<TwistMux::velocity_stamped_topic_container> velocity_stamped_hs;
std::shared_ptr<TwistMux::lock_topic_container> lock_hs;
TwistMuxDiagnosticsStatus()
: reading_age(0),
last_loop_update(rclcpp::Clock().now()),
main_loop_time(0),
priority(0),
use_stamped(false) //changed this line
{
velocity_hs = std::make_shared<TwistMux::velocity_topic_container>();
velocity_stamped_hs = std::make_shared<TwistMux::velocity_stamped_topic_container>();
lock_hs = std::make_shared<TwistMux::lock_topic_container>();
}
};
|
Hey @BrainBoxTayo I see that this is a closed issue that you addressed by removing the
or even in the launch file that starts twist_mux like so:
I'm also working on setting the param to default to |
Hi @TWALL9 , that was the approach I took first. But for some reason it wasn't working. Maybe I had a syntax issue. Thanks so much though. This would come in handy to people facing the same error. |
The node is dying because the fetch_param() method is throwing an exception
which isn't being handled in init(). The exception is that the use_stamped
parameter isn't being found, and because it's required to have a value
further down in init().
Trouble is that use_stamped is not being declared as a parameter, but the
node expects it to be there, set by whatever is launching twist_mux. So the
node is looking for a parameter that the user is just supposed to know
needs to be set, but without declaring that this parameter needs to exist
in the first place.
I guess an analogy is if you're in a restaurant and order a glass of water
from a waiter. Instead of asking if you'd like ice with your water, the
waiter expected you to order the water with or without ice and because you
never said you did or didn't want ice, the waiter simply explodes.
…On Sun, Dec 29, 2024, 04:27 Akanbi-Bello Temitayo ***@***.***> wrote:
Hi @TWALL9 <https://github.com/TWALL9> , that was the approach I took
first. But for some reason it wasn't working. Maybe I had a syntax issue.
Thanks so much though. This would come in handy to people facing the same
error.
Why do you think the use_stamped param kills the node?
—
Reply to this email directly, view it on GitHub
<#53 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABPG3SELXFUKK2TEDY6HGPT2H7TETAVCNFSM6AAAAABRWN4FSGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRUG4YDSMBWGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Ahh ok thank you! |
[twist_mux-10] terminate called after throwing an instance of 'twist_mux::ParamsHelperException'
[twist_mux-10] what(): could not load parameter 'use_stamped'. (namespace: /)
[ERROR] [twist_mux-10]: process has died [pid 188290, exit code -6, cmd '/opt/ros/jazzy/lib/twist_mux/twist_mux --ros-args --params-file /tmp/launch_params_gvyag67m --params-file /home/brainboxtayo/bumperbot_ws/install/bumperbot_controller/share/bumperbot_controller/config/twist_mux_locks.yaml --params-file /opt/ros/jazzy/share/twist_mux/config/twist_mux_topics.yaml -r /cmd_vel_out:=bumperbot_controller/cmd_vel_unstamped'].
The text was updated successfully, but these errors were encountered: