I am writing scripts c++ on the unit4_exercise, but the result that the robot cannot read the laser beam. Can I get some idea ?
Hi @Ricoder007 ,
Could you post your complete code and your complete terminal output as code-blocks?
Refer code-blocks: Extended Syntax | Markdown Guide
Regards,
Girish
My code block on the Unit4_exercise
#include "rosbot_control/rosbot_class.h"
#include "ros/init.h"
int main(int argc, char **argv) {
ros::init(argc, argv, "rosbot_node");
RosbotClass rosbot;
rosbot_move.forward(3);
// Get reading beams
float right = rosbot.get_laser(121);
float left = rosbot.get_laser(431);
// Define and assign array values
float array_laser[] = {left, right};
// Print array
ROS_INFO_STREAM("The wall is at "
<< array_laser[0] << " meters to the left, and at "
<< array_laser[1] << " meters to the right from the robot ");
return 0;
}
Complete Terminal output result
user:~$ cd ~/catkin_ws/src/cpp_course_repo
user:~/catkin_ws/src/cpp_course_repo$ rosrun c_scripts unit4_exercise
[ INFO] [1674219697.919711683]: Initializing node …
[ INFO] [1674219701.983606171, 470.116000000]: 0.906405
Its seem the result cannot print array