Hacks4ROS / h4r_ev3_ctrl

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

Fix example launch files #11

Open dabakix8 opened 7 years ago

dabakix8 commented 7 years ago

Hello.

I am trying to start motor with using motor.launch which is provided as an example. But it does not work for me. Actually, I've already checked closed thread #2 and #6, but I am still confusing.

My situation is the follwoings:

  1. My PC and ev3 can communicate vis ssh.
  2. ultrasonic.launch works. I could see the value from ultrasonic sensor.

I compiled every packages which provided in "Hacks4ROS/h4r_ev3_ctrl " in my PC. So, I am thinking that it is possible that when I run "roslaunch motors.lauch", "h4r_ev3_manager" in my PC is started.

When I do "rosnode list", I can see "/ev3dev/ev3_manager_node", but the following command does not work. rostopic pub /ev3dev/OutPortA/command std_msgs/Float64 "data: 5.0"

Do I need to modify "motors.launch" according to my environment? I need a hint.

Thank you.

md

dabakix8 commented 7 years ago

Hello.

I resolved it. Actually, it was memtioned in #2, but it was not clear. Concretely, what I did is below.

I deleted the following tag from the exapmle of motor.launch, then it works.

"node pkg="h4r_ev3_manager" type="ev3_manager_node" name="ev3_manager_node" output="screen"" "/node"

I recommend the node tage above should be deleted from the example to avoid misunderstanding.

Thank you.

md

cyborg-x1 commented 7 years ago

Oh yeah that's right there are some issues in that one .. it should not start the manager node ... That's probably left from testing it myself some time ago

yrosascu commented 7 years ago

Hello,

Have you seen the data of your ultrasonic sensor? how did you do ? because I am trying to ,test this sensor and I havent receive any data, Did you do some change in the code?

dabakix8 commented 7 years ago

Hello, yrosascu-san

Honesty, it is not clear for me your present situation. You can communicate with ev3 via ssh? If yes, did you launch the provided launch file from your PC? I have not modificed any thing about launch file for ultrasonic.

To receive the data, you need to make one node to see the ultrasonic data. Did you do that? If yes, can I see your code? Launching ultrasonic sensor does not show data.

md

valerybugakov commented 7 years ago

@mdaiba Could share an example of your motor.launch file? I'm trying to get motors work too using this package. I got Ev3InfraredController working but cannot figure out how to configure motors. If I have only one motor on PortA should I delete all the configuration about other ports and inputs from the config files?

Also how did you figure out how to control motor? Cannot find any info about that.

Thanks!

valerybugakov commented 7 years ago

@cyborg-x1 maybe you could share an example for motor.launch? Would appreciate that.

cyborg-x1 commented 7 years ago

Just remove the motor you do not want the controller for in the launchfile. Here you probably see the connection: OutPortA is a name freely definable by you. But inside the launchfile it points to the settings in the yaml file:

in motors.yaml OutPortA:

type: velocity_controllers/JointVelocityController joint: Joint_A

<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="OutPortState OutPortA OutPortB "/>

So if you do not need OutportB:

<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="OutPortState OutPortA "/>

valerybugakov commented 7 years ago

@cyborg-x1 thanks for explanation, is there a place where can I read about it or maybe a code block where it's parsed and used? I've jumped into ROS stuff a month ago, hopefully it's not very dumb questions :)

Btw thanks for the awesome project!

cyborg-x1 commented 7 years ago

You are welcome ;-) You should read about ROS Control - thats the basic ros package/library behind ev3_manager

yrosascu commented 7 years ago

mdaiba, In my case, I still do not even get the movement of the motors, I guess the problem is the network configuration because it returns this: Couldn't find an AF_INET address for [ieka]

But I configured it as I have been recommended in the issues, but so far it does not move. I change hosts files as it says here: ros wiki but nothing. Maybe do you have any idea?

Thanks for you help.

cyborg-x1 commented 7 years ago

Best thing to check first if you can rostopic pub and echo in both directions Brick <-> PC AF_INET sounds a bit like DNS errors and you have to set ROS_IP, for ROS I recommend having a DNS runnning, cause even if ROS_IP is set, your IP can change each time you connect to the network which would require updating ROS_IP again and again. Get a router with OpenWRT or install a DHCP/DNS on one PC of your network.

yrosascu commented 7 years ago

I reserved the IP's (brick and pc) in my router but i supposse that is my last option. My router don't have support in OpenWRT, can i use another firmware? I have a TP-Link WR940N router.

Thanks for the suggestions.

cyborg-x1 commented 7 years ago

the DNS is the Key... OpenWRT is a alternative Firmware for your Router. Be careful if you use it for Internet Access! I never tried that with OpenWRT.

It seems there is one for your Router: https://wiki.openwrt.org/toh/tp-link/tl-wr940n

Otherwise you could create one with your computer: https://www.linux.com/learn/dnsmasq-easy-lan-name-services

dabakix8 commented 7 years ago

yrosascu

Sometimes, I am confronted with same issue as you said.

Couldn't find an AF_INET address for xxxxxx

Please make sure with "printenv" that your ROS_IP and ROS_MASTER_URI are reflected before you run your script (*.py) or your launch file. I found sometimes I did misspel, sometimes the setting is deleted before running my script (weird).

When this issue is happen, re-run roscore and ev3_manager, and checking ROS_IP, ROS_MASTER_URI before running script is helping me. But I would like to check the route cause of this.

mdaiba

cyborg-x1 commented 7 years ago

Oh yeah, now that you say this, it could be that the script is not sourcing again after applying changes.

cyborg-x1 commented 7 years ago

Function for ROS_IP:

https://github.com/Hacks4ROS/meta-h4r-ev3/blob/develop/meta-h4r-ev3dev-services/recipes-system/h4r-ev3-user/files/h4r_ros.bash#L44

In my opinion it should work... it exports the IP directly as well. https://github.com/Hacks4ROS/meta-h4r-ev3/blob/develop/meta-h4r-ev3dev-services/recipes-system/h4r-ev3-user/files/h4r_ros.bash#L86

rongfeng-china commented 6 years ago

Hi, guys... I followed this instruction, but still got the error “[ERROR] [1528615186.304805597]: Waiting for rosmaster” "Couldn't find an AF_INET address for [http]" in lego ev3.

I followed this [tutorial] (http://hacks4ros.github.io/h4r_ev3_ctrl/index.html#GettingStarted) until the end of [First steps for setting Wireless.], and I connected lego and computer with USB cable successfully. My computer IP: 192.168.10.2 My lego IP: 192.168.10.123 screenshot from 2018-06-10 01-24-31

I'm able to ping from lego to computer and ping from computer to lego, so network is working.

What could be the problem? Many thanks!!

cyborg-x1 commented 6 years ago

I guess again a problem with DNS. check for ROS_IP in ROS Documentation. Have you set ROS_IP on your computer to your computers IP? export ROS_IP=192.168.10.2

(need to do in every terminal you want to start a process to connect to the Brick. If you have a fixed IP for your computer in the network, it can go in the bashrc next to source /opt/ros/version/setup.bash)

Or you need local DNS in your Network...

See also, first result for search terms: ROS AF_INET on Google...

https://answers.ros.org/question/163556/how-to-solve-couldnt-find-an-af_inet-address-for-problem/

rongfeng-china commented 6 years ago

Thanks, my lego can connect with PC with USB cable. I also wrote some scripts to control the motors. They are working well now. Thank you!! I have another problem recently, it would be great if you can have a look below. //------------------------------------------------------------------------------------------------------------------------------ I'm considering to use wifi rather than USB for connection. However, neither of these two adaptors can work: 1. Realtek Semiconductor Corp. RTL8191SU 802.11n WLAN Adapter 2. Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter. I checked with 'lsusb' and the device can be detected. However 'ifconfig' does not show the wifi infomation. screenshot from 2018-06-26 22-44-55

I also tried to install the driver for rtl8191, but it seems very tedious and not successful. Have you tried wifi connection, and could you give some more explanations? Thanks