Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot roslaunch motors.launch #6

Closed
JDdieSonne opened this issue Sep 14, 2016 · 11 comments
Closed

Cannot roslaunch motors.launch #6

JDdieSonne opened this issue Sep 14, 2016 · 11 comments

Comments

@JDdieSonne
Copy link

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
Copy link
Author

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

  • /ev3dev/ev3dev/Ev3devJoints/Joint_A/mode: velocity
  • /ev3dev/ev3dev/Ev3devJoints/Joint_A/speed_pid: [1001, 61, 1]
  • /ev3dev/ev3dev/Ev3devJoints/Joint_B/mode: velocity
  • /ev3dev/ev3dev/Ev3devJoints/Joint_B/speed_pid: [1002, 62, 2]
  • /ev3dev/ev3dev/Ev3devJoints/Joint_C/mode: velocity
  • /ev3dev/ev3dev/Ev3devJoints/Joint_C/speed_pid: [1003, 63, 3]
  • /ev3dev/ev3dev/Ev3devJoints/Joint_D/mode: velocity
  • /ev3dev/ev3dev/Ev3devJoints/Joint_D/speed_pid: [1004, 64, 4]
  • /ev3dev/ev3dev/OutPortA/joint: Joint_A
  • /ev3dev/ev3dev/OutPortA/type: velocity_controll...
  • /ev3dev/ev3dev/OutPortB/joint: Joint_B
  • /ev3dev/ev3dev/OutPortB/type: velocity_controll...
  • /ev3dev/ev3dev/OutPortState/publish_rate: 10
  • /ev3dev/ev3dev/OutPortState/type: joint_state_contr...
  • /ev3dev/ev3dev/diffDrv/angular/z/has_acceleration_limits: True
  • /ev3dev/ev3dev/diffDrv/angular/z/has_velocity_limits: True
  • /ev3dev/ev3dev/diffDrv/angular/z/max_acceleration: 1.5
  • /ev3dev/ev3dev/diffDrv/angular/z/max_velocity: 1.7
  • /ev3dev/ev3dev/diffDrv/base_frame_id: base_footprint
  • /ev3dev/ev3dev/diffDrv/cmd_vel_timeout: 0.5
  • /ev3dev/ev3dev/diffDrv/left_wheel: Joint_C
  • /ev3dev/ev3dev/diffDrv/linear/x/has_acceleration_limits: True
  • /ev3dev/ev3dev/diffDrv/linear/x/has_velocity_limits: True
  • /ev3dev/ev3dev/diffDrv/linear/x/max_acceleration: 0.8
  • /ev3dev/ev3dev/diffDrv/linear/x/max_velocity: 1.0
  • /ev3dev/ev3dev/diffDrv/linear/x/min_acceleration: 0.2# m/s^2
  • /ev3dev/ev3dev/diffDrv/linear/x/min_velocity: -1.0
  • /ev3dev/ev3dev/diffDrv/pose_covariance_diagonal: [0.0, 0.0, 0.0, 0...
  • /ev3dev/ev3dev/diffDrv/publish_rate: 10.0
  • /ev3dev/ev3dev/diffDrv/right_wheel: Joint_D
  • /ev3dev/ev3dev/diffDrv/twist_covariance_diagonal: [0.0, 0.0, 0.0, 0...
  • /ev3dev/ev3dev/diffDrv/type: diff_drive_contro...
  • /ev3dev/ev3dev/diffDrv/wheel_radius: 0.15
  • /ev3dev/ev3dev/diffDrv/wheel_radius_multiplier: 1.0
  • /ev3dev/ev3dev/diffDrv/wheel_separation: 1.0
  • /ev3dev/ev3dev/diffDrv/wheel_separation_multiplier: 1.0
  • /ev3dev/ev3dev/ev3_manager_node/InPorts: ['in1', 'in2', 'i...
  • /ev3dev/ev3dev/ev3_manager_node/OutPorts: ['outA', 'outB', ...
  • /rosdistro: indigo
  • /rosversion: 1.11.14

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.306940939]: ----------------------------------------------<
[ 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.927529106]: ----------------------------------------------<
[ 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-controller_spawner-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_manager_node-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
Copy link
Author

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
Copy link
Member

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
Copy link
Author

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
Copy link
Member

cyborg-x1 commented Sep 19, 2016

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:

  • roscore on your PC
  • ev3_manager is launched on your brick. (you enter "ev3_manager" in the console, not roslaunch ...)
  • And then you can use the launchfiles on your PC to load the controllers.
    Then you can send commands to your EV3 on the topics the controller loaded into the ev3_manager opens.

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
Copy link
Author

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
Copy link
Member

👍 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
Copy link
Author

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
Copy link
Member

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

@JDdieSonne
Copy link
Author

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
Copy link
Member

cyborg-x1 commented Oct 26, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants