-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
setup omega target with radio driver skeleton
- Loading branch information
Showing
5 changed files
with
74 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
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,26 @@ | ||
#include "radio_driver/radio_driver.h" | ||
|
||
static const bool kDebug = false; | ||
static const float kCommandRate = 20; | ||
static const float kCommandInterval = 1.0 / kCommandRate; | ||
|
||
namespace radio_driver { | ||
|
||
RadioDriver::RadioDriver(ros::NodeHandle nh) { | ||
// TODO: init radio device | ||
|
||
joystick_sub_ = | ||
nh.subscribe("/joystick", 10, &RadioDriver::joystickCallback, this); | ||
timer_ = nh.createSteadyTimer(ros::WallDuration(kCommandInterval), | ||
&RadioDriver::timerCallback, this); | ||
} | ||
|
||
void RadioDriver::joystickCallback(const sensor_msgs::Joy& msg) { | ||
// TODO: track this state | ||
} | ||
|
||
void RadioDriver::timerCallback(const ros::SteadyTimerEvent& event) { | ||
// TODO: publish commands | ||
} | ||
|
||
} // namespace radio_driver |
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,18 @@ | ||
#include <ros/ros.h> | ||
#include <sensor_msgs/Joy.h> | ||
|
||
namespace radio_driver { | ||
|
||
class RadioDriver { | ||
public: | ||
RadioDriver(ros::NodeHandle nh); | ||
|
||
private: | ||
void joystickCallback(const sensor_msgs::Joy& msg); | ||
void timerCallback(const ros::SteadyTimerEvent& event); | ||
|
||
ros::Subscriber joystick_sub_; | ||
ros::SteadyTimer timer_; | ||
}; | ||
|
||
} // namespace radio_driver |
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,15 @@ | ||
#include <ros/ros.h> | ||
#include <sensor_msgs/Joy.h> | ||
|
||
#include "radio_driver/radio_driver.h" | ||
|
||
int main(int argc, char** argv) { | ||
// Initialize ROS | ||
ros::init(argc, argv, "radio_driver"); | ||
ros::NodeHandle nh; | ||
|
||
radio_driver::RadioDriver radio_driver(nh); | ||
|
||
// Spin | ||
ros::spin(); | ||
} |