-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <ros/ros.h> | ||
#include <geometry_msgs/Twist.h> | ||
#include <string> | ||
#include "./simple_sub.h" | ||
|
||
int main(int argc, char **argv) { | ||
// Step 1: Set up the node | ||
|
||
// Set up subscriber | ||
std::string subName = "/wheely_boi/wheely_boi/cmd"; | ||
// Step 2: Attach a subscriber to this node and point to chatterCallback | ||
|
||
// Don't go past this point so long as ros node is alive | ||
// Uncommnet this line when you're done | ||
// ros::spin(); | ||
|
||
|
||
// Return success | ||
return 0; | ||
} | ||
|
||
void chatterCallback(const geometry_msgs::Twist& t) { | ||
ROS_INFO("Linear: (%f, %f)", t.linear.x, t.linear.z); | ||
ROS_INFO("Angular: (%f, %f)\n", t.angular.x, t.angular.z); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef SIMPLE_SUB_H_ | ||
#define SIMPLE_SUB_H_ | ||
|
||
#include <ros/ros.h> | ||
#include <geometry_msgs/Twist.h> | ||
|
||
// Target function our subscriber will use to | ||
// process information gathered from topic | ||
void chatterCallback(const geometry_msgs::Twist&); | ||
|
||
#endif //SIMPLE_SUB_H_ |