Created
January 31, 2014 01:56
-
-
Save rhololkeolke/8725291 to your computer and use it in GitHub Desktop.
Raspberry Pi ROS Test
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
cmake_minimum_required(VERSION 2.8.3) | |
project(driving_msgs) | |
find_package(catkin REQUIRED COMPONENTS roscpp message_generation) | |
add_message_files(DIRECTORY msgs) | |
generate_messages() | |
catkin_package( | |
CATKIN_DEPENDS message_runtime | |
) | |
include_directories(${catkin_INCLUDE_DIRS}) | |
add_executable(test_publisher src/test_publisher.cpp) | |
target_link_libraries(test_publisher ${catkin_LIBRARIES}) | |
add_dependencies(test_publisher ${PROJECT_NAME}_generate_messages_cpp) | |
install(TARGETS test_publisher | |
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} | |
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} | |
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} | |
) |
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
<package> | |
<name>driving_msgs</name> | |
<version>0.0.0</version> | |
<description>The driving_msgs package</description> | |
<!-- One maintainer tag required, multiple allowed, one person per tag --> | |
<!-- Example: --> | |
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> --> | |
<maintainer email="pi@todo.todo">pi</maintainer> | |
<!-- One license tag required, multiple allowed, one license per tag --> | |
<!-- Commonly used license strings: --> | |
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 --> | |
<license>TODO</license> | |
<!-- Url tags are optional, but mutiple are allowed, one per tag --> | |
<!-- Optional attribute type can be: website, bugtracker, or repository --> | |
<!-- Example: --> | |
<!-- <url type="website">http://ros.org/wiki/driving_msgs</url> --> | |
<!-- Author tags are optional, mutiple are allowed, one per tag --> | |
<!-- Authors do not have to be maintianers, but could be --> | |
<!-- Example: --> | |
<!-- <author email="jane.doe@example.com">Jane Doe</author> --> | |
<!-- The *_depend tags are used to specify dependencies --> | |
<!-- Dependencies can be catkin packages or system dependencies --> | |
<!-- Examples: --> | |
<!-- Use build_depend for packages you need at compile time: --> | |
<!-- <build_depend>message_generation</build_depend> --> | |
<!-- Use buildtool_depend for build tool packages: --> | |
<!-- <buildtool_depend>catkin</buildtool_depend> --> | |
<!-- Use run_depend for packages you need at runtime: --> | |
<!-- <run_depend>message_runtime</run_depend> --> | |
<!-- Use test_depend for packages you need only for testing: --> | |
<!-- <test_depend>gtest</test_depend> --> | |
<buildtool_depend>catkin</buildtool_depend> | |
<build_depend>message_generation</build_depend> | |
<build_depend>roscpp</build_depend> | |
<run_depend>message_runtime</run_depend> | |
<!-- The export tag contains other, unspecified, tags --> | |
<export> | |
<!-- You can specify that this package is a metapackage here: --> | |
<!-- <metapackage/> --> | |
<!-- Other tools can request additional information be placed here --> | |
</export> | |
</package> |
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
float32 wheel_angle | |
float32 gas | |
float32 brake | |
float32 vibration |
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
#include <ros/ros.h> | |
#include <driving_msgs/SensorStates.h> | |
int main(int argc, char** argv) | |
{ | |
ros::init(argc, argv, "test_publisher"); | |
ros::NodeHandle nh; | |
ros::Publisher pub = nh.advertise<driving_msgs::SensorStates>("test", 1000); | |
driving_msgs::SensorStates msg; | |
ros::Rate loop_rate(1000); | |
while(ros::ok()) | |
{ | |
pub.publish(msg); | |
loop_rate.sleep(); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment