42 #include <ecl/streams/string_stream.hpp> 67 cmd_vel_timed_out_(false),
68 base_timeout_times_(0),
69 sensor_timeout_times_(0),
70 base_slot_stream_data(&
XbotRos::processBaseStreamData, *this),
71 sensor_slot_stream_data(&
XbotRos::processSensorStreamData, *this) {}
84 xbot.setLedControl(0);
113 "Xbot : no base device port given on the parameter server (e.g. " 121 "Xbot : no sensor device port given on the parameter server (e.g. " 130 std::string robot_description, wheel_left_joint_name, wheel_right_joint_name;
132 nh.
param(
"wheel_left_joint_name", wheel_left_joint_name,
133 std::string(
"wheel_left_joint"));
134 nh.
param(
"wheel_right_joint_name", wheel_right_joint_name,
135 std::string(
"wheel_right_joint"));
138 if (!nh.
getParam(
"/robot_description", robot_description)) {
139 ROS_WARN(
"Xbot : no robot description given on the parameter server");
141 if (robot_description.find(wheel_left_joint_name) == std::string::npos) {
142 ROS_WARN(
"Xbot : joint name %s not found on robot description",
143 wheel_left_joint_name.c_str());
146 if (robot_description.find(wheel_right_joint_name) == std::string::npos) {
147 ROS_WARN(
"Xbot : joint name %s not found on robot description",
148 wheel_right_joint_name.c_str());
177 ROS_INFO(
"Xbot : driver going into loopback (simulation) mode.");
183 ROS_INFO_STREAM(
"Xbot : driver running in normal (non-simulation) mode" 184 <<
" [" <<
name <<
"].");
194 xbot.init(parameters);
199 if (!
xbot.base_isAlive()) {
201 "Xbot : no base data stream, is base board connected or turned on?");
205 if (!
xbot.sensor_isAlive()) {
207 "Xbot : no sensor data stream, is sensor board connected or turned " 231 xbot.setSoundEnableControl(
true);
246 if (
xbot.isShutdown()) {
254 xbot.setBaseControl(0, 0);
264 bool base_is_alive =
xbot.base_isAlive();
265 if (!base_is_alive) {
269 "Xbot : Timed out while waiting for base serial data stream [" 276 bool sensor_is_alive =
xbot.sensor_isAlive();
277 if (!sensor_is_alive) {
280 "Xbot : Timed out while waiting for sensor serial data stream [" 300 nh.
advertise<sensor_msgs::JointState>(
"joint_states", 100);
306 nh.
advertise<xbot_msgs::CoreSensor>(
"sensors/core", 100);
308 nh.
advertise<xbot_msgs::ExtraSensor>(
"sensors/extra", 100);
310 nh.
advertise<std_msgs::Int8>(
"sensors/yaw_platform_degree", 100);
312 nh.
advertise<std_msgs::Int8>(
"sensors/pitch_platform_degree", 100);
314 nh.
advertise<std_msgs::Bool>(
"sensors/motor_enabled", 100);
316 nh.
advertise<std_msgs::Bool>(
"sensors/sound_enabled", 100);
318 nh.
advertise<xbot_msgs::Battery>(
"sensors/battery", 100);
321 nh.
advertise<sensor_msgs::Range>(
"sensors/front_echo", 100);
323 nh.
advertise<sensor_msgs::Range>(
"sensors/rear_echo", 100);
325 nh.
advertise<xbot_msgs::InfraRed>(
"sensors/infrared", 100);
329 nh.
advertise<xbot_msgs::RawImu>(
"sensors/raw_imu_data", 100);
339 nh.
subscribe(std::string(
"commands/motor_enable"), 10,
342 nh.
subscribe(std::string(
"commands/velocity"), 10,
345 nh.
subscribe(std::string(
"commands/yaw_platform"), 10,
348 nh.
subscribe(std::string(
"commands/pitch_platform"), 10,
351 nh.
subscribe(std::string(
"commands/sound_enable"), 10,
ros::Publisher rear_echo_data_publisher
ros::Subscriber velocity_command_subscriber
sensor_msgs::JointState joint_states
ros::Subscriber motor_enable_command_subscriber
ros::Subscriber yaw_platform_command_subscriber
ros::Publisher robot_state_publisher
Wraps the xbot driver in a ROS-specific library.
ros::Publisher motor_state_publisher
bool led_indicate_battery
ecl::Slot base_slot_stream_data
const char * what() const
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
bool init(ros::NodeHandle &nh)
uint32_t base_timeout_times_
void subscribePitchPlatformCommand(const std_msgs::Int8)
ros::Subscriber sound_command_subscriber
ros::Publisher core_sensor_publisher
ecl::Slot sensor_slot_stream_data
ros::Publisher yaw_platform_state_publisher
std::string sigslots_namespace
void subscribeSoundCommand(const std_msgs::Bool)
bool commandTimeout() const
ros::Publisher battery_state_publisher
ros::Publisher joint_state_publisher
void subscribeResetOdometry(const std_msgs::EmptyConstPtr)
Play a predefined sound (single sound or sound sequence)
Standard exception type, provides code location and error string.
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
ros::Subscriber pitch_platform_command_subscriber
ros::Publisher infrared_data_publisher
void advertiseTopics(ros::NodeHandle &nh)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
#define ROS_WARN_STREAM(args)
#define ROS_DEBUG_STREAM(args)
ros::Publisher sound_state_publisher
ros::Publisher front_echo_data_publisher
void connect(const std::string &topic)
ros::Publisher pitch_platform_state_publisher
#define ROS_INFO_STREAM(args)
bool getParam(const std::string &key, std::string &s) const
XbotRos(std::string &node_name)
Default constructor.
TimeStamp Duration
Convenience typedef to associate timestamps with the concept of durations.
ros::Publisher imu_data_publisher
void subscribeLedCommand(const std_msgs::UInt8)
ros::Publisher extra_sensor_publisher
ros::Publisher raw_imu_data_publisher
#define ROS_ERROR_STREAM(args)
uint32_t sensor_timeout_times_
ros::Subscriber led_command_subscriber
bool enable_acceleration_limiter
void subscribeYawPlatformCommand(const std_msgs::Int8)
void subscribeVelocityCommand(const geometry_msgs::TwistConstPtr)
void init(ros::NodeHandle &nh, const std::string &name)
ros::Subscriber reset_odometry_subscriber
void subscribeTopics(ros::NodeHandle &nh)
const ErrorFlag & flag() const
void subscribeMotorEnableCommand(const std_msgs::Bool)