Hello ROS team and community,
I’ve been having an issue with the can rotation of in unit 2.4. Actually, if I follow the steps for the creation of rotation_can.py
, it doesn’t import the can in the stimulation. Has anyone had the same issue?
Thank you in advance,
@petrouli_g
the python script in the unit 2.4 which is used to rotate the can doesnt actually import the can rather it publishes a result into the transform thereby allowing gazebo to update the can’s position using the set_model_state.
so if there isnt any model named coke_can it wont rotate it as the jupyter notebook shows as.
add these following lines to import the cake can(ps :- provided you are not able to see the coke can before running the rotation_can.py script)::
import math, rospy
from utilities import set_model_state, get_model_state, spawn_coke_can
from geometry_msgs.msg import Pose, Point, Quaternion
if get_model_state(‘coke_can’).success == False:
spawn_coke_can('coke_can', Pose(position=Point(1,0,0.22)))
model_state = get_model_state(‘coke_can’)
print (model_state.pose.position)
or simply you can add spawn_coke_can at the end of the import utilities line
and type the following in the code
spawn_coke(‘coke_can’, Pose(position=Point(1,0,0)))
1 Like