Grading for the quiz in ROS basics in 5 days

My recent test in Unit 4 didn’t pass in ROS basic in 5 days even though my simulation works. There wasn’t any feedback provided as well so I’m unsure as to why it failed.

Hi @Shivani.s, can you send us here the scripts that you made so we can check if there is something wrong a provide you the feedback. For instance, the launch files, or the folder structure with the packages names? Also try to double check the names of the packages that you created: services_quiz, services_quiz_srv

Hi,
this was for the topics_quiz.py

#!/usr/bin/env python
#rosrun topics_quiz topics_quiz.py
#roslaunch topics_quiz topics_quiz.launch

import rospy
from geometry_msgs.msg import Twist
from sensor_msgs.msg import LaserScan

def cb(msg):
    pub = rospy.Publisher("/cmd_vel", Twist, queue_size=1)
    
    frontRange = msg.ranges[int(len(msg.ranges)/2)]
    rightRange = msg.ranges[0]
    leftRange = msg.ranges[len(msg.ranges)-1]
    
    move = Twist()
    move.linear.x = 0
    move.angular.z = 0

    if frontRange > 1:
        move.linear.x = 0.5
    elif frontRange < 1:
        move.angular.z = 0.5

    if rightRange < 1:
        move.angular.z = 0.5
    
    if leftRange < 1:
        move.angular.z = -0.5

    pub.publish(move)

rospy.init_node("topics_quiz_node")
sub = rospy.Subscriber("/kobuki/laser/scan", LaserScan, cb)
rospy.spin()

and this is my topics_quiz.launch

<launch>
    <node pkg="topics_quiz" type="topics_quiz.py" name="topics_quiz_node" output="screen">
    </node>
</launch>

My package structure looks like this
[

Please also include the screenshot of the grader saying you didn’t pass.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.