Quiz 1 on how to read laser values and then make turtle bot move to the left or to the right

Hi, I am trouble finishing quiz 1 on the ROS 5 days course. I have the publisher and subscriber part done, but I am having trouble with the laser scan part. I can get the values, but I cannot use them to move the turtlebot.

Also, it would not let me use if statements for the twist function, and I do not know why. I understand what I was taught as far as publishers and subscribers, but I cannot figure out how to read my laser values, and then make the turtle bot move accordingly. It also will NOT let me use the robotcontrol() function that would allow me to get the laser and move. Attached below is my code, please let me know how to do this.

Code for quiz 1:
(scrubbed :see_no_evil:)

Code for using the robotcontrol() function that makes everything easy, but can’t use:
(scrubbed :see_no_evil:)

Hi @jor14012,

Welcome to the Community!

Because this is a quiz, we can only give you some hints.

You have made considerable progress, and the following posts can give you further ideas on how you can get the job done:

You can also search for more related posts by using the keywords “topics quiz” and “topics_quiz”.

Let us know how it goes.