I am trying to use pygazebo to control the position of links, which I thought was possible based on the attributes of the link class (as listed here https://media.readthedocs.org/pdf/pyg...). However, I am getting the error:

AttributeError: 'Assignment not allowed to composite field "pose" in protocol message object.'

Initally I thought to use message.pose.target (as one uses with Joint_CMD) but this did not work. Any advice?

edit retag close merge delete

Sort by » oldest newest most voted

i think that you used joint_cmd_pb2 that control joints not links https://github.com/jpieper/pygazebo/b... i foubd that he have another file for links : https://github.com/jpieper/pygazebo/b... i think that you can use it and i saw that it use : linear_velocity , angular_velocity

at lines no. 82 , 83 :

There is a nice example can hep you to understand the joints and move it by the keyboard ;) I am working on a task to move a link by the keyboard and i found that this example is helpfull .

if you like to tryit

1-it is the world file that have the map of the keys that you can test : https://bitbucket.org/osrf/gazebo/src...

2-you will need this files too KeyboardGUIPlugin.cc , KeyboardGUIPlugin.hh , KeysToJointsPlugin.cc , KeysToJointsPlugin.hh download it from :

The documentation of those files. http://osrf-distributions.s3.amazonaw... http://osrf-distributions.s3.amazonaw...

3- last 2 things , you need to write the CMakeLists.txt as :

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

find_package (Qt5Core REQUIRED) find_package (Qt5Widgets REQUIRED) set (CMAKE_AUTOMOC ON)

find_package(gazebo REQUIRED) include_directories(${GAZEBO_INCLUDE_DIRS}) link_directories(${GAZEBO_LIBRARY_DIRS}) list(APPEND CMAKE_CXX_FLAGS "${GAZEBO_CXX_FLAGS}") add_library(KeyboardGUIPlugin MODULE KeyboardGUIPlugin.cc) target_link_libraries(KeyboardGUIPlugina${GAZEBO_LIBRARIES} Qt5::Core)

add_library(KeysToJointsPlugin MODULE KeysToJointsPlugin.cc) target_link_libraries(KeysToJointsPlugina ${GAZEBO_LIBRARIES} Qt5::Core) 4-Then : mkdir build cd build cmake ../ make export GAZEBO_PLUGIN_PATH=pwd:$GAZEBO_PLUGIN_PATH gazebo -u --verbose ../simple_arm_teleop.world

press 6,h,y,u,j,i,k and see ;)

i found that KeysToJointsPlugin use JointController.hh so i try o make another one to the links but i am still looking for another classes that can do it from gazebo like Model Class or Link Calss part of <physics physics.hh="">

that have usefull funcations as : void SetAngularAccel (const ignition::math::Vector3d &_vel) GAZEBO_DEPRECATED(9.0) Set the angular acceleration of the model, and all its links. More...

void SetAngularVel (const ignition::math::Vector3d &_vel) Set the angular velocity of the model, and all its links. More...

void SetAnimation (const common::PoseAnimationPtr &_anim, boost::function< void()> _onComplete) Set an animation for this entity. More...

void SetAnimation (common::PoseAnimationPtr _anim) Set an animation for this entity. More...

i hope that my answer was usefull .

more