Closed yrosascu closed 2 years ago
Hi, sorry did not see
I set ROS_IP= "IP of my pc"
There is already a (the?) problem. You set the ROS_IP of the brick on the brick, the ROS_IP of the PC on the PC.
You set ROS_IP to the ip the interface you use has. On your PC(Laptop) this is probably the wireless network card.
check it with ifconfig
wlp3s0 Link encap:Ethernet HWaddr ... inet addr:192.168.178.32 Bcast:192.168.178.255 Mask:255.255.255.0 ....
The first best way to check if ros is working is to
rosservice list
(on your PC)
after you started roscore on your PC and ev3_manager on your brick.
If you do not see any services of ros_control there is already a problem.
I have a little bash function in my bashrc, maybe it is of any use, if you are bored putting
export ROS_IP=192.168.178.32
all the time.
Actually there should be such function on the brick as well, check the prints after you log in.
set_rosip
in my case it would be
set_rosip wlp3s0 1 1
(with printing all debug messages)
Code:
#ROS IP setter
function set_rosip
{
RED="$(tput setb 4)"
GREEN="$(tput setaf 0)$(tput setb 2)"
BOLD=$(tput bold)
NOCOLOR=$(tput sgr0)
{
ifconfig $1
} &> /dev/null
if [ $? -ne 0 ]; then
echo -e "${RED}Interface ${BOLD}$1${NOCOLOR}${RED} not found! ${BOLD}ROS_IP not set!${NOCOLOR}"
return 1
fi
ip_addr=`ifconfig $1 | grep 'inet addr:' | cut -d: -f2 | awk '{print $1}'`
if [ -z "$ip_addr" ]; then
if [ "$3" == "1" ]; then
echo -e "${RED}Interface ${BOLD}$1${NOCOLOR}${RED} not connected, ${BOLD}ROS_IP not set!${NOCOLOR}"
fi
return 1
fi
if [ "$2" == "1" ]; then
echo ${GREEN}ROS_IP set to $1 with IP $ip_addr${NOCOLOR}
fi
export ROS_IP=$ip_addr
}
Hi, I did everything that you recommended me, I check the file "h4r_ros.bash" but the code is different.
function ros_ip_set
{
RED="\e[37;41m"
GREEN="\e[30;42m"
YELLOW="\e[30;43m"
BOLD="\e[1m"
NOCOLOR="\e[0m"
if [ "$1" == "" ]; then
unset ROS_IP
rm -rf $H4R_ROS_IP_FILE
echo -e "${YELLOW}ROS_IP unset${NOCOLOR}"
return 0
fi
#$1 network interface
#$2 report on success [default - 1]
#$3 report on error [default - 1]
{
ifconfig $1
} &> /dev/null
if [ "$?" -ne 0 ]; then
echo -e "${RED}Interface ${BOLD}$1${NOCOLOR}${RED} not found! ${BOLD}ROS_IP not set!${NOCOLOR}"
return 1
fi
ip_addr=`ifconfig $1 | grep 'inet addr:' | cut -d: -f2 | awk '{print $1}'`
if [ -z "$ip_addr" ]; then
if [ "$3" != "0" ]; then
echo -e "${RED}Interface ${BOLD}$1${NOCOLOR}${RED} not connected, ${BOLD}ROS_IP not set!${NOCOLOR}"
fi
return 1
fi
if [ "$2" != "0" ]; then
echo -e ${GREEN}ROS_IP set to $1 with IP $ip_addr${NOCOLOR}
fi
export ROS_IP=$ip_addr
echo "$ip_addr" > $H4R_ROS_IP_FILE
return 0
}
And the command ros_ip_set
don't work:
root@ev3dev:~# ros_ip_set 192.168.10.10
Interface 192.168.10.10 not found! ROS_IP not set!
My red is:
IP pc = 192.168.10.10
IP brick = 192.168.10.123
I did ping between them and then i did ssh root@192.168.10.123
and when ev3 run i set ROS_IP variable with command export ROS_IP=192.168.10.10
(because ros_ip_set dont work), then y run roscore on my pc and ev3_manager on brick but i have the same error.
With the last changes when i running some these files are not found. Maybe do you have the initial code? because i think the error is the communication bewteen brick and pc.
I need a lot of help.
Interface 192.168.10.10 not found! ROS_IP not set!
It expects the Interface (wlan0, eth0 ... ), you entered the IP (192.168.10.10)
And I have not told you that both scripts are the same, just that there is already a command for easily setting the ROS_IP on the brick.
The script I posted was for the PC. You can use it, if you do not want to do:
in every terminal you want to use with ROS.
instead you do set_rosip wlan0
and you are done.
(wlan0 is an example!, check your interface name!)
:warning: if you reconnect to the network your IP might change, you need to execute the command everywhere again!
I recommend to get a Router with a DNS (if you have an old one you can check if it supports OpenWRT (alternative firmware) which is shipped with a DNS server)
Sorry for asking again.
I connect pc and brick with usb, so the ip dont change. Is this setting correct for communication between devices?
IP of PC = 192.168.10.10
IP of Brick = 192.168.10.123
In Brick:
ros_master_set 192.168.10.10
ROS_IP = 192.168.10.10
In PC:
ROS_MASTER_URI=http://localhost:11311
Run roscore
in pc, ev3_manager
in brick. When i run rosservice list
in pc, i get this:
ieka@ieka:~/catkin_ws$ rosservice list
/ev3dev/Ev3ControlNode/get_loggers
/ev3dev/Ev3ControlNode/set_logger_level
/ev3dev/controller_manager/list_controller_types
/ev3dev/controller_manager/list_controllers
/ev3dev/controller_manager/load_controller
/ev3dev/controller_manager/reload_controller_libraries
/ev3dev/controller_manager/switch_controller
/ev3dev/controller_manager/unload_controller
/ev3dev/controller_spawner/get_loggers
/ev3dev/controller_spawner/set_logger_level
/ev3dev/ev3_manager_node/get_loggers
/ev3dev/ev3_manager_node/set_logger_level
/rosout/get_loggers
/rosout/set_logger_level
I connect motor to port A and B, then i launch motors.launch but nothing happens, then i publish:
rostopic pub /ev3dev/OutPortA/command std_msgs/Float64 "data: 5.0"
but motor dont move.
So i dont undertand what I am doing wrong, for that reason I think my configuration is not correct.
And when I stop ev3_manager node if I launch motors.launch there is not error.
Hi again, Ehm have you installed this hotfix on the brick? https://github.com/Hacks4ROS/h4r_ev3_ctrl/releases
Check if that solves the issues.
Just to be sure try to publish a rostopic on pc and try to echo it on the brick and the other way round to be sure communication is working properly.
Hello, I installed the packages to control ev3 then I launched the motors but it doesn't work. I did everything that is mentioned in Geting Started In brick: I set ROS_IP= "IP of my pc" ev3_manager
In PC: roslaunch motors.launch ev3_hostname:=ev3dev
Then I start "rqt" to try move motors with any value in "Message Publisher" i get this http://imgur.com/a/MQLcd and the motors don't move.
When i do
rostopic echo /ev3dev/joint_states
the data don't change and i get this:The only data that change are sec and nsecs. I delete the tag mentioned in # 11 but it does not work because topics "OutPort#" don't appear. Try several times, with variations on the other ports and topics but nothing moves the motors.
do i need to modify any file? i don't understand why they don't work. I read other issues but don't find other similary error.
I hope that you can help me.
Thank you