22 #ifndef P2OS_DRIVER__P2OS_HPP_ 23 #define P2OS_DRIVER__P2OS_HPP_ 28 #include <nav_msgs/Odometry.h> 29 #include <geometry_msgs/Twist.h> 31 #include <p2os_msgs/BatteryState.h> 32 #include <p2os_msgs/MotorState.h> 33 #include <p2os_msgs/GripperState.h> 34 #include <p2os_msgs/SonarArray.h> 35 #include <p2os_msgs/DIO.h> 36 #include <p2os_msgs/AIO.h> 58 p2os_msgs::BatteryState
batt;
101 int SendReceive(
P2OSPacket * pkt,
bool publish_data =
true);
103 void updateDiagnostics();
105 void ResetRawPositions();
106 void ToggleSonarPower(
unsigned char val);
107 void ToggleMotorPower(
unsigned char val);
110 inline double TicksToDegrees(
int joint,
unsigned char ticks);
111 inline unsigned char DegreesToTicks(
int joint,
double degrees);
112 inline double TicksToRadians(
int joint,
unsigned char ticks);
113 inline unsigned char RadiansToTicks(
int joint,
double rads);
114 inline double RadsPerSectoSecsPerTick(
int joint,
double speed);
115 inline double SecsPerTicktoRadsPerSec(
int joint,
double secs);
117 void SendPulse(
void);
119 void check_and_set_vel();
120 void cmdvel_cb(
const geometry_msgs::TwistConstPtr &);
122 void check_and_set_motor_state();
123 void cmdmotor_state(
const p2os_msgs::MotorStateConstPtr &);
125 void check_and_set_gripper_state();
126 void gripperCallback(
const p2os_msgs::GripperStateConstPtr &
msg);
143 ptz_state_pub_,
sonar_pub_, aio_pub_, dio_pub_;
159 bool gripper_dirty_ =
false;
162 int rot_kp, rot_kv, rot_ki, trans_kp,
trans_kv, trans_ki;
205 #endif // P2OS_DRIVER__P2OS_HPP_ std::string psos_tcp_host
diagnostic_updater::Updater diagnostic_
int motor_max_speed
Maximum motor speed in Meters per second.
p2os_msgs::MotorState cmdmotor_state_
Motor state publisher.
p2os_msgs::SonarArray sonar
Container for sonar data.
bool use_sonar_
Use the sonar array?
int16_t motor_max_rot_decel
Minimum rotational acceleration in Meters per second per second.
struct ros_p2os_data ros_p2os_data_t
Container struct.
p2os_msgs::AIO aio
Analog In/Out.
int16_t motor_max_trans_decel
Minimum translational acceleration in Meters per second per second.
ros::NodeHandle n
Node Handler used for publication of data.
std::string psos_serial_port
int joystick
Use Joystick?
std::string base_link_frame_id
p2os_msgs::GripperState gripper
Provides the state of the gripper.
geometry_msgs::TransformStamped odom_trans
Transformed odometry frame.
ros::Publisher sonar_pub_
tf::TransformBroadcaster odom_broadcaster
int16_t motor_max_rot_accel
Maximum rotational acceleration in radians per second per second.
diagnostic_updater::DiagnosedPublisher< p2os_msgs::BatteryState > batt_pub_
int16_t motor_max_trans_accel
Maximum translational acceleration in Meters per second per second.
int bumpstall
Stall I hit a wall?
p2os_msgs::GripperState gripper_state_
Gripper state publisher.
ros::Subscriber ptz_cmd_sub_
p2os_msgs::BatteryState batt
Provides the battery voltage.
int motor_max_turnspeed
Maximum turn speed in radians per second.
double lastPulseTime
Last time the node received or sent a pulse.
std::string odom_frame_id
ros::NodeHandle nh_private
Node Handler used for private data publication.
ros_p2os_data_t p2os_data
sensor data container
geometry_msgs::Twist cmdvel_
Command Velocity subscriber.
p2os_msgs::MotorState motors
Provides the state of the motors (enabled or disabled)
nav_msgs::Odometry position
Provides the position of the robot.
int direct_wheel_vel_control
Control wheel velocities individually?
p2os_msgs::DIO dio
Digital In/Out.