60 this->
jointState.header.stamp = ros::Time::now();
71 std::vector<double> data = _msg->data;
73 this->
genCoord = Eigen::Map<Eigen::MatrixXd>(data.data(), 18, 1);
79 ROS_ERROR(
"[LogUtils::OnGenCoordMsg] Could not solve forward kinematics!");
89 std::vector<double> data = _msg->data;
91 this->
genVel = Eigen::Map<Eigen::MatrixXd>(data.data(), 18, 1);
116 static const double timeout = 0.01;
126 static const double timeout = 0.01;
136 if (!ros::isInitialized())
144 ros::init_options::NoSigintHandler
148 this->
rosNode.reset(
new ros::NodeHandle(
"log_utils_node"));
150 ros::SubscribeOptions gen_coord_so =
151 ros::SubscribeOptions::create<std_msgs::Float64MultiArray>(
152 "/my_robot/gen_coord",
159 ros::SubscribeOptions gen_vel_so =
160 ros::SubscribeOptions::create<std_msgs::Float64MultiArray>(
168 ros::SubscribeOptions joint_state_so =
169 ros::SubscribeOptions::create<sensor_msgs::JointState>(
170 "/my_robot/joint_state",
177 ros::SubscribeOptions joint_state_cmd_so =
178 ros::SubscribeOptions::create<sensor_msgs::JointState>(
179 "/my_robot/joint_state_cmd",
186 ros::AdvertiseOptions gen_coord_log_ao =
187 ros::AdvertiseOptions::create<std_msgs::Float64MultiArray>(
190 ros::SubscriberStatusCallback(),
191 ros::SubscriberStatusCallback(),
196 ros::AdvertiseOptions gen_vel_log_ao =
197 ros::AdvertiseOptions::create<std_msgs::Float64MultiArray>(
200 ros::SubscriberStatusCallback(),
201 ros::SubscriberStatusCallback(),
206 ros::AdvertiseOptions joint_state_log_ao =
207 ros::AdvertiseOptions::create<sensor_msgs::JointState>(
210 ros::SubscriberStatusCallback(),
211 ros::SubscriberStatusCallback(),
216 ros::AdvertiseOptions joint_state_cmd_log_ao =
217 ros::AdvertiseOptions::create<sensor_msgs::JointState>(
218 "/log/joint_state_cmd",
220 ros::SubscriberStatusCallback(),
221 ros::SubscriberStatusCallback(),
bool SolveForwardKinematics(const GeneralizedCoordinates &_q, FootstepPositions &_f_pos)
The SolveForwardKinematics function calculates the Forward Kinematics, i.e. maps joint angles in Join...
void InitRos()
The InitRos function is called to initialize ROS.
std::unique_ptr< ros::NodeHandle > rosNode
Node used for ROS transport.
ros::Subscriber genVelSub
ROS Generalized Coordinates Subscriber.
void ProcessQueueThread()
The ProcessQueueThread function is a ROS helper function that processes messages.
sensor_msgs::JointState jointStateCmd
Joint State Command.
void OnGenCoordMsg(const std_msgs::Float64MultiArrayConstPtr &_msg)
The OnGenCoordMsg function handles an incoming generalized coordinates message from ROS.
std::thread rosProcessQueueThread
Thread running the rosProcessQueue.
virtual ~LogUtils()
Destructor.
Eigen::Matrix< Eigen::Vector3d, 4, 1 > fPos
Footstep positions.
sensor_msgs::JointState jointState
Joint State.
void OnGenVelMsg(const std_msgs::Float64MultiArrayConstPtr &_msg)
The OnGenVelMsg function handles an incoming generalized velocities message from ROS.
std::thread rosPublishQueueThread
Thread running the rosPublishQueue.
Kinematics kinematics
Kinematics.
Eigen::Matrix< double, 18, 1 > genVel
Generalized Velocities.
ros::Publisher genCoordLogPub
ROS Generalized Coordinates Log Publisher.
Eigen::Matrix< double, 18, 1 > genCoord
Generalized Coordinates.
ros::Subscriber jointStateSub
ROS Joint State Subscriber.
ros::Publisher genVelLogPub
ROS Generalized Velocities Log Publisher.
void OnJointStateMsg(const sensor_msgs::JointStateConstPtr &_msg)
The OnJointStateMsg function handles an incoming joint state message from ROS.
void InitRosQueueThreads()
The InitRosQueueThreads function is called to initialize the ROS Publish and Process Queue Threads.
ros::Publisher jointStateCmdPub
ROS Joint State Command Log Publisher.
ros::Subscriber genCoordSub
ROS Generalized Coordinates Subscriber.
void OnJointStateCmdMsg(const sensor_msgs::JointStateConstPtr &_msg)
The OnJointStateCmdMsg function handles an incoming joint state command message from ROS.
ros::CallbackQueue rosProcessQueue
ROS callbackque that helps process messages.
void PublishQueueThread()
The PublishQueueThread function is a ROS helper function that publish state messages.
ros::Subscriber jointStateCmdSub
ROS Joint State Command Subscriber.
ros::Publisher jointStatePub
ROS Joint State Log Publisher.
ros::CallbackQueue rosPublishQueue
ROS callbackque that helps publish messages.