Guidance needed in exercise 5.2

Hi, i am totally new to ROS. In exercise 5.2, we are required to make a new package my_motion_scripts. I tried running it and failed. May i know the exact method to make this package? Would be useful to include in the exercise as well for newbies like myself.

in my launch file “planning.launch”:

<node name = "planning_scripts_node_launch" pkg = "my_motion_scripts" type = "planning_script.py" output = "screen">
</node>

in my python file “planning_script.py”
#! /usr/bin/env python

import sys

import copy

import rospy

import moveit_commander

import moveit_msgs.msg

import geometry_msgs.msg

moveit_commander.roscpp_initialize(sys.argv)

rospy.init_node(‘move_group_python_interface_tutorial’, anonymous=True)

robot = moveit_commander.RobotCommander()

scene = moveit_commander.PlanningSceneInterface()

group = moveit_commander.MoveGroupCommander(“arm”)

display_trajectory_publisher = rospy.Publisher(‘/move_group/display_planned_path’, moveit_msgs.msg.DisplayTrajectory, queue_size=1)

pose_target = geometry_msgs.msg.Pose()

pose_target.orientation.w = 1.0

pose_target.position.x = 0.96

pose_target.position.y = 0

pose_target.position.z = 1.18

group.set_pose_target(pose_target)

plan1 = group.plan()

rospy.sleep(5)

moveit_commander.roscpp_shutdown()

Hi @zulqarnain.abdul.halil ,

Welcome to this Community!

Looking at the picture of your IDE setup, the project folder my_motion_scripts does not seem to contain CMakeLists.txt file and package.xml file.

Are you sure you created this package using catkin_create_pkg command?

If you did not create the package that way, then you need to refer how to create a package in ROS1 (Noetic) and then implement that here.

Currently your my_motion_scripts is not a ROS package, it is just a regular folder with codes in it.
This will not work.

Regards,
Girish

Hi,

I created the package using catkin_create_pkg command as suggested at it works. Thanks!

Best Regards
Zulqarnain

Hi @zulqarnain.abdul.halil ,

Glad to know that your issue is now resolved.

Please mark the post as solution so this thread can be closed.

Regards,
Girish

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