Hacks4ROS / h4r_ev3_ctrl

ROS Node for managing EV3 with ROS Control
GNU General Public License v3.0
21 stars 12 forks source link

Cannot roslaunch motors.launch #6

Closed JDdieSonne closed 7 years ago

JDdieSonne commented 8 years ago

Hello, for a project at my university i'm trying to get ROS running on EV3. After some problems i got Yocto booted on the roboter and a wifi connection with my laptop. But now i have the problem, that i cannot roslaunch motors. launch; here is the terminal code:

johnny@johnny-ThinkPad-E560:~/catkin_ws/src/h4r_ev3_ctrl/h4r_ev3_launch/launch$ roslaunch motors.launch ... logging to /home/johnny/.ros/log/5b624bf0-7a76-11e6-9a47-dc5360e3e6c1/roslaunch-johnny-ThinkPad-E560-11331.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB.

[motors.launch] requires the 'ev3_hostname' arg to be set The traceback for the exception was written to the log file

i also tried to set the hostname manually in the .launch but then he cannot find the ressource h4r_ev3_launch

I would really appreciate a little guide so i can also control the EV3 with my Remote Controller (like in your Youtube Video).

Thank you for your help!

JDdieSonne commented 7 years ago

Update: After changing my .launch files i got motors.launch running, but rostopic pub /ev3dev/OutPortA/command std_msgs/Float64 "data: 5.0" won't move the motor... It's quite weird because ev3_ev3dev-lang-demo somehow also don't get the motors running but everything else is working. After running motors.launch i also get a warning, that controller_spawner-2 has died, here is the complete output:

root@ev3dev:/catkin_ws/src/h4r_ev3_ctrl/h4r_ev3_launch/launch# roslaunch motors.launch ... logging to /home/root/.ros/log/55b17d48-7b34-11e6-9dd8-dc5360e3e6c1/roslaunch-ev3dev-337.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ev3dev:44509/

SUMMARY

PARAMETERS

NODES /ev3dev/ev3dev/ controller_spawner (controller_manager/spawner) ev3_manager_node (h4r_ev3_manager/ev3_manager_node)

ROS_MASTER_URI=http://johnny-ThinkPad-E560.local:11311

core service [/rosout] found process[ev3dev/ev3dev/ev3_manager_node-1]: started with pid [347] getFilePTR opening: /sys/class/tacho-motor/motor0/position 0x12f3d0 getFilePTR opening: /sys/class/tacho-motor/motor0/speed 0x59f70 getFilePTR opening: /sys/class/tacho-motor/motor2/position 0x74c50 getFilePTR opening: /sys/class/tacho-motor/motor2/speed 0x75740 getFilePTR opening: /sys/class/tacho-motor/motor1/position 0x758a8 getFilePTR opening: /sys/class/tacho-motor/motor1/speed 0x75a10 process[ev3dev/ev3dev/controller_spawner-2]: started with pid [356] [INFO] [WallTime: 1471714515.459044] Controller Spawner: Waiting for service controller_manager/load_controller [INFO] [WallTime: 1471714515.928682] Controller Spawner: Waiting for service controller_manager/switch_controller [INFO] [WallTime: 1471714516.846240] Controller Spawner: Waiting for service controller_manager/unload_controller [INFO] [WallTime: 1471714517.236254] Loading controller: OutPortState [INFO] [WallTime: 1471714534.328121] Loading controller: OutPortA [INFO] [WallTime: 1471714577.721679] Loading controller: OutPortB [INFO] [WallTime: 1471714579.711679] Controller Spawner: Loaded controllers: OutPortState, OutPortA, OutPortB [ INFO] [1471714581.579328147]: Controller Change [ INFO] [1471714581.707380147]: velocity_controllers/JointVelocityController requests Joint OutPortA Joint_A [ INFO] [1471714581.976961772]: <--------------EV3 Joint Joint_A----------------> [ INFO] [1471714582.080985106]: Joint control mode: velocity [ INFO] [1471714582.257696606]: P: 1001 I: 61 D: 1 [ INFO] [1471714582.289486147]: </-------------EV3 Joint Joint_A---------------->

[ INFO] [1471714582.329287314]: PID 1001 61 1 [ INFO] [1471714582.471780523]: velocity_controllers/JointVelocityController requests Joint OutPortB Joint_B getFilePTR opening: /sys/class/tacho-motor/motor0/command 0x75b78 [ INFO] [1471714582.574949648]: <--------------EV3 Joint Joint_B----------------> [ INFO] [1471714582.684374481]: Joint control mode: velocity [ INFO] [1471714582.867800064]: P: 1002 I: 62 D: 2 [ INFO] [1471714582.895553231]: </-------------EV3 Joint Joint_B---------------->

[ INFO] [1471714582.963444273]: PID 1002 62 2 getFilePTR opening: /sys/class/tacho-motor/motor0/speed_pid/Kp 0xdd198 getFilePTR opening: /sys/class/tacho-motor/motor0/speed_pid/Ki 0x132738 getFilePTR opening: /sys/class/tacho-motor/motor0/speed_pid/Kd 0x131588 [INFO] [WallTime: 1471714583.411676] Started controllers: OutPortState, OutPortA, OutPortB [ev3dev/ev3dev/controller_spawner-2] process has died [pid 356, exit code -9, cmd /opt/ros/indigo/lib/controller_manager/spawner OutPortState OutPortA OutPortB name:=controller_spawner __log:=/home/root/.ros/log/55b17d48-7b34-11e6-9dd8-dc5360e3e6c1/ev3dev-ev3dev-controller_spawner-2.log]. log file: /home/root/.ros/log/55b17d48-7b34-11e6-9dd8-dc5360e3e6c1/ev3dev-ev3dev-controllerspawner-2.log [ev3dev/ev3dev/ev3_manager_node-1] process has died [pid 347, exit code -9, cmd /opt/ros/indigo/lib/h4r_ev3_manager/ev3_manager_node name:=ev3_manager_node __log:=/home/root/.ros/log/55b17d48-7b34-11e6-9dd8-dc5360e3e6c1/ev3dev-ev3dev-ev3_manager_node-1.log]. log file: /home/root/.ros/log/55b17d48-7b34-11e6-9dd8-dc5360e3e6c1/ev3dev-ev3dev-ev3_managernode-1.log all processes on machine have died, roslaunch will exit shutting down processing monitor... ... shutting down processing monitor complete done root@ev3dev:/catkin_ws/src/h4r_ev3_ctrl/h4r_ev3_launch/launch#

Would appreciate any help, so i can get my motors running, i can also provide more info if you need them.

Thank you for your help!

JDdieSonne commented 7 years ago

I also saw the closed topic, that you have to run motors.launch on your EV3, so thats probably not the problem i have here...

cyborg-x1 commented 7 years ago

you should probably not use roslaunch on the ev3 - its python and takes lot of resources.... just execute ev3_manager on the brick. It could be that you can not successfully communicate with the ev3 and your computer. Do you have DNS running? Can you do ping ev3dev on your pc and ping on your ev3?

If not, you probably have to setup ROS IP

JDdieSonne commented 7 years ago

So what program do i have to launch on which computer? Because in Issue #2 you told to launch motors.launch on the ev3. Im quite confused and would like a short step by step guide. Thank you for your help!

cyborg-x1 commented 7 years ago

Nope I said he should execute the ev3_manager there.

It is also said in my Getting Started: http://hacks4ros.github.io/h4r_ev3_ctrl/

Actually you need to launch two things, after setup:

And If it is not working like that: it could be, that you have no connection from EV3 to your PC. Because ROS requires a DNS to work normally. If you do not have a DNS in your system - which makes it possible to do for example ssh root@ev3dev instead of ssh root@192.168.0.23 - then you need ROS ip. And then you set the ROS master URI to something like http://IP_OF_YOUR_PC:11311 and use the rosip command to set the rosip on the brick and you also need to export it on your pc like export ROS_IP="IP_OF_YOUR_PC".

See also (it is basic ros stuff): http://wiki.ros.org/ROS/NetworkSetup http://wiki.ros.org/ROS/Tutorials/MultipleMachines

JDdieSonne commented 7 years ago

Thanks for your help, its working fine for me now! Just one last question: What do i have to do to control the EV3 with my remote controller? Is there already a programm for that problem, or do i have to write it on my own? I also wanna control my EV3 like you in your Youtube-Video :) And again, thanks for your help!

cyborg-x1 commented 7 years ago

:+1: Nice, you are welcome ;-)

Well you need a joy node connected to a node which translates the joystick to speed around z and along x axis and outputs a topic mostly called /cmd_vel (geometry_msgs/Twist) and to launch a dual drive controller using two joints on the EV3. Those nodes are mainly called teleop (teleoperation) there should be many around: Example: http://wiki.ros.org/teleop_twist_joy (joy)--/joy-->(teleop)--/cmd_vel---->(ev3_manager with diff drive)

JDdieSonne commented 7 years ago

After a little break, i'm trying to get my robot running again, the teleop node is running fine, but i have no idea, how i have to use the /cmd_vel topics now to get my robot working. I never worked with ros_control, so i'm very grateful for your help!

cyborg-x1 commented 7 years ago

Does it publish messages to the right topic? Do you receive the messages on your EV3?

JDdieSonne commented 7 years ago

i can echo the /cmd_vel topic on my EV3, so no problem there. What i don't understand is, what i have to do after that to have my motors running. You said, i need a diff_drive controller to use the topics, but what type of controller is working, when i start ev3_manager on my EV3. What type of messages to i have to publish to get it working? I am feeling like i am on my last step to get it running, just need some little help to run the EV3 motors with the /cmd_vel topics

cyborg-x1 commented 7 years ago

Well the thing is you need to create launchfiles which load the motors. Those launchfiles are executed on your PC. They advice the ros control manager in the ev3_manager to load shard libraries. You supply arguments to it by the yaml setting file or parameters in the launchfile. Those parameters define, what controller is loaded and which topics the controller uses. So if you load controllers the ev3_manager node will spawn publishers and subscribers depending on the controller.

Just saw there is also an issue with the examples, but this should do:

<launch>
    <group ns="$(arg ev3_hostname)">
        <!-- Load joint controller configurations from YAML file to parameter server -->
        <rosparam file="$(find h4r_ev3_launch)/config/motors.yaml" command="load"/>
        <!-- load the controllers -->
        <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
        output="screen" args="OutPortState diffDrv "/>
    </group>        
</launch>

motors.yaml is in h4r_ev3_launch. You can copy it to yours and change the name in the rosparam line

Motors are set to be connected to Port C and D there.