65 ecl::linear_algebra::Vector3d pose_update_rates;
66 xbot.updateOdometry(pose_update, pose_update_rates);
67 float left_joint_pos, left_joint_vel, right_joint_pos, right_joint_vel;
68 xbot.getWheelJointStates(left_joint_pos, left_joint_vel, right_joint_pos,
77 xbot.getAngularVelocity());
87 xbot_msgs::CoreSensor core_sensor;
107 core_sensor.version = data.
version;
117 sensor_msgs::Range front_msg, rear_msg;
119 front_msg.header.frame_id =
"front_echo_link";
121 front_msg.radiation_type = sensor_msgs::Range::ULTRASOUND;
122 front_msg.field_of_view = 60 * M_PI / 180.0;
123 front_msg.max_range = 2.0;
124 front_msg.min_range = 0.1;
125 front_msg.range = data_echo.
front_echo / 5880.0;
126 rear_msg.header.frame_id =
"rear_echo_link";
128 rear_msg.radiation_type = sensor_msgs::Range::ULTRASOUND;
129 rear_msg.field_of_view = 60 * M_PI / 180.0;
130 rear_msg.max_range = 2.0;
131 rear_msg.min_range = 0.1;
132 rear_msg.range = data_echo.
rear_echo / 5880.0;
142 xbot_msgs::InfraRed
msg;
144 msg.header.frame_id =
"infrared_link";
147 (12.63 / (data_core.
front_infrared * 3.3 / 4096 - 0.042) - 0.042) /
150 (12.63 / (data_core.
rear_infrared * 3.3 / 4096 - 0.042) - 0.042) /
152 msg.front_hanged = (msg.front - 0.02 > xbot_msgs::InfraRed::PLAT_HEIGHT);
153 msg.rear_hanged = (msg.rear - 0.02 > xbot_msgs::InfraRed::PLAT_HEIGHT);
174 xbot_msgs::Battery
msg;
183 unsigned char leds = msg.battery_percent / 25 + 1;
184 leds = pow(2, leds) - 1;
195 xbot_msgs::XbotState
msg;
197 Sensors::Data extra_data =
xbot.getExtraSensorsData();
199 msg.base_is_connected =
xbot.is_base_connected();
200 msg.sensor_is_connected =
xbot.is_sensor_connected();
201 msg.robot_is_alive =
xbot.base_isAlive()&&
xbot.sensor_isAlive();
205 msg.version = core_data.
version;
222 xbot_msgs::ExtraSensor extra_sensor;
223 Sensors::Data
data =
xbot.getExtraSensorsData();
226 extra_sensor.yaw_platform_degree = data.yaw_platform_degree-120;
227 if(fabs(
ypd_-extra_sensor.yaw_platform_degree)>3.0){
230 extra_sensor.pitch_platform_degree = data.pitch_platform_degree-120;
231 if(fabs(
ppd_-extra_sensor.pitch_platform_degree)>3.0){
234 extra_sensor.sound_enabled = data.sound_enabled;
238 extra_sensor.acc_x = data.acc_x;
239 extra_sensor.acc_y = data.acc_y;
240 extra_sensor.acc_z = data.acc_z;
241 extra_sensor.gyro_x = data.gyro_x;
242 extra_sensor.gyro_y = data.gyro_y;
243 extra_sensor.gyro_z = data.gyro_z;
244 extra_sensor.mag_x = data.mag_x;
245 extra_sensor.mag_y = data.mag_y;
246 extra_sensor.mag_z = data.mag_z;
247 extra_sensor.yaw = data.yaw;
248 extra_sensor.pitch = data.pitch;
249 extra_sensor.roll = data.roll;
250 extra_sensor.q1 = data.q1;
251 extra_sensor.q2 = data.q2;
252 extra_sensor.q3 = data.q3;
253 extra_sensor.q4 = data.q4;
254 extra_sensor.error_state = data.error_status;
255 extra_sensor.time_stamp = data.timestamp;
256 extra_sensor.version = data.version;
263 sensor_msgs::Imu imu_msg;
265 Sensors::Data
data =
xbot.getExtraSensorsData();
267 imu_msg.header.frame_id =
"imu_link";
275 imu_msg.angular_velocity.x = data.gyro_x;
276 imu_msg.angular_velocity.y = data.gyro_y;
277 imu_msg.angular_velocity.z = data.gyro_z;
282 imu_msg.linear_acceleration.x = data.acc_x;
283 imu_msg.linear_acceleration.y = data.acc_y;
284 imu_msg.linear_acceleration.z = data.acc_z;
296 xbot_msgs::RawImu raw_imu_msg;
298 Sensors::Data
data =
xbot.getExtraSensorsData();
301 raw_imu_msg.acc_x = data.acc_x;
302 raw_imu_msg.acc_y = data.acc_y;
303 raw_imu_msg.acc_z = data.acc_z;
304 raw_imu_msg.gyro_x = data.gyro_x;
305 raw_imu_msg.gyro_y = data.gyro_y;
306 raw_imu_msg.gyro_z = data.gyro_z;
307 raw_imu_msg.mag_x = data.mag_x;
308 raw_imu_msg.mag_y = data.mag_y;
309 raw_imu_msg.mag_z = data.mag_z;
318 std_msgs::Int8 yaw_platform_degree;
319 Sensors::Data
data =
xbot.getExtraSensorsData();
320 yaw_platform_degree.data = data.yaw_platform_degree - 120;
330 std_msgs::Int8 pitch_platform_degree;
331 Sensors::Data
data =
xbot.getExtraSensorsData();
332 pitch_platform_degree.data = data.pitch_platform_degree - 120;
342 std_msgs::Bool sound_enabled;
343 Sensors::Data
data =
xbot.getExtraSensorsData();
344 sound_enabled.data = data.sound_enabled;
ros::Publisher rear_echo_data_publisher
sensor_msgs::JointState joint_states
ros::Publisher robot_state_publisher
Wraps the xbot driver in a ROS-specific library.
ros::Publisher motor_state_publisher
bool led_indicate_battery
void processBaseStreamData()
void publish(const boost::shared_ptr< M > &message) const
ros::Publisher core_sensor_publisher
ros::Publisher yaw_platform_state_publisher
void update(const ecl::Pose2D< double > &pose_update, ecl::linear_algebra::Vector3d &pose_update_rates, double imu_heading, double imu_angular_velocity)
unsigned char power_percent
void publishPitchPlatformState()
float right_motor_current
ros::Publisher battery_state_publisher
void publishExtraSensor()
ros::Publisher joint_state_publisher
ros::Publisher infrared_data_publisher
void publishBatteryState()
ros::Publisher sound_state_publisher
void processSensorStreamData()
void publishYawPlatformState()
ros::Publisher front_echo_data_publisher
ros::Publisher pitch_platform_state_publisher
uint32_t getNumSubscribers() const
ros::Publisher imu_data_publisher
ros::Publisher extra_sensor_publisher
ros::Publisher raw_imu_data_publisher
void publishInfraredData()