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

Custom message type cannot be properly displayed in REPL #86

Open
ShuhuaGao opened this issue Aug 23, 2020 · 0 comments
Open

Custom message type cannot be properly displayed in REPL #86

ShuhuaGao opened this issue Aug 23, 2020 · 0 comments

Comments

@ShuhuaGao
Copy link

ShuhuaGao commented Aug 23, 2020

Following the beginner tutorial Creating a ROS msg and srv, we define a custom message type Num:

gsh@starfish:~/catkin_ws$ rosmsg show Num
[beginner_tutorials/Num]:
int64 num
uint8 age
string name

Then, the Python module for this message was generated with catkin_make. Next, we import the Num message into Julia as follows:

julia> using RobotOS

julia> @rosimport beginner_tutorials.msg.Num

julia> rostypegen()

julia> using .beginner_tutorials.msg: Num

julia> a = Num(-234, 12, "hello");

julia> a.name
"hello"

As observed above, RobotOS supports custom messages well. However, if we want to print the above variable a, we usually simply type a (or print(a)) in REPL. However, an error will be caused

julia> a  # or print(a)
Error information

Error showing value of type ERROR: MethodError: no method matching show_type_name(::IOContext{REPL.Terminals.TTYTerminal}, ::PyCall.PyObject)
Closest candidates are:
  show_type_name(::IO, ::Core.TypeName) at show.jl:555
Stacktrace:
 [1] show_datatype(::IOContext{REPL.Terminals.TTYTerminal}, ::DataType) at ./show.jl:618
 [2] show(::IOContext{REPL.Terminals.TTYTerminal}, ::Type) at ./show.jl:497
 [3] print(::IOContext{REPL.Terminals.TTYTerminal}, ::Type{T} where T) at ./strings/io.jl:35
 [4] print(::IOContext{REPL.Terminals.TTYTerminal}, ::String, ::Type{T} where T, ::Vararg{Any,N} where N) at ./strings/io.jl:46
 [5] println(::IOContext{REPL.Terminals.TTYTerminal}, ::String, ::Vararg{Any,N} where N) at ./strings/io.jl:73
 [6] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:243
 [7] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:223
 [8] (::REPL.var"#do_respond#54"{Bool,Bool,REPL.var"#64#73"{REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:822
 [9] #invokelatest#1 at ./essentials.jl:710 [inlined]
 [10] invokelatest at ./essentials.jl:709 [inlined]
 [11] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/LineEdit.jl:2355
 [12] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:1143
 [13] (::REPL.var"#38#42"{REPL.LineEditREPL,REPL.REPLBackendRef})() at ./task.jl:356
caused by [exception 1]
MethodError: no method matching show_type_name(::IOContext{REPL.Terminals.TTYTerminal}, ::PyCall.PyObject)
Closest candidates are:
  show_type_name(::IO, ::Core.TypeName) at show.jl:555
Stacktrace:
 [1] show_datatype(::IOContext{REPL.Terminals.TTYTerminal}, ::DataType) at ./show.jl:618
 [2] show(::IOContext{REPL.Terminals.TTYTerminal}, ::Type) at ./show.jl:497
 [3] _show_default(::IOContext{REPL.Terminals.TTYTerminal}, ::Any) at ./show.jl:393
 [4] show_default at ./show.jl:389 [inlined]
 [5] show at ./show.jl:384 [inlined]
 [6] show(::IOContext{REPL.Terminals.TTYTerminal}, ::MIME{Symbol("text/plain")}, ::
SYSTEM (REPL): showing an error caused an error
ERROR: MethodError: no method matching show_type_name(::IOContext{REPL.Terminals.TTYTerminal}, ::PyCall.PyObject)
Closest candidates are:
  show_type_name(::IO, ::Core.TypeName) at show.jl:555
Stacktrace:
 [1] show_datatype(::IOContext{REPL.Terminals.TTYTerminal}, ::DataType) at ./show.jl:618
 [2] show(::IOContext{REPL.Terminals.TTYTerminal}, ::Type) at ./show.jl:497
 [3] print(::IOContext{REPL.Terminals.TTYTerminal}, ::Type{T} where T) at ./strings/io.jl:35
 [4] print(::IOContext{REPL.Terminals.TTYTerminal}, ::String, ::Type{T} where T, ::Vararg{Any,N} where N) at ./strings/io.jl:46
 [5] show_tuple_as_call(::IOContext{REPL.Terminals.TTYTerminal}, ::Symbol, ::Type{T} where T, ::Bool, ::Nothing) at ./show.jl:1788
 [6] show_tuple_as_call(::IOContext{REPL.Terminals.TTYTerminal}, ::Symbol, ::Type{T} where T, ::Bool) at ./show.jl:1755
 [7] show_spec_linfo(::IOContext{REPL.Terminals.TTYTerminal}, ::Base.StackTraces.StackFrame) at ./stacktraces.jl:242
 [8] show(::IOContext{REPL.Terminals.TTYTerminal}, ::Base.StackTraces.StackFrame; full_path::Bool) at ./stacktraces.jl:253
 [9] show_trace_entry(::IOContext{REPL.Terminals.TTYTerminal}, ::Base.StackTraces.StackFrame, ::Int64; prefix::String) at ./errorshow.jl:555
 [10] show_backtrace(::IOContext{REPL.Terminals.TTYTerminal}, ::Array{Base.StackTraces.StackFrame,1}) at ./errorshow.jl:659
 [11] showerror(::IOContext{REPL.Terminals.TTYTerminal}, ::MethodError, ::Array{Base.StackTraces.StackFrame,1}; backtrace::Bool) at ./errorshow.jl:93
 [12] show_exception_stack(::IOContext{REPL.Terminals.TTYTerminal}, ::Array{Any,1}) at ./errorshow.jl:737
 [13] display_error(::IOContext{REPL.Terminals.TTYTerminal}, ::Array{Any,1}) at ./client.jl:104
 [14] #invokelatest#1 at ./essentials.jl:710 [inlined]
 [15] invokelatest at ./essentials.jl:709 [inlined]
 [16] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:233
 [17] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:223
 [18] (::REPL.var"#do_respond#54"{Bool,Bool,REPL.var"#64#73"{REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:822
 [19] #invokelatest#1 at ./essentials.jl:710 [inlined]
 [20] invokelatest at ./essentials.jl:709 [inlined]
 [21] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/LineEdit.jl:2355
 [22] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:1143
 [23] (::REPL.var"#38#42"{REPL.LineEditREPL,REPL.REPLBackendRef})() at ./task.jl:356

Additionally, we cannot help such a type either.

help?> Num
search: Number numerator Enum enumerate @enum isnumeric VersionNumber minimum

ERROR: KeyError: key "module" not found
Stacktrace:
 [1] getproperty(::PyCall.PyObject, ::String) at /home/gsh/.julia/packages/PyCall/zqDXB/src/PyCall.jl:301
 [2] getproperty(::PyCall.PyObject, ::Symbol) at /home/gsh/.julia/packages/PyCall/zqDXB/src/PyCall.jl:306
 [3] aliasof(::DataType, ::Any) at ./docs/bindings.jl:44
 [4] aliasof(::Base.Docs.Binding) at ./docs/bindings.jl:43
 [5] doc(::Base.Docs.Binding, ::Type{T} where T) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/docview.jl:174
 [6] doc(::Base.Docs.Binding) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/docview.jl:153
 [7] top-level scope at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/docview.jl:368

In the contrary, it is totally OK to print or help a built-in message like std_msgs.msg.String.

Version info

  • ROS: noetic
  • RobotOS v0.7.2
  • Python 3.7.1
  • Julia 1.5.0
@ShuhuaGao ShuhuaGao changed the title Custom message type cannot be property displayed in REPL Custom message type cannot be properlyy displayed in REPL Aug 23, 2020
@ShuhuaGao ShuhuaGao changed the title Custom message type cannot be properlyy displayed in REPL Custom message type cannot be properly displayed in REPL Aug 23, 2020
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

1 participant