This program is porting rosserial_arduino for mbed http://www.ros.org/wiki/rosserial_arduino This program supported the revision of 169 of rosserial. This program contains an example.
Dependencies: rosserial_mbed_lib mbed Servo
Diff: examples/TimeTF.cpp
- Revision:
- 0:06fc856e99ca
- Child:
- 3:dff241b66f84
diff -r 000000000000 -r 06fc856e99ca examples/TimeTF.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/TimeTF.cpp Fri Aug 19 09:06:16 2011 +0000 @@ -0,0 +1,41 @@ +//#define COMPILE_TIMETF_CODE_ROSSERIAL +#ifdef COMPILE_TIMETF_CODE_ROSSERIAL + +/* + * rosserial Time and TF Example + * Publishes a transform at current time + */ + +#include "mbed.h" +#include <ros.h> +#include <ros/time.h> + +ros::NodeHandle nh; + +#include <tf/transform_broadcaster.h> + +geometry_msgs::TransformStamped t; +tf::TransformBroadcaster broadcaster; + +char base_link[] = "/base_link"; +char odom[] = "/odom"; + +int main() { + nh.initNode(); + + while (1) { + t.header.frame_id = odom; + t.child_frame_id = base_link; + t.transform.translation.x = 1.0; + t.transform.rotation.x = 0.0; + t.transform.rotation.y = 0.0; + t.transform.rotation.z = 0.0; + t.transform.rotation.w = 1.0; + t.header.stamp = nh.now(); + broadcaster.sendTransform(t); + nh.spinOnce(); + wait_ms(10); + } +} + +#endif \ No newline at end of file