Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
314 views
in Technique[技术] by (71.8m points)

python - Error with multiprocessing.Value when used in a ROS node (Melodic / Ubuntu 18.04)

In a ROS node before the definition of a Class, I have the following code

from multiprocessing import Process,  Value
from ctypes import c_char_p, c_bool

A = Value(c_bool, False)
B = Value(c_bool, False)

and when I run it I get the following error

auto-starting new master process[master]: started with pid [26966] ROS_MASTER_URI=http://localhost:11311

setting /run_id to f2255e28-6082-11eb-929b-144f8a2d7323 WARNING: Package name "restAPI" does not follow the naming conventions. It should start with a lower case letter and only contain lower case letters, digits, underscores, and dashes. process[rosout-1]: started with pid [26977] started core service [/rosout] process[api/restapi_ros-2]: started with pid [26985]

Traceback (most recent call last):
File "/home/catkin_ws/src/components/restAPI/src/restapi_ros.py", line 19, in

A = Value(c_bool, False)

TypeError: init() takes 1 positional argument but 3 were given [api/restapi_ros-2] process has died [pid 26985, exit code 1, cmd /home/catkin_ws/src/components/restAPI/src/restapi_ros.py /restapi_msg:=/restapi/msg __name:=restapi_ros __log:=/home/.ros/log/f2255e28-6082-11eb-929b-144f8a2d7323/api-restapi_ros-2.log]. log file: /home/.ros/log/f2255e28-6082-11eb-929b-144f8a2d7323/api-restapi_ros-2*.log

In my terminal with python2 and python3 I have no errors !!! any ideas how to solve this? and of course when I remove the lines in the ROS node I have no error

question from:https://stackoverflow.com/questions/65916491/error-with-multiprocessing-value-when-used-in-a-ros-node-melodic-ubuntu-18-04

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...