0
$\begingroup$

Rosanswers logo

Hello guys.

I'm new in Python and I'm doing a program to control a drone with openCV and ROS.

To control the drone, I'm sending the comand:

os.system("bash -c "source /opt/ros/kinetic/devel/setup.bash; rostopic pub -1 /cmd_vel geometry_msgs/Twist '{linear: {x: 1.0, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}'&"")

But I want to do this without call os.system, inside the code. Is it possible?


Originally posted by brunoribeiro on ROS Answers with karma: 1 on 2018-04-10

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

There is actually a tutorial describing exactly how to create a publisher in python.

You need to have your other question #q288170 resolved as well.

I'll highly recommend going through all the (beginner level) tutorials (relevant for the programming language you choose). Please also consider some general python tutorials if you are completely new to programming and/or python.


Originally posted by mgruhler with karma: 12390 on 2018-04-10

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.