Zill Khan
/
ROSSerial_Sensors
Integration of multiple sensors with ROS Serial
Revision 0:d409714cebbf, committed 2021-10-23
- Comitter:
- zillkhan
- Date:
- Sat Oct 23 06:48:13 2021 +0000
- Commit message:
- Adding Sharp IR
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.gitignore Sat Oct 23 06:48:13 2021 +0000 @@ -0,0 +1,4 @@ +.build +.mbed +projectfiles +*.py*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SHARPIR.lib Sat Oct 23 06:48:13 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/zillkhan/code/SHARPIR_GP2Y0A51SK0F/#acdd61a2aac7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Oct 23 06:48:13 2021 +0000 @@ -0,0 +1,32 @@ +#include <ros.h> +#include <std_msgs/Float32.h> +#include <std_msgs/String.h> +#include "SHARPIR.h" + + +ros::NodeHandle nh; + +std_msgs::Float32 data; +ros::Publisher sharpir("sharpir", &data); + +SHARPIR Sensor(A0); + + +int main() { + float DistanceCM; + + nh.initNode(); + nh.advertise(sharpir); + + while (1) { //creates an eternal loop + + DistanceCM=Sensor.cm(); + //sprintf (buffer, "%f", DistanceCM); + + data.data = DistanceCM; + sharpir.publish( &data ); + + nh.spinOnce(); + wait_ms(1000); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Oct 23 06:48:13 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ros_lib_kinetic.lib Sat Oct 23 06:48:13 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/zillkhan/code/ros_lib_kinetic/#fe6bc4a56eeb