10 #define MARTY_CORE_HPP 19 #include <ros/package.h> 20 #include <tf2_ros/transform_broadcaster.h> 21 #include <tf2_ros/transform_listener.h> 22 #include <tf2/LinearMath/Quaternion.h> 23 #include <tf2_geometry_msgs/tf2_geometry_msgs.h> 26 #include <std_msgs/Bool.h> 27 #include <std_msgs/String.h> 28 #include <std_msgs/Float32.h> 29 #include <std_srvs/SetBool.h> 30 #include <sensor_msgs/JointState.h> 31 #include <nav_msgs/Odometry.h> 32 #include <marty_msgs/Accelerometer.h> 33 #include <marty_msgs/GPIOs.h> 34 #include <marty_msgs/MotorCurrents.h> 35 #include <marty_msgs/Output.h> 36 #include <marty_msgs/ServoMsg.h> 37 #include <marty_msgs/ServoMsgArray.h> 38 #include <marty_msgs/GPIOConfig.h> 39 #include <marty_msgs/Sound.h> 40 #include <marty_msgs/SoundArray.h> 41 #include <marty_msgs/Keyframe.h> 42 #include <marty_msgs/KeyframeArray.h> 43 #include <geometry_msgs/TransformStamped.h> 70 void loadSound(std::string sound_name);
71 void loadKeyframes(std::string keyframes_name,
int move_time = 0);
73 void celebSound(
float sound_time);
74 int jointPosToServoCmd(
int id,
float pos);
75 void setServoJointPos(std::string name,
int pos);
76 void setServoPos(
int channel,
int pos);
80 bool setServo(
int id,
float angle);
81 void setServos(std::map<int, float> angles);
83 void playSound(
float frequency,
float duration,
float freq2 = -1);
84 void playSoundArray(marty_msgs::SoundArray sound_array);
97 void setupJointStates();
99 void jointCB(
const marty_msgs::ServoMsg::ConstPtr& msg);
100 void jointsCB(
const marty_msgs::ServoMsgArray::ConstPtr& msg);
101 void accelCB(
const marty_msgs::Accelerometer::ConstPtr& msg);
102 void battCB(
const std_msgs::Float32::ConstPtr& msg);
103 void gpioCB(
const marty_msgs::GPIOs::ConstPtr& msg);
104 void soundCB(
const std_msgs::String::ConstPtr& msg)
105 {this->loadSound(msg->data);}
106 void sendKeyframes(marty_msgs::KeyframeArray k_array);
107 void kfCB(
const std_msgs::String::ConstPtr& msg)
108 {this->loadKeyframes(msg->data);}
109 void tfCB(
const ros::TimerEvent& e);
111 void updateJointState(marty_msgs::ServoMsg servo);
113 bool setFallDetector(std_srvs::SetBool::Request& req,
114 std_srvs::SetBool::Response& res);
tf2_ros::TransformBroadcaster odom_br_
ros::Subscriber keyframe_sub_
void kfCB(const std_msgs::String::ConstPtr &msg)
std::deque< float > jangles_
tf2_ros::TransformListener tf_ls_
ros::Subscriber sound_sub_
geometry_msgs::TransformStamped cam_tf_
ros::Publisher joints_pub_
ros::ServiceServer fall_dis_srv_
ros::Publisher falling_pub_
ros::Subscriber gpio_sub_
std::deque< double > yaw_
std::deque< double > roll_
geometry_msgs::TransformStamped r_f_tf_
ros::Subscriber batt_sub_
geometry_msgs::TransformStamped odom_tf_
ros::Publisher enable_pub_
void soundCB(const std_msgs::String::ConstPtr &msg)
ros::ServiceClient get_gpio_config_
geometry_msgs::TransformStamped l_f_tf_
ros::Subscriber joint_sub_
marty_msgs::GPIOs gpios_val_
ros::Publisher servo_array_pub_
marty_msgs::ServoMsg servo_msg_
ros::ServiceClient set_gpio_config_
ros::Publisher servo_pub_
ros::Publisher sound_pub_
ros::Publisher keyframe_pub_
ros::Subscriber joints_sub_
sensor_msgs::JointState joints_
tf2_ros::TransformBroadcaster tf_br_
ros::Subscriber accel_sub_
tf2::Quaternion quat_ori_
marty_msgs::Accelerometer accel_
std::deque< double > pitch_
std_msgs::Bool enable_robot_