Gazebo | Ignition | Community
Ask Your Question

Use Pygazebo with Link class to set Link position/linear velocity?

asked 2018-05-31 10:00:46 -0500

pj gravatar image

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 However, I am getting the error:

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

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-11-14 03:35:16 -0500

AlberSaber gravatar image

i think that you used joint_cmd_pb2 that control joints not links i foubd that he have another file for links : i think that you can use it and i saw that it use : linear_velocity , angular_velocity

at lines no. 82 , 83 :

_LINKDATA.fields_by_name['linear_velocity'].message_type = vector3d_pb2._VECTOR3D _LINKDATA.fields_by_name['angular_velocity'].message_type = vector3d_pb2._VECTOR3D

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 :

2-you will need this files too , KeyboardGUIPlugin.hh , , 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 target_link_libraries(KeyboardGUIPlugina ${GAZEBO_LIBRARIES} Qt5::Core)

add_library(KeysToJointsPlugin MODULE 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 ../

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="">

http://osrf-distributions.s3.amazonaw... http://osrf-distributions.s3.amazonaw...

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 .

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-05-31 10:00:46 -0500

Seen: 221 times

Last updated: Nov 14 '18